Commit Graph

100121 Commits

Author SHA1 Message Date
Hans Goudey
81da428cec Merge branch 'blender-v3.6-release' 2023-06-05 20:20:26 -04:00
Hans Goudey
41d994c9ac Fix #108571: OBJ vertex group import crash
`tot_loop_idx` was increased before it was used to set the set
the vertex group value of the current face corner's vertex.
2023-06-05 20:20:03 -04:00
Campbell Barton
f31dfa9b74 Merge branch 'blender-v3.6-release' 2023-06-06 09:49:06 +10:00
Campbell Barton
8e871971b4 Cleanup: quiet compiler warning (missing-declarations) 2023-06-06 09:42:09 +10:00
Campbell Barton
7e7c14ad4c Fix paste flipped creating invalid RNA data paths
- Paste flipped created invalid paths when the size of the name changed
  left -> right: lost the 't' in right.
  right -> left: lost the entire end of the RNA path.

- Correct the fixed buffer size as it may include escaped characters.
2023-06-06 09:35:21 +10:00
Campbell Barton
dd1fe31a74 Cleanup: quiet compiler warnings 2023-06-06 09:34:50 +10:00
Hans Goudey
5ee22dd490 Cleanup: Use const for modifier utility function 2023-06-05 16:50:26 -04:00
Hans Goudey
c2430e55c8 Cleanup: Remove disabled code from particle system modifier
This comment referenced a special case for modifier evaluation in edit
mode. With replacements on the horizon, this won't be added anymore.
2023-06-05 16:50:26 -04:00
Hans Goudey
102c015306 Cleanup: Remove argument from deform modifier utility function
This was only used in the particle system modifier.
2023-06-05 16:50:26 -04:00
Hans Goudey
73d921a0c6 Cleanup: Avoid curve to mesh conversion in some deform modifiers
Some modifiers used `MOD_deform_mesh_eval_get` to make sure they had
a mesh to retrieve vertex groups from. But since curves don't support
vertex groups anyway, and since the curve to mesh conversion is handled
by the (legacy) curve object modifier stack anyway, this is confusing
and unnecessary. This shouldn't give any behavior changes, but some
deform modifiers on legacy curve objects might be faster if they used
to do the conversion.
2023-06-05 16:50:26 -04:00
Germano Cavalcante
05b8cfec5e Transform: Allow navigation with "release_confirm"
This limitation was added to avoid conflicts with tools.

But since we now have the "allow_navigation" option on transform
operators, there is no real benefit to having this limitation.
2023-06-05 16:49:44 -03:00
Germano Cavalcante
251614c39c Transform: Include "allow_navigation" option in "Shrink/Fatten"
No functional changes from user's point of view.

"Shrink/Fatten" is used in macros for some extrude operations.

These operations may rely on the type of mesh selection.

While some of these operations are combined with the "Move" function,
which already permits navigation, others are combined with
"Shrink/Fatten", which currently lacks navigation capabilities.

To ensure consistency and enable navigation in all extrude operations,
this commit introduces the option to enable navigation for the
"Shrink/Fatten" operator.
2023-06-05 16:49:44 -03:00
Leon Schittek
27184c4643 Merge branch 'blender-v3.6-release' 2023-06-05 20:23:45 +02:00
Leon Schittek
e6a8c45fd9 Fix #108578: Crash when unlinking input sockets
Fix a mistake in commit 2ce5fc4a3e that caused a crash when detaching
node links from input sockets.

When a link is detached from an input socket, `nodeRemLink` nulls the
`link` pointer of the socket.
So before the next update inputs are linked but don't have a valid `link`
pointer causing the crash, when trying to access the link in
`std_node_socket_draw`.

The introduced check avoids the crash and is more correct since it
doesn't just check one link for multi-input sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/108623
2023-06-05 20:21:07 +02:00
Bastien Montagne
90a0f39c02 Merge branch 'blender-v3.6-release' 2023-06-05 18:12:35 +02:00
Damien Picard
745baa788d I18n: extract a few messages
- "Invalid" in transformation messages.
- For three messages, translation occured after a string
- concatenation, so the full message was not found.
  Instead, translate a format pattern and format it afterwards.
- Alembic errors when there is an import type mismatch.

Pull Request: https://projects.blender.org/blender/blender/pulls/108212
2023-06-05 18:10:11 +02:00
Falk David
8d0b10bbc7 Fix: GP brush stroke operator name and description
These were still the ones copied from the curves operator.
2023-06-05 18:06:00 +02:00
Clément Foucault
e7cc266c92 EEVEE-Next: Fix shader buildtime validation
The `eevee_render_pass_out` needs to be added
at runtime only because test shaders do not
define the `node_tree` UBO.
2023-06-05 15:45:51 +02:00
Bastien Montagne
a9612086b8 Merge branch 'blender-v3.6-release' 2023-06-05 15:35:00 +02:00
Bastien Montagne
855d8d3fa4 Fix #88010: Undo system did not respect memory limit.
Code was plainfully buggy, early-out check in
`BKE_undosys_stack_limit_steps_and_memory` was plainfully wrong.

Also added some more logging for memory limiting code.
2023-06-05 15:23:31 +02:00
Germano Cavalcante
5ea2c80e7f Fix #108574: Error when trying to move a keyframe
Error due to a typo in c4a4a89ef5

_translate > _timetranslate
2023-06-05 10:21:53 -03:00
Julian Eisel
c18ee2e84d Fix compile error on MSVC
Caused by cdd4beeb5e.
2023-06-05 14:22:14 +02:00
Weizhen Huang
d54fe40807 Cleanup: EEVEE: Simplify computation in #ltc_evaluate_disk_simple
The existing code was copied from the ellipse light case. But
this computation simplifies for the disk case, removing the
need of `inversesqrt`.

Pull Request: https://projects.blender.org/blender/blender/pulls/108616
2023-06-05 14:21:38 +02:00
Bastien Montagne
ebb5643e59 Readfile: Refactor several parts of the process
This commit affects:
* Reading undo steps from memfile (aka 'Global Undo');
* Handling of UI IDs (WindowManager, Workspaces and Screens) when
  opening a .blend file.

While no major changes are expected from a user PoV, there may be some
unexpected changes in rare edge-cases. None has been identified so far.

Undo step loading should be marginally faster (`setup_app_data` itself
is 2-3 times faster, as it does not do remapping anymore, which makes the
whole 'read undo step' process about 20% faster - but the most
time-consuming step on undo is the depsgraph processing, which remains
unchanged here).

This commit also solves some bugs (crashes) in some relatively uncommon
cases, like e.g. if the WM had an IDProperty pointing at an object and
UI is not loaded when opening a new .blend file with the 'Load UI' option
enabled (as in previous code on file opening WM ID would never be
remapped).

From a more technical side, this commit aims mainly at cleaning things
up, in preparation for the introduction of new 'no undo, no readfile'
type of handling (as part of the Brush Assets project):
  - Prevent WM code from doing (too much) horrible ID 'management' on
    its WM when opening a new file. It used to remove current WM from
    the Main database, store it in a temporary own list, and then free
    it itself...
  - Trying to make the complex logic behind WM handling on file reading a
    bit more easy to follow, at least way more documented in code.
  - Keep the handling of 'IDs being re-used from old Main' in a single
    place, as much as possible:
    -- Readfile code itself in undo case (because it's more efficient,
       and undo case is in a way simpler than actual .blend file
       reading case). The whole `blo_lib_link_restore` block of code
       is also removed.
    -- (Mostly) setup_app_data code in actual file reading case.
  - Sanitize the usage of the 'libmap' in readfile code in undo case
    (waaaaay too many pointers were added there, which was hiding some
     other issues in the related code, and potentially causing (in
     rare cases) memory addresses collisions.

Pull Request: https://projects.blender.org/blender/blender/pulls/108016
2023-06-05 13:54:49 +02:00
Julian Eisel
cdd4beeb5e Cleanup: Use C++ functor for button pushed query callback
C-style callbacks often rely on `void` pointer arguments that are unsafe
because of the removed type. C++ functors allow passing arbitrary data
along the callback, plus convenient features like defining the callback
using a lambda.

Didn't port the `typedef` because it doesn't add much in this case, just
hides the type from the reader who has to look it up first.

Note that this function isn't used in the main branch currently.
2023-06-05 12:48:44 +02:00
Jeroen Bakker
6a1aead6d1 Metal: Silence Console Output
This PR silences console output during statup phase of blender. During
startup logging isn't yet initialized and print statements where used.
Logging is initialized during the first construction of a Metal Context.

The console prints are now hidden by behind the '--debug-gpu' command
line option.

Pull Request: https://projects.blender.org/blender/blender/pulls/108593
2023-06-05 09:28:19 +02:00
Campbell Barton
c1ac3621a9 Cleanup: replace list-base count_at_most with is_single for clarity 2023-06-05 12:42:46 +10:00
Campbell Barton
aada2800fd Cleanup: use BLI_strchr_or_end to simplify new-line stepping
- DRW_draw_region_engine_info:

  - Remove duplicate line drawing for the last line.
  - Remove string copying, pass the length to BLF_draw_default instead.
  - Resolve a potential buffer overflow as the source string length was
    used to define the destinations maximum size.

- CONSOLE_OT_paste:

  - Remove the need to null-terminate each line.
  - Buffer stepping uses const values
  - console_line_insert no longer strips the string it inserts.

- CONSOLE_OT_insert:

  - New lines in the middle of text now reports an error,
    new lines at the end of text is stripped (as before).
2023-06-05 12:36:12 +10:00
Campbell Barton
7d56c8fe1d BLI_string: add BLI_strchr_or_end
Returning the pointer to the null byte when the character isn't found
is useful when handling null terminated strings that contain newlines.

This means the return value is never null and the line span always ends
at the resulting value.
2023-06-05 12:17:13 +10:00
Campbell Barton
efa4179982 PyAPI: rename filename to filepath for RNA API functions
- Depsgraph.debug_relations_graphviz
- Depsgraph.debug_stats_gnuplot
- RenderLayer.load_from_file
- RenderResult.load_from_file
- bpy.app.icons.new_triangles_from_file
2023-06-05 11:04:53 +10:00
Campbell Barton
87ff8ee09a Cleanup: disambiguate the term 'path'
Use filepath or dirpath, unless the contents might be either,
in that case note that the contents could be both.
Use `rna_path*` in some cases too.
2023-06-05 10:57:34 +10:00
Lukas Stockner
888bdc1419 Cycles: Remove MultiGGX code, replace with albedo scaling
While the multiscattering GGX code is cool and solves the darkening problem at higher roughnesses, it's also currently buggy, hard to maintain and often impractical to use due to the higher noise and render time.

In practice, though, having the exact correct directional distribution is not that important as long as the overall albedo is correct and we a) don't get the darkening effect and b) do get the saturation effect at higher roughnesses.

This can simply be achieved by adding a second lobe (https://blog.selfshadow.com/publications/s2017-shading-course/imageworks/s2017_pbs_imageworks_slides_v2.pdf) or scaling the single-scattering GGX lobe (https://blog.selfshadow.com/publications/turquin/ms_comp_final.pdf). Both approaches require the same precomputation and produce outputs of comparable quality, so I went for the simple albedo scaling since it's easier to implement and more efficient.

Overall, the results are pretty good: All scenarios that I tested (Glossy BSDF, Glass BSDF, Principled BSDF with metallic or transmissive = 1) pass the white furnace test (a material with pure-white color in front of a pure-white background should be indistinguishable from the background if it preserves energy), and the overall albedo for non-white materials matches that produced by the real multi-scattering code (with the expected saturation increase as the roughness increases).

In order to produce the precomputed tables, the PR also includes a utility that computes them. This is not built by default, since there's no reason for a user to run it (it only makes sense for documentation/reproducibility purposes and when making changes to the microfacet models).

Pull Request: https://projects.blender.org/blender/blender/pulls/107958
2023-06-05 02:20:57 +02:00
Chris Blackbourn
608fdc9c58 Merge branch 'blender-v3.6-release' 2023-06-05 12:17:09 +12:00
Chris Blackbourn
de4fb0e570 UV: Add optimal uv packings using precomputed layouts
Produce optimal layouts for `n` squares, where n == 11, 18, 19 and 26.

With thanks:
* Walter Trump
* Pertti Hamalainen
* Robert Wainwright
* Erich Friedman
2023-06-05 12:06:30 +12:00
Campbell Barton
85e5d3325c Cleanup: replace 'sz' abbreviation with 'size' 2023-06-04 19:56:19 +10:00
Campbell Barton
e82ca9b5ff Cleanup: rename ParticleSettings.child_nbr to child_percent
The old name was only kept to avoid breaking compatibility.
2023-06-04 19:52:10 +10:00
Campbell Barton
32a5dad2b2 Cleanup: use 'num' suffix for sizes in DNA instead of 'size'
Avoid ambiguity with the term size.
2023-06-04 19:48:14 +10:00
Campbell Barton
784e13170e Cleanup: function style casts, use nullptr, printf & size macros 2023-06-04 19:27:38 +10:00
Campbell Barton
e27bcb6e3e Cleanup: remove redundant struct qualifier 2023-06-04 19:27:38 +10:00
Campbell Barton
493a1dd7c8 Cleanup: remove NULL literals in C++ (including comments & strings) 2023-06-04 18:35:12 +10:00
Campbell Barton
68256a1da7 Cleanup: remove unused argument 2023-06-04 14:55:20 +10:00
Hans Goudey
ab6860f3de Geometry Nodes: Improve delete geometry performance with vertex groups
In the "All" mode, handle vertex group data separately from other
attributes, which allows copying all vertex groups at once. In a file
with 172 vertex groups, the node became about 12 times faster, from
25.8 to 2.2 ms. With fewer vertex groups the change will be smaller.

Theoretically a similar optimization would work elsewhere, but ideally
we would have a more generalized concept of sparsely stored attributes
first. In the meantime this is a simple way to improve some common
rigging use cases.
2023-06-03 10:21:43 -04:00
Germano Cavalcante
a4043286d9 Fix compilation error on Linux
```
error: conflicting types for ‘transform_mode_snap_source_init’;
have ‘void(TransInfo *, struct wmOperator *)
```
2023-06-03 08:46:30 -03:00
Leon Schittek
1e81d35138 Node Editor: Don't change size of resize area for frame nodes with zoom
Change the active area along the perimeter of frame nodes to have a more
consistent width independently of the zoom level so frame nodes can more
easily be grabbed and resized when zoomed out.

Pull Request: https://projects.blender.org/blender/blender/pulls/108359
2023-06-03 12:45:12 +02:00
Leon Schittek
cd611f7fb8 Merge branch 'blender-v3.6-release' 2023-06-03 12:37:56 +02:00
Leon Schittek
2ce5fc4a3e Fix #108336: Treat node sockets with muted links as linked
Prevent make links operator from creating links to sockets that are
already linked to a muted link.

The `SOCK_IS_LINKED` flag is used to check if there already is a link
connecting to the socket but when the link is muted, the flag wasn't set
leading to issues in parts of the code that used the flag to check
for any type of connected link.
This commit now also sets `SOCK_IS_LINKED` when links are muted and
adds an additional check in places where different behavior is expected
for muted links.

Pull Request: https://projects.blender.org/blender/blender/pulls/108375
2023-06-03 12:34:58 +02:00
Leon Schittek
cc9c720aae Fix #103068: Link insert offset not working when rotating/scaling nodes
Fix node link insertion during transform not working properly for
rotation and scale.
Inserting nodes by rotating or scaling...
* ...didn't offset the attached nodes.
* ...could lead to unfreed memory.

This commit fixes that by always calling the `NODE_OT_insert_offset`
operator at the end of the node transform operator rather than having
to explicitly append it into a macro operator for each transform
operator.

Pull Request: https://projects.blender.org/blender/blender/pulls/107460
2023-06-03 12:29:57 +02:00
Germano Cavalcante
3010f1233b Transform: new feature to edit the 'Snap Base'
This commit implements a new modifier key (`B`) for the transform
operators.

This new key allows changing the 'Snap Base' of a transform by snapping
it to a defined point in the scene.

Ref #66424

# Implementation Details

- This feature is only available in the 3D View.
- This feature is only available for the transform modes:
  - `Move`,
  - `Rotate`,
  - `Scale`,
  - `Vert Slide` and
  - `Edge Slide`.
- The `Snap Base Edit` is enabled while we are transforming and we
  press the key `B`
- The `Snap Base Edit` is confirmed when we press any of the keys:
 `B`, `LMB`, `Enter`
- During um operation, if no snap target is set for an element in the
  scene (Vertex, Edge...), the snap targets to geometry Vertex, Edge,
  Face, Center of Edge and Perpendicular of Edge are set automatically.
- Constraint or similar modal features are not available during the
  `Snap Base Edit` mode.
- Text input is not available during the `Snap Base Edit` mode.
- A prone snap base point is indicated with an small cursor drawing.

Pull Request: https://projects.blender.org/blender/blender/pulls/104443
2023-06-03 04:18:49 +02:00
Hans Goudey
0c0cd10e55 Merge branch 'blender-v3.6-release' 2023-06-02 21:19:37 -04:00
Hans Goudey
214da4b6b4 Fix #108039: Incorrect results when setting custom normals
The solution using `reverse_index_array` didn't work because it lost the
order that the corners were processed in (the order around the vertex).
This is important when setting custom normals because the process
sets sharp edges when the normal of the current and previous corner
is too different.
2023-06-02 21:18:12 -04:00