Commit Graph

102335 Commits

Author SHA1 Message Date
Lukas Tönne
fde35b65d1 Fix: socket hidden in the link drag operator for group input nodes
Two issues fixed here:
1. Mixup of "in" and "out" flags.
2. Missing node tree update tag to ensure group input nodes all have
   the new socket so it can be hidden.

Pull Request: https://projects.blender.org/blender/blender/pulls/111707
2023-08-31 14:42:06 +02:00
Hoshinova
af54b16778 Nodes: fix Voronoi Noise discontinuities when Lacunarity is 0.0.
When the Lacunarity input is driven by e.g. a Texture discontinuities can
arise because the `for` loop breaks prematurely.

Pull Request: https://projects.blender.org/blender/blender/pulls/111395
2023-08-31 14:20:27 +02:00
Julian Eisel
ba44afae5e Cleanup: Simplify outliner tree element assert
Having a `0` condition can be a bit confusing, rather have the proper
condition there so it will also get printed like this to the console.
2023-08-31 13:16:01 +02:00
Julian Eisel
4a689ea7ee Cleanup: Remove dead outliner tree element code, replace with assert
Only the ID base tree element type doesn't yet use the polymorphic
tree element design yet, and this case is handled in an earlier branch
excluding this `else` block. So this would be dead code.

Add assert to protect from future changes breaking this assumption.
2023-08-31 13:13:56 +02:00
Pablo Vazquez
9ab3a8f840 UI: Theme Editor: Mention editors that share settings
It's not immediately clear for new users that editing the
"File Browser" colors will also adjust the "Asset Browser".

Similar to how it's already the case for UV/Image Editor,
mention in the name of the panel other editors that share
the same color settings.

* Dope Sheet > Dope Sheet/Timeline
* File Browser > File/Asset Browser
* Graph Editor > Graph Editor/Drivers

The only exception is Node Editor because eventually it
will get too long.
2023-08-31 13:11:48 +02:00
Julian Eisel
6a441482e6 Cleanup: Simplify sanity check for new outliner tree element design
Except of the ID base element type, all element types are ported to have
the new polymorphic tree element object now. So this design is the rule
now with just one exception, so simplify the sanity check logic to
reflect this.
2023-08-31 13:00:52 +02:00
Julian Eisel
c130b703c5 Cleanup: Use snake case for outliner functions
To follow the style guide, these functions should use snake case. See
https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Naming.
2023-08-31 12:50:15 +02:00
Campbell Barton
d478d0597a Fix bone collection selecting not flushing to the tip/root
Also correct the notifier in edit-mode.
2023-08-31 17:45:49 +10:00
Campbell Barton
54e2aaf9ad Cleanup: split WM_keyconfig_new into new/ensure functions
Use less ambiguous naming where new(..) always returns new data.
2023-08-31 17:45:39 +10:00
Campbell Barton
1ffc0a9e64 Fix key-maps being handled twice when reloading scripts 2023-08-31 12:04:28 +10:00
Campbell Barton
4a42f2b07c Cleanup: spelling 2023-08-31 10:38:13 +10:00
Hans Goudey
7c57eb42d7 Fix #111582: Delete geometry node incorrectly marks no loose vertices
The logic for telling when there are no loose edges or vertices was
incorrect.
2023-08-30 18:16:22 -04:00
Hans Goudey
249a03525c Fix: Build error with Audaspace turned off 2023-08-30 18:14:42 -04:00
Hans Goudey
4e94db97e2 Mesh: Add three cached topology maps
Add three cached topology maps to `Mesh`, to avoid computations when
mesh data isn't changed. Choosing the right maps to cache is a bit
arbitrary, but generally we have to start somewhere. The limiting
factor is memory usage (all the new caches combined have a
comparable footprint to a UV map).

For now, the caches added are:
- Vertex to face corner
- Vertex to face
- Face corner to face

These caches are used in quite a few places already;
- Face corner normal calculation
- UV value merging
- Setting sharp edges from face angles
- Data transfer modifier
- Voxel remesh attribute remapping
- Sculpt mode painting
- Sculpt mode normal calculation
- Vertex paint mode
- Split edges geometry node
- Mesh topology geometry nodes

Caching topology maps means they don't have to be rebuilt every time
they're used. Meshes copied but without topology changes can share
the cache, further reducing re-computations. For example, FPS with a
large mesh using the "Corners of Vertex" node went from 1.8 to 2.3.
Entering sculpt mode is slightly faster too.

There is some obvious work for future commits:
- Use caches in attribute domain interpolation
- More multithreading of second phase of map building
- Update/build caches eagerly in some geometry nodes

Pull Request: https://projects.blender.org/blender/blender/pulls/107816
2023-08-30 23:41:59 +02:00
Marcos Perez
1015bed2fd VSE: Sound equalizer modifier
The sound equalizer is using the Audaspace FFT Convolver.
The blender part creates an array of descriptions of power per "band"
and orders the creation of Equalizer (ISound) in the Audaspace.

Modifier can be created on sound strips. It lets you define
amplification or attenuation over frequency range from 30Hz to 20 kHz.
The power is limited to -30 db - 30 db. This is done using curve
mapping widget.

Co-authored-by: menda <alguien@aqui.es>
Co-authored-by: Richard Antalik <richardantalik@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/105613
2023-08-30 22:36:36 +02:00
Hans Goudey
9600b74318 Fix: geometry nodes asset traits not written to file
Mistakenly removed in e071288ab2
2023-08-30 16:35:38 -04:00
Leon Schittek
30114476c7 Fix #111593: Auto-offset when inserting nodes on links inside frames
Apply auto-offset animation in relative steps to avoid issues, when
the parent space of the currently offset node changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/111637
2023-08-30 22:08:23 +02:00
Germano Cavalcante
a0b232c80d Fix #111548: Snap only working on some surface curve control points
The loop was ignoring ` nu->pntsv` in this case, resulting in only the
first point of each row being used for snapping.

This commit also simplifies the code by removing the no-snap limitation
when the curve only has 1 point.

This limitation existed because the curve is not visible in this case.

But this is contradictory for when the curve has loose points (which
are also not visible).
2023-08-30 14:49:51 -03:00
Julian Eisel
8c193180d3 Fix memory leak when freeing custom preview icons
Mistake in eefee47a8a.
2023-08-30 19:25:17 +02:00
Julian Eisel
ce8e9c6a37 Fix error in preview image freeing, own earlier commit
The wrong function was called (function called itself in fact). Mistake
in eefee47a8a.
2023-08-30 19:01:49 +02:00
Julian Eisel
401340fade MSVC: Attempt to fix build error because C++ type in C-linkage block 2023-08-30 18:59:38 +02:00
Harley Acheson
ca00c9aa3e UI: Header Status Text Changes
Draw status text in the Tool Settings bar if visible, rather than
Header.

Pull Request: https://projects.blender.org/blender/blender/pulls/111676
2023-08-30 18:59:17 +02:00
Julian Eisel
eefee47a8a UI: Refactor deferred preview image storage
Previously we'd just allocate extra space for additional data for the
deferred loading, and then do pointer arithmetic to access that data.
This is cryptic and not type safe.

Instead, use an internal type deriving from `PreviewImage`, and manage
that internally. This ensures type safety, while keeping this as
implementation detail (not visible outside of the preview image API) and
keeping internals easy to understand.

Some code did shallow copies of preview images, making ownership
unclear. That made things a bit tricky, but I've made support for
shallow copies explicit now and noted this in comments.
2023-08-30 17:50:48 +02:00
Sergey Sharybin
1f03148fee Cleanup: Remove unused field and update comments in Render
Pull Request: https://projects.blender.org/blender/blender/pulls/111690
2023-08-30 17:43:24 +02:00
Hans Goudey
e56b1fc164 Cleanup: Make SubdivCCG a non-trivial struct
Allocate with `MEM_new`, free with `MEM_delete`, and provide
explicit defaults to guarantee values after initialization.
2023-08-30 11:36:36 -04:00
Hans Goudey
fdd6065c21 Cleanup: Add missing struct forward declaration 2023-08-30 11:26:20 -04:00
Philipp Oeser
4cf0e7acfb Fix: Enter on the filebrowser filename label skips operator
Regression from c3dfe1e204.

Above commit put a dummy dragable button over the filename (well, to
allow dragging). Enabling drag ripples down to the button ending up in
the `BUTTON_STATE_HIGHLIGHT` state [which is still good of course].
However, `ui_do_but_EXIT` will then return `WM_UI_HANDLER_BREAK` which
then results in the filebrowser operator being skipped.

`ui_do_but_EXIT` already had a special case for file-browser drag button
[which would return `WM_UI_HANDLER_CONTINUE` instead]. Formerly this was
just the icon, now it is the icon and filename label. So in order to fix
this, remove the explicit check for the `but->imb` which will then
include the dragable label button in the exception for returning
`WM_UI_HANDLER_CONTINUE`.

Fixes #111645.

Pull Request: https://projects.blender.org/blender/blender/pulls/111693
2023-08-30 16:19:38 +02:00
Julian Eisel
b5b77a43e2 UI: Add assert for valid asset shelf type
Sanity check to make sure no asset shelf points to an invalid (not
registered) asset shelf type.
2023-08-30 16:03:37 +02:00
Julian Eisel
94d82531d4 Fix #111694: Crash when reloading scripts with asset shelves
The asset shelf type would be removed, but there may still be an active
asset shelf (or previously active shelves) in memory that reference this
type. Now unset this reference so the shelf is not considered for
display anymore. This way the shelves storage is preserved (and saved to
files) and settings like the visible catalogs will be kept for when the
type becomes available again.
2023-08-30 16:03:15 +02:00
Bastien Montagne
770f5045b5 Cleanup: Move generic validity checks on blend data to DEBUG report.
Also reword it a bit, as 'sanity' is not clear enough it seems...
2023-08-30 15:08:28 +02:00
Jacques Lucke
152f5dc897 Fix #111633: crash with cyclic node tree zones
The problem was that there was a cyclic nesting dependency that was not detected
correctly, which led to problems further down the line. See the PR for details.

Right now, the zones just disappear when there is an error. This has to be improved
at some point, but it outside of the scope of this patch.

A regression test that covers this case is added as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/111689
2023-08-30 14:50:53 +02:00
Hans Goudey
f41dc90925 Mesh: Rewrite split edges algorithm
The new split edges code from e83f46ea76 started the use of
Mesh rather than BMesh as a performance improvement. However, the code
contained a complex loop used for de-duplicating edges that gave invalid
indices in some circumstances. That was fixed by b226c115e2,
but in turn that commit caused loose edges to be skipped. That was
fixed by 111e378366, however that caused another crash.

Long story short, the code is quite complex and the existing algorithm,
while an improvement from the original, is fiddly. For example, instead
of working with just the input and output states, it adjusted topology
data for an intermediate state halfway through the change.

Fixes #109236

**Goals**
- Only use topology maps from the input mesh. This should work better
  with future topology caching improvements (See !107816).
- Run de-duplication in a per-edge context to allow parallelization.
- Optimize for real world use cases when there is merging of new edges.
- Improve readability by making each step's inputs clear, improving naming,
  and separating functions.
- Improve handling of loose edges.
- Reuse existing edges for the first new split edges, simplifying
  edge attribute propagation.

**Timing**
I tested performance with a Ryzen 7950x and a grid with 4 million faces
with different random portions of the mesh selected.

| Selection | Before (ms) | After (ms) | Change |
| --------- | ----------- | ---------- | ------ |
| 100%      | 1869.4      | 351.8      | 5.3x  |
| 50%       | 1636.0      | 356.0      | 4.6x  |
| 10%       | 1148.8      | 238.2      | 4.8x  |

| 4 Million Face Grid             | 10%  | 50%  | 100% |
| ------------------------------- | ---- | ---- | ---- |
| `vert_selection_from_edge`      | 2.7  | 4.1  | 4.3  |
| `selection_to_bit_vector`       | 0.7  | 3.9  | 0.2  |
| `vert_to_corner_map`            | 22.3 | 22.5 | 22.4 |
| `edge_to_corner_map`            | 47.7 | 47.6 | 47.6 |
| `corner_to_face_map`            | 3.3  | 3.3  | 3.3  |
| `calc_all_corner_groups`        | 21.0 | 44.1 | 38.3 |
| `calc_vert_ranges_per_old_vert` | 3.0  | 7.4  | 7.9  |
| `update_corner_verts`           | 2.8  | 12.7 | 15.5 |
| `calc_new_edges`                | 28.8 | 44.1 | 35.5 |
| `update_unselected_edges`       | 9.8  | 9.3  | 0.0  |
| `propagate_edge_attributes`     | 35.7 | 51.3 | 61.7 |
| `propagate_vert_attributes`     | 24.0 | 27.0 | 31.7 |
| `propagate_vert_attributes`     | 24.2 | 29.7 | 36.9 |

**Tests**
New regression tests have been committed separately. Existing
tests were updated since the new code gives different indices.
2023-08-30 14:23:42 +02:00
Campbell Barton
cbc14782ff Fix mistaken revert of EEVEE fix in recent commit
[0] unintentionally reverted [1], correcting.

[0]: 3d607be572
[1]: 068e117a8b
2023-08-30 21:23:36 +10:00
Lukas Tönne
e071288ab2 Nodes: Panels integration with blend files and UI
Part 3/3 of #109135, #110272

Switch to new node group interfaces and deprecate old DNA and API.
This completes support for panels in node drawing and in node group
interface declarations in particular.

The new node group interface DNA and RNA code has been added in parts
1 and 2 (#110885, #110952) but has not be enabled yet. This commit
completes the integration by
* enabling the new RNA API
* using the new API in UI
* read/write new interfaces from blend files
* add versioning for backward compatibility
* add forward-compatible writing code to reconstruct old interfaces

All places accessing node group interface declarations should now be
using the new API. A runtime cache has been added that allows simple
linear access to socket inputs and outputs even when a panel hierarchy
is used.

Old DNA has been deprecated and should only be accessed for versioning
(inputs/outputs renamed to inputs_legacy/outputs_legacy to catch
errors). Versioning code ensures both backward and forward
compatibility of existing files.

The API for old interfaces is removed. The new API is very similar but
is defined on the `ntree.interface` instead of the `ntree` directly.
Breaking change notifications and detailed instructions for migrating
will be added.

A python test has been added for the node group API functions. This
includes new functionality such as creating panels and moving items
between different levels.

This patch does not yet contain panel representations in the modifier
UI. This has been tested in a separate branch and will be added with a
later PR (#108565).

Pull Request: https://projects.blender.org/blender/blender/pulls/111348
2023-08-30 12:37:21 +02:00
Philipp Oeser
f77fdbff8a Fix #111642: VSE glow code can overflow with small proxies
With such small proxy sizes (combined with a small blur radius), the
kernels `halfWidth` can get zero, which leads to a memory allocation of
same zero size and writing to that memory leads to overflow/crashes/can
only go downhill from there.

Now early out in such cases [which leads to
slightly different output -- well if the "buggy" output survives and
does not crash that is].

(alternatively we could just prevent the overflow and still let do
`RVBlurBitmap2_float` do stuff that it really shouldnt imo, see first version of the PR)

Pull Request: https://projects.blender.org/blender/blender/pulls/111660
2023-08-30 10:24:45 +02:00
Petar Dosev
5894ab2e07 Fix #104022: Expand Mask inverted fill
A small new feature that clears the mask completely on the current mesh island.
Closes #104022

When hovering outside the object the Expand operator is running on, it will get floodfilled with the mask/face set.

Previously, when the Invert option was used, it wouldn't also clear the mask/face set when hovering outside the object.

Pull Request: https://projects.blender.org/blender/blender/pulls/111665
2023-08-30 09:28:46 +02:00
Campbell Barton
a6837ac517 PyAPI: support building with the up-coming Python 3.12
- Account for new member in _PyArg_Parser.

- Many Python op-codes have been removed.
  For the moment these are disabled in is_opcode_secure.
  Some should be added back as intrinsics, noted in code-comments.
2023-08-30 14:08:56 +10:00
Campbell Barton
0db1664ba4 Cleanup: reduce right shift in wm_window_timers_process 2023-08-30 12:17:30 +10:00
Campbell Barton
d7b9467f19 Cleanup: simplify wm_jobs_timer_end, wm_jobs_timer
The logic in wm_jobs_timer made it seem as if timers might be shared
between wmJob's however this is never the case.

Replace a loop on wmJob's with a lookup & NULL check.
2023-08-30 12:17:29 +10:00
Campbell Barton
09471c8636 Cleanup: simplify WM_event_timer_sleep
Use remove the inline loop as it was only used to check if the timer
is in wm->timers.
2023-08-30 11:11:20 +10:00
Campbell Barton
745f78f9f0 WM: improve timer precision for more precise playback
When a timer needs to execute during the idle time (currently 5ms), use
microsecond precision to ensure the timer isn't delayed by the idle
time.

This improves the precision of animation playback on systems that
support it
(WIN32, see note below).

In my tests FPS playback varied:

- 59.94 FPS would jitter between 58.13 & 63.11 FPS. 23.98 FPS would
- jitter between 23.68 & 24.31 FPS.

Using higher precision timers mostly resolves this issue although there
is still some jitter although it's now limited to ~0.01 FPS.

These values were measured with the FPS-Samples set to 1 to show the
real times between frames (without the values being smoothed out).

This is a continuation of a fix for #111579 which avoided the worst of
the jittering issues at higher frame rates.

It appears WIN32 doesn't support sleeping shorter than 1 millisecond via
`std::this_thread::sleep_for`, making this change have no benefit on
WIN32, from tests it also doesn't have any down sides, so avoid platform
specific logic. The WIN32 limitation is noted in code-comments. If a
method of higher precision method is available this can be investigated.
2023-08-30 10:57:20 +10:00
Campbell Barton
0026d20c8c Cleanup: quiet compiler warnings, correct doxy section 2023-08-30 10:57:17 +10:00
Campbell Barton
2eceb48ea7 Cleanup: simplify NewGeometryNodeGroupTool poll function
Move inline comment into the space_data doc-string.
2023-08-30 10:57:15 +10:00
Campbell Barton
3d607be572 Cleanup: spelling in comments 2023-08-30 10:57:12 +10:00
Campbell Barton
4ea5feb7d2 Cleanup: use _itemf suffix for enum callback, remove leading separator
Also check for obpose being NULL even when the context exists.
2023-08-30 10:57:11 +10:00
Campbell Barton
87379a1c86 Cleanup: license header 2023-08-30 10:57:09 +10:00
Nathan Vegdahl
6d2c7c509c Fix: failing keymap test for ARMATURE_OT_assign_to_collection
Breakage introduced by 998136f7a7

Pull Request: https://projects.blender.org/blender/blender/pulls/111667
2023-08-29 20:14:33 +02:00
Hans Goudey
7563b96945 Geometry Nodes: Avoid attribute copy in simple case of points to curves
When the final curve point indices are in the same order as the input
points, and there are many curves, avoid copying point domain
attributes, by generalizing the existing check from the mesh
to curve conversion node.

Pull Request: https://projects.blender.org/blender/blender/pulls/111662
2023-08-29 20:12:47 +02:00
Philipp Oeser
a3c045d49d Fix: Customdata merging does not check layer limit on destination
`LayerTypeInfo` can define a `layers_max()` function which determines the
maximum allowed number of layers.

Upon merging, this limit was respected from the source, but not on the
destination, so it was possible to exceed the max (if there were layers
on the destination already).

NOTE: `layers_max()` is currently only defined for legacy CD_MTFACE, but
we might want to enforce this for UVs / CD_PROP_FLOAT2 again.

This came up in #111608.

Pull Request: https://projects.blender.org/blender/blender/pulls/111609
2023-08-29 18:02:36 +02:00
Hans Goudey
3f0eba32d4 Cleanup: Fix unused variable warning 2023-08-29 12:00:18 -04:00