Commit Graph

120055 Commits

Author SHA1 Message Date
Campbell Barton
225fc6fca7 Cleanup: spelling in comments, correct outdated comment 2023-12-17 16:04:38 +11:00
Campbell Barton
50f929c384 Cleanup: correct struct member comment name
Part of !115011, the underlying member wasn't renamed.
2023-12-17 16:04:36 +11:00
Campbell Barton
4fc553191b Cleanup: quite unused variable warning with CMake 2023-12-17 16:04:34 +11:00
Campbell Barton
6accd8503e Cleanup: format 2023-12-17 16:04:33 +11:00
Hans Goudey
7c423682bc Cleanup: Remove unnecessary namespace specification 2023-12-16 12:54:31 -05:00
Hans Goudey
f5adfa6acd Fix: New generic attributes uninitialized after curves draw tool
Add a utility to set attribute values to their default, use it in a few
places that have already done this samething. Also:
- Don't create resolution or cyclic attributes unnecessarily
- Use API function to set new curve's type
- Always create the new selection on the curve domain
- Remove selection before resize to avoid unnecessary work
2023-12-16 12:52:22 -05:00
Hans Goudey
0e8c874166 Curves: Add edit mode tilt control
Adds support for the tilt transform operator and a "Clear Tilt"
operator to mirror the functionality from the legacy curve type.
2023-12-16 12:08:28 -05:00
Hans Goudey
3ddba82716 Cleanup: Remove unused PBVH node pointer
Removed in 47f46637be.
Also remove a lost comment and unused forward declarations.
2023-12-16 11:16:10 -05:00
Hans Goudey
488de130b3 Cleanup: Use FunctionRef for PBVH callbacks 2023-12-16 11:14:25 -05:00
Hans Goudey
3d82c9c239 Cleanup: Move more PBVH code to C++ namespaces
Also remove redundant parts of function names.
2023-12-15 22:51:10 -05:00
Hans Goudey
912c4c60d8 Mesh: Add viewport normals simplify option
Before #108014, toggling "Auto Smooth" was an easy way to disable
evaluation of custom normals and face corner normals for faster
viewport playback performance. Now that corner normals are calculated
automatically as necessary, it's helpful to still have a way to disable
expensive normal computation for faster playback.

This commit adds a "Normals" scene simplify setting. To avoid a bunch
of complexity, it just influences which normals are requested from the
object by viewport rendering. In my tests, skipping calculating at
least doubled viewport FPS in a few test files with a large mesh with
custom normals. This works well because normals are cached and lazily
calculated.

Pull Request: https://projects.blender.org/blender/blender/pulls/113975
2023-12-16 00:18:41 +01:00
Brecht Van Lommel
bf97dc14ba Cleanup: make format 2023-12-16 00:02:52 +01:00
Michael B Johnson
5edda6cbcc USD: optionally author subdivision schema on export
USD: optionally author subdivision schema on export

This PR adds support for exporting USD assets which have the subdivision
schema applied. Current behavior prior to this PR is that the effects of
Subdivision Surface modifiers are always applied to their mesh prior to
export, such that it is not possible to recover the original base mesh.

In this PR we provide three options for the subdiv schema type:

Ignore - Export base mesh without subdivision with USD Scheme = None
Tessellate - Export subdivided mesh with USD Scheme = None
Best Match (default) - Export base mesh with USD Scheme = Catmull-Clark

"Best Match" here means that Blender will set a subdiv scheme type in
the exported USD asset when it is possible to closely match the
subdivision surface type that was authored in Blender. At this time
Blender provides two subdivision types: Catmull-Clark and Simple.

Because Simple does not have a corresponding subdivision type in USD, we
do not attempt to convert or represent it, and instead the Simple subdiv
modifier will be evaluated and applied to the mesh during export.

Whenever a Catmull-Clark Subdivision Surface modifier is applied to an
object, and is the last modifier in the stack, it is possible to set the
subdiv scheme to Catmull-Clark for the respective prim in the exported
USD file.

Authored by Apple: Matt McLin

Co-authored-by: Matt McLin <mmclin@apple.com>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/113267
2023-12-15 21:11:41 +01:00
Richard Antalik
9f0b4344ac Fix #114630: Retiming fails if movie and scene FPS does not match
The main problem is, that retiming key frame index is defined in strip
content space (0 <> seq->len -1), but API functions must rescale this
index by applying `SEQ_time_media_playback_rate_factor_get()` and return
value in timeline space.

This wasn't done properly, in many places, some had challenges:
- `SEQ_retiming_key_timeline_frame_get()` returned floats, but UI
  expects integers. Otherwise keys may be drawn inbetween frames.
- Function `right_fake_key_frame_get()` must return  exact frame of
  keys, otherwise lookup by frame would fail. But `retime_key_draw()`
  can not compensate position of last fake key, so this has to be done
  in `fake_keys_draw()` and `try_to_realize_virtual_key()`.
- For transformation to work as expected, double precision value has
  to be used for frame index.
- For UI either API would had to be extended to provide helper functions
  to deal with FPS mismatch, or it needs to know the FPS difference.
  I have opted to put `SEQ_time_media_playback_rate_factor_get()` in
  "public" headers. Neither solution is great.
2023-12-15 21:01:44 +01:00
Aras Pranckevicius
5eb5712329 ffmpeg: restore compatibility with pre-5.0 versions
Only do threaded sws_scale_frame when using ffmpeg 5.0 or later.
On earlier versions continue using the single threaded path.

Pull Request: https://projects.blender.org/blender/blender/pulls/116226
2023-12-15 19:29:57 +01:00
Bastien Montagne
13148cdf39 Fix: (studio-reported) crash in Solidify Modifier code.
Regression from b52a071e7a, mistakenly replaced the destination by the
source mesh for some data (like face material indices attribute).
2023-12-15 18:15:39 +01:00
Hans Goudey
3fb6397b79 Cleanup: Remove extern "C" from mesh C header
We're in a strange half-transitioned state with this header.
In the meantime, removing this helps simplify some refactors.
2023-12-15 10:35:06 -05:00
Christoph Lendenfeld
3b1fd5d965 Cleanup: remove unused variable
The variable was missed in a previous
refactor commit.
2023-12-15 16:00:01 +01:00
Christoph Lendenfeld
6cb2ad7b39 Refactor: extract code from ANIM_apply_keyingset
No functional changes.

Extracting the section inside the `LISTBASE_FOREACH`
that inserts keyframes based on a `KS_Path`.
This moves variables closer to where they are used and
will allow to simplify the code later.

This also improves variable names by spelling out
the words instead of using abbreviations.
e.g. `ks` -> `keying_set`

Pull Request: https://projects.blender.org/blender/blender/pulls/116224
2023-12-15 15:53:35 +01:00
Philipp Oeser
ff7b8f3412 Fix #116188: Symmetry breaks the Puff hair sculpting tool
Caused by 1b19f62917 .

Above commit didnt max the weight for each curve for each symmetry run
(so was just using the max it found for each run, overwriting the
previous run).

Pull Request: https://projects.blender.org/blender/blender/pulls/116221
2023-12-15 15:46:38 +01:00
Campbell Barton
9097f1c62d Cleanup: unhyphenate track-pad & thumb-stick
Both are typically written without hyphenation, add to local dictionary.
2023-12-15 22:57:34 +11:00
Aras Pranckevicius
422dd9404f ffmpeg: multithreaded conversion from RGBA into encoding format
Whenever movie frame encoding needs to be in non-RGBA format (pretty much
always, e.g. H.264 uses YUV etc.), the ffmpeg code has been using
sws_scale() since 2007. But that one is completely single threaded.

It can be multi-threaded by passing "threads" option to SwsContext
(in a cumbersome way), combined with sws_scale_frame API. Which however
requires frame data buffers to be allocated via AVBuffer machinery.

Rendering a 300-frame part of Sprite Fright Edit (target H.264 Medium):

- Windows Ryzen 5950X: 16.1 -> 12.0 seconds (generate_video_frame part
  4.7 -> 0.7 sec).
- Mac M1 Max: 13.1 -> 12.5 sec. Speedup is smaller, but comparatively,
  entirely other part of movie rendering (audio resampling inside audaspace)
  is way more expensive compared to the windows machine.
2023-12-15 12:35:59 +01:00
Antonio Vazquez
926854ddc4 GPv3: Material Render Preview
This adds support for material previews for GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/115985
2023-12-15 11:50:48 +01:00
Bastien Montagne
c23b51d614 Fix #116193: Assert on selecting object in outliner.
The asserts added in b840ba1f59 revealed the bug, which was passing the
wrong Scene pointer to `BKE_view_layer_synced_ensure` in affected code.

Issue likely introduced in 68589a31eb, was probably never actually a
crash-case because the viewlayer would always be in sync already when
this was called from the Outliner (besides perhaps some extremely rare
edge cases).

To be backported to potential bugfix release of 4.0 together with
b840ba1f59 commit.
2023-12-15 10:36:44 +01:00
Lukas Tönne
92cf9dd2f2 ID properties: Support enum values with items
Add support for enum values in ID properties.

This is needed for the "Menu Switch" node implementation (#113445) which
relies on ID properties for the top-level modifier UI.

Enums items can optionally be added to the UI data of integer
properties. Each property stores a full set of the enum items to keep
things simple.

Enum items can be added to properties using the `id_properties_ui`
function in the python API. A detailed example can be found in the
`bl_pyapi_idprop.py` test.

There is currently no support yet for editing enum items through the UI.
This is because the "Edit Property" feature is implemented entirely
through a single operator (`WM_OT_properties_edit`) and its properties.
Buttons to add/remove/move items would be operators changing another
operator's properties. A refactor of the custom properties UI is likely
required to make this work.

Pull Request: https://projects.blender.org/blender/blender/pulls/114362
2023-12-15 10:20:44 +01:00
Campbell Barton
7346727cfc Fix #116215: Sequencer crashes unlinking packed text
[0] caused a regression looking up fonts by filepath.

[0]: d770fd5ac4
2023-12-15 20:13:40 +11:00
Hans Goudey
c8aecac001 Cleanup: Remove unused sculpt code
Remove abstract edge and face types. The design is to not abstract away
the code data structures like this and focus on sharing code more with the
rest of Blender rather than within sculpt mode.
2023-12-14 18:25:20 -05:00
Hans Goudey
b3aca5b28f Cleanup: Simplify PBVH build process slightly
Before this happened as two steps: first allocating the PBVH with a type,
then calculating the BVH and filling it with data. This just confused things,
so change to allocating the struct when building it. Also move the functions
to the C++ namespace, and fix some cases of requiring the PBVH to be set
when it wasn't yet.
2023-12-14 18:20:46 -05:00
Harley Acheson
8c6898c04d Fix #116135: Ensure blf_font_width_to_rstrlen always works
If the string is shorter than the cut-off length, ensure we always
exit cleanly when we iterate to the very start of the string.

Pull Request: https://projects.blender.org/blender/blender/pulls/116208
2023-12-14 23:19:08 +01:00
Hans Goudey
87e8a282bc Fix: PBVH has face sets check ignored for BMesh 2023-12-14 15:41:02 -05:00
Hans Goudey
4c1f766d0d Cleanup: Remove unnecessary PBVH threading settings function
There were just two more places using the C threading API in sculpt code.
Switch them to the C++ API and remove the settings function.
2023-12-14 15:39:33 -05:00
Hans Goudey
ce4ec6d42b Cleanup: Tweak PBVH node face indices functions, add comments 2023-12-14 15:31:12 -05:00
Hans Goudey
71b6f0ecbe Cleanup: Pass vertex update array as argument when building PBVH
To prepare for potentially not storing this array in the PBVH.
2023-12-14 15:13:52 -05:00
Hans Goudey
1d94003660 Cleanup: Remove unnecessary sculpt visibility update
Mainly for semantic reasoning-- these face set gestures don't change visibility.
2023-12-14 15:06:08 -05:00
Hans Goudey
f15bca64f2 Cleanup: Remove useless PBVH update function
This `update_vertex_data` only found nodes with the color update
tag and also added redraw tags. But whenever nodes are marked
for a color update, those redraw tags are already set anyway.
It appears this was meant to solve problems switching active
color attributes during undo and redo, but it doesn't make a
difference when this function is removed.
2023-12-14 15:01:27 -05:00
Hans Goudey
262572a6a0 Cleanup: Move PBVH update functions to C++ namespace 2023-12-14 14:56:25 -05:00
Hans Goudey
5be9a1cce4 Cleanup: Slightly simplify some loops in delaunary triangulation
Use a local variable for the faces, use range based for loops.
2023-12-14 12:40:46 -05:00
Hans Goudey
34bf1f6c0c Cleanup: Slightly simplify delaunay triangulation input gathering
Separate allocation of input arrays and assignment to input class.
The main purpose is to simplify #111061.
2023-12-14 12:40:46 -05:00
Hans Goudey
bb2a289a9a Cleanup: Use utility function to calculate face normal
Rather than inlining all the logic into OBJ export code
2023-12-14 12:40:46 -05:00
Miguel Pozo
9bf942dcc9 Cleanup: Conver macros into functions
Avoids macro redefinition warnings in unity builds.
2023-12-14 18:34:20 +01:00
Iliya Katueshenock
999c0f6878 Cleanup: Fix compiler warning in face group boundaries node
Fix error of wrong parameter for `compare_exchange_weak`. Second
one parameter is used for write new value, but a mistake occurred and
the wrong parameter (for read) was used. Default param is enough for
this, so just delete last one.

Pull Request: https://projects.blender.org/blender/blender/pulls/116010
2023-12-14 18:32:21 +01:00
Sybren A. Stüvel
b5e7e6b214 Cleanup: Anim, add explanation to bone collection assign operator
Just a little explanation of the code, because I got confused by my own.

No functional changes, except for the addition of a `BLI_assert_msg()`.
2023-12-14 18:07:10 +01:00
Hans Goudey
a494d6a641 Cleanup: Remove unnecessary C API for delaunay triangulation
The only user was the Python API. Convert that to use the C++ API.
That simplifies things a bit even, since the encoding of "arrays of arrays"
is a fair amount simpler with the C++ data structures. The motivation
is to simplify the changes from #111061.
2023-12-14 11:40:06 -05:00
Aras Pranckevicius
5cac8e2bb4 VSE: reduce effects code duplication, making gaussian blur faster in the process
Now that the code is in C++, quite some duplication between "byte" and
"float" effect code paths can be reduced (easier than it was in C times).
So I did that, removing about 400 lines of code.

In that process I accidentally made Gaussian Blur faster, since while
reducing the amount of code I noticed it was doing some things
sub-optimally (calculated kernel tables for each job, etc.). Applying
100x100 gaussian blur on 4K UHD resolution image strip on Ryzen 5950X
went 630ms -> 450ms.

Pull Request: https://projects.blender.org/blender/blender/pulls/116089
2023-12-14 17:31:05 +01:00
Jeroen Bakker
4a34dcbb69 Studiolight: Free Resources for Unused Lights.
Studio lights based on image resources are kept in memory, even when only
displayed as an icon. When having many studio lights configured
leads to allocating a lot of memory that are not used.

This patch free image resources when only icons are requested.
For studio lights that are used in a viewport the image resources are kept.

Pull Request: https://projects.blender.org/blender/blender/pulls/116191
2023-12-14 16:17:55 +01:00
Hans Goudey
451aa56d9c Cleanup: Move BLI_delaunay_2d.hh to C++ 2023-12-14 10:05:35 -05:00
Hans Goudey
5b053204ed Fix #116017: Mesh edit mode vertex slide allocation ignores alignment
`float4x4` requires 16 byte alignment. The compiler can add padding
within the struct, but the allocation needs to know about the alignment
too. Fix by using an allocation function that handles this properly.
2023-12-14 09:30:19 -05:00
Aras Pranckevicius
1e0bf33b00 ImBuf: optimize IMB_transform
IMB_transform is used by Sequencer (and other places) to do image
translation/rotation/scale on the CPU. This PR speeds up parts of it,
particularly when bilinear filtering is used. No behavior changes are
expected.

- Don't use virtual function calls inside inner loop. The code was using
  class hierarchies with virtual calls just to do equivalent of "outside
  of image? ignore" and "wrap UV coordinates or not?" decisions. Make those
  use non-virtual function based code.
- Simplify pixel sampling functions to only do the work as needed by
  anything within Blender codebase. For example, bilinear sampling of uchar
  images always uses 4 RGBA channels and never does "UV wrap" logic.
- Bilinear interpolation uchar: completely branchless SIMD code now.
- Bilinear interpolation float: 2x floor() calls instead of 4x floor() +
  2x ceil(), and final sample blending is done with SIMD.

Sequencer at 4K UHD resolution, with two image strips that need a transform,
playback framerate:

- Windows Ryzen 5950X: 18.7fps -> 26.2fps (IMB_transform time per frame goes
  26.3ms -> 11.2ms)
- Mac M1 Max: 27.3fps -> 31.4fps

At that point the IMB_transform is not the slowest part of where playback
takes time (but rather sequencer effect application etc.).

Note: the amount of _actual code_ got a bit smaller. But I've added 100 lines
of unit tests in BLI_math_interp_test.cc, the bilinear interpolation
functions were only tested very indirectly by CPU compositor template
image tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/115653
2023-12-14 15:10:30 +01:00
Jeroen Bakker
a52a362527 Studiolights: Remove Unused Options
Studio lights had gone over several iterations during 2.80. Some
unused options where still in the code, but not used.

This PR cleans up the studio lights to options that are still in use.
Removing:

- Spherical Harmonics: It was used by workbench, but was replaced
  by regular OpenGL lights
- Irradiance textures: Was used by an old eevee world light evaluation
- Cached data files.

Pull Request: https://projects.blender.org/blender/blender/pulls/116186
2023-12-14 14:29:28 +01:00
Christoph Lendenfeld
915358f8b6 Cleanup: Remove unused EnumPropertyItem
The channel_bake_remove_options were forgotten
to be removed. They were no longer in use after
addressing review comments.
This fixes the compiler warning.
2023-12-14 14:21:16 +01:00