Commit Graph

105543 Commits

Author SHA1 Message Date
Hans Goudey 19001c9e6c Cleanup: Move attribute domain enum to C++ header, use enum class
Each value is now out of the global namespace, so they can be shorter
and easier to read. Most of this commit just adds the necessary casting
and namespace specification. `enum class` can be forward declared since
it has a specified size. We will make use of that in the next commit.
2023-12-20 13:25:28 -05:00
Hans Goudey 2618c1d71d Cleanup: Use utility to fill default attribute values
See f5adfa6acd
2023-12-20 13:25:28 -05:00
Bastien Montagne 25ab53a4af Cleanup: Remove LibOverride Template experimental feature.
This was added at the start of the project, as a way for the source
library to control what would be overridable by the user of the data
(production files).

The implementation never went beyond the experimental area, and only
exposed in the python API then. The idea has been superseeded by the
'cherry-pick' design, so there is no point in keeping this code any
longer.
2023-12-20 17:57:24 +01:00
Hans Goudey 399e8264e6 Cleanup: Remove unused paint struct
Also remove documentation of obvious function arguments.
2023-12-20 10:29:52 -05:00
Jacques Lucke 70a53a815e Cleanup: avoid openvdb include in general in common header 2023-12-20 15:59:44 +01:00
Jacques Lucke 59c84ee95b Cleanup: extract function to show missing openvdb error message 2023-12-20 15:58:56 +01:00
Jacques Lucke a72e7a220d Volumes: refactor volume grid storage
This refactors how volume grids are stored with the following new goals in mind:
* Get a **stand-alone volume grid** data structure that can be used by geometry nodes.
  Previously, the `VolumeGrid` data structure was tightly coupled with the `Volume` data block.
* Support **implicit sharing of grids and trees**. Previously, it was possible to share data
  when multiple `Volume` data blocks loaded grids from the same `.vdb` files but this was
  not flexible enough.
* Get a safe API for **lazy-loading and unloading** of grids without requiring explicit calls
  to some "load" function all the time.
* Get a safe API for **caching grids from files** that is not coupled to the `Volume` data block.
* Get a **tiered API** for different levels of `openvdb` involvement:
  * No `OpenVDB`: Since `WITH_OPENVDB` is optional, it's helpful to have parts of the API that
    still work in this case. This makes it possible to write high level code for volumes that does
    not require `#ifdef WITH_OPENVDB` checks everywhere. This is in `BKE_volume_grid_fwd.hh`.
  * Shallow `OpenVDB`: Code using this API requires `WITH_OPENVDB` checks. However, care
  is taken to not include the expensive parts of `OpenVDB` and to use forward declarations as
  much as possible. This is in `BKE_volume_grid.hh` and uses `openvdb_fwd.hh`.
  * "Full" `OpenVDB`: This API requires more heavy `OpenVDB` includes. Fortunately, it turned
  out to be not necessary for the common API. So this is only used for task specific APIs.

At the core of the new API is the `VolumeGridData` type. It's a wrapper around an
`openvdb::Grid` and adds some features on top like implicit sharing, lazy-loading and unloading.
Then there are `GVolumeGrid` and `VolumeGrid` which are containers for a volume grid.
Semantically, each `VolumeGrid` has its own independent grid, but this is cheap due to implicit
sharing. At highest level we currently have the `Volume` data-block which contains a list of
`VolumeGrid`.

```mermaid
flowchart LR
  Volume --> VolumeGrid --> VolumeGridData --> openvdb::Grid
```

The loading of `.vdb` files is abstracted away behind the volume file cache API. This API makes
it easy to load and reuse entire files and individual grids from disk. It also supports caching
simplify levels for grids on disk.

An important new concept are the "tree access tokens". Whenever some code wants to work
with an openvdb tree, it has to retrieve an access token from the corresponding `VolumeGridData`.
This access token has to be kept alive for as long as the code works with the grid data. The same
token is valid for read and write access. The purpose of these access tokens is to make it possible
to detect when some code is currently working with the openvdb tree. This allows freeing it if it's
possible to reload it later on (e.g. from disk). It's possible to free a tree that is referenced by
multiple owners, but only no one is actively working with. In some sense, this is similar to the
existing `ImageUser` concept.

The most important new files to read are `BKE_volume_grid.hh` and `BKE_volume_grid_file_cache.hh`.
Most other changes are updates to existing code to use the new API.

Pull Request: https://projects.blender.org/blender/blender/pulls/116315
2023-12-20 15:32:52 +01:00
Hans Goudey 5f527fdc89 Fix #116373: Error using foreach_get on MeshLoopTriangle loops
Turns out the array length needs to be set after the DNA.
2023-12-20 08:40:27 -05:00
Aras Pranckevicius 408bc52bed Cleanup: fix Linux/gcc build 2023-12-20 15:27:28 +02:00
Aras Pranckevicius b8ada36518 Cleanup: move image_intern.h -> .hh 2023-12-20 15:07:48 +02:00
Bastien Montagne 1ae10de6b2 Cleanup: Make all 'Experimental -> Debug' preferences OFF by default.
Form a logic PoV, it makes more sense to have all 'debug' options
disabled as the 'normal' situation.

This commit merely invert the RNA-exposition of two settings (Asset
Indexer and Override auto-resync).
2023-12-20 13:10:35 +01:00
Hans Goudey 8dd8f932e2 Cleanup: Rename Mesh loop_data to corner_data
Related to #110434, efbee2d606, 7c69c8827b
2023-12-19 20:39:05 -05:00
Clément Foucault ad6e68d12f Fix: EEVEE-Next: Lights do not render with Metal
Related to #116128. This is just a workaround and
not a full fix. There seem to be something bad in
the backend.
2023-12-20 14:32:12 +13:00
Hans Goudey efbee2d606 Mesh: Rename totvert, totedge, and totloop fields
Use the standard "elements_num" naming, and use the "corner" name rather
than the old "loop" name: `verts_num`, `edges_num`, and `corners_num`.
This matches the existing `faces_num` field which was already renamed.

Pull Request: https://projects.blender.org/blender/blender/pulls/116350
2023-12-20 02:21:48 +01:00
Hans Goudey 01dbe11ea6 Cleanup: Grammar, redundant "private" in class 2023-12-19 19:58:53 -05:00
Harley Acheson 6007838bb2 UI: Set Initial Background Color Darker
With the popularity of dark themes, and the fact that our default theme
is dark, make the initial background color (before the program fully
loads) a darker shade of grey. {0.25f, 0.25f, 0.25f} versus current
{0.55f, 0.55f, 0.55f}. Also set Windows class background brush to the
same color to remove a potential flash.

Pull Request: https://projects.blender.org/blender/blender/pulls/115968
2023-12-20 01:36:11 +01:00
Harley Acheson 25c69d20b9 Fix #116196: Edge selection with hidden Asset Shelf
When the Asset shelf is active but hidden, the mouse cursor will give
feedback about a moveable edge above the asset shelf area. This just
alters `region_azone_edge_poll` to check for edges belonging to
regions that hide with a previous region that is now hidden.

Pull Request: https://projects.blender.org/blender/blender/pulls/116233
2023-12-20 01:21:18 +01:00
Harley Acheson 5741f7b8a9 Fix #114461: Check Interactivity in button comparisons
Implementation of Julian Eisel's idea of including interactivity in
button comparisons to avoid bad label matches.

Pull Request: https://projects.blender.org/blender/blender/pulls/116228
2023-12-20 01:14:10 +01:00
Campbell Barton c455f76267 Cleanup: remove redundant casts, use const casts 2023-12-20 10:11:01 +11:00
Germano Cavalcante 9fbc096522 Fix #116342: crash when moving GP3 keyframe
Caused by 7f626e08e1

It is necessary to use a safer way to identify whether `TransData2D`
points to an int value.
2023-12-19 17:19:05 -03:00
Richard Antalik c9fc69d10b Cleanup: Fix build warnings introduced in e02eeaf888 2023-12-19 19:54:21 +01:00
Hans Goudey d093c9075d Cleanup: Check for null before copying datablocks
Avoid relying on the null check inside of `BKE_id_copy_ex`,
which shouldn't really be there.
2023-12-19 13:31:43 -05:00
Hans Goudey 2da88752be Cleanup: Avoid uninitialized variable warning 2023-12-19 13:31:42 -05:00
Philipp Oeser 55963c2811 Fix #116346: USD importer ignores camera near clipping plane
Seems the actual change somehow got swallowed in 7a9284107d / !112905
[the corresponding clamping comment is already there :)].

Now just add back.

Thx @Matt-M for the initial investigation.

Pull Request: https://projects.blender.org/blender/blender/pulls/116353
2023-12-19 19:00:11 +01:00
Aras Pranckevicius a95dd8438d VSE: add option to display half of audio waveform
Default is "full" waveform display. Adds overlay option to display absolute
value of the signal as upper half only. Part of design task #115274

Pull Request: https://projects.blender.org/blender/blender/pulls/116344
2023-12-19 18:52:38 +01:00
Aras Pranckevicius 4805b4f13f VSE: more intuitive UI control for waveform display mode
Use a more consistent radio selection for waveform display, not an
enum-radio hybrid. Part of design task at #115274

Pull Request: https://projects.blender.org/blender/blender/pulls/116336
2023-12-19 18:49:28 +01:00
Damien Picard faefaa4447 I18n: extract and disambiguate a few messages
Extract:
- Compositor error messages.
- `bUnitDef`s were broken after cleanup commit 2b77cd726d. Since each
  unit's "display name" is now preceded by a consistent "name_display"
  comment, the regex which extracts the unit is greatly simplified.
  It now relies on the presence of the comment instead of the struct
  order.
- "Preset" menu and "Apply Preset" button from the curveprofile
  template.
- Operator labels from the catalog context menu.

Disambiguate:
- "Bake Data": can mean "Which data to bake" (verb), or "The data that
  were baked" (noun).
- "Cache" in the Simulation Nodes panel is a verb, not a noun.
- "Mix" in the snapping menu is a noun, not a verb.
- "Top" and "Bottom" can mean the upper part of an object or the
  highest point or element of something like a menu or list.

Pull Request: https://projects.blender.org/blender/blender/pulls/115963
2023-12-19 18:41:09 +01:00
Aras Pranckevicius 4ef5d9f60f ffmpeg: optimize ffmpeg_postprocess
After doing regular movie frame decoding, there's a "postprocess" step for
each incoming frame, that does deinterlacing if needed, then YUV->RGB
conversion, then vertical image flip and additional interlace filtering if
needed. While this postprocess step is not the "heavy" part of movie
playback, it still takes 2-3ms per each 1080p resolution input frame that
is being played.

This PR does two things:
- Similar to #116008, uses multi-threaded `sws_scale` to do YUV->RGB
  conversion.
- Reintroduces "do vertical flip while converting to RGB", where possible.
  That was removed in 2ed73fc97e due to issues on arm64 platform, and
  theory that negative strides passed to sws_scale is not an officially
  supported usage.

My take on the last point: negative strides to sws_scale is a fine and
supported usage, just ffmpeg had a bug specifically on arm64 where they
were accidentally not respected. They fixed that for ffmpeg 6.0, and
backported it to all versions back to 3.4.13 -- you would not backport
something to 10 releases unless that was an actual bug fix!

I have tested the glitch_480p.mp4 that was originally attached to the
bug report #94237 back then, and it works fine both on x64 (Windows)
and arm64 (Mac).

Timings, ffmpeg_postprocess cost for a single 1920x1080 resolution movie
strip inside VSE:
- Windows/VS2022 Ryzen 5950X: 3.04ms -> 1.18ms
- Mac/clang15 M1 Max: 1.10ms -> 0.71ms

Pull Request: https://projects.blender.org/blender/blender/pulls/116309
2023-12-19 18:28:51 +01:00
Miguel Pozo 0e3dbcfae0 Fix: EEVEE-Next: Volume closure evaluation
Uninitialized data and missing weights after d73050114b
2023-12-19 17:59:12 +01:00
Richard Antalik e02eeaf888 Fix #115305: Sound equalizer not applied when rendering
This was caused by 5c76c7bf84, which only updated sound when tagged by
`ID_RECALC_AUDIO`. On undo or rendering, this flag is missing.

Update equalizer when recalc is flagged by `ID_RECALC_COPY_ON_WRITE`.

Pull Request: https://projects.blender.org/blender/blender/pulls/116282
2023-12-19 17:38:29 +01:00
Miguel Pozo a2317726ca Fix: EEVEE-Next: World.has_volume()
Regression from #115284
2023-12-19 17:25:16 +01:00
Hans Goudey a0f8a6dae8 Fix #116351: Assert in sculpt mode with no faces 2023-12-19 10:56:30 -05:00
Miguel Pozo b6fab947d1 Fix #114168: EEVEE-Next: Viewport image render sampling
Support sample accumulation in viewport image rendering.

Pull Request: https://projects.blender.org/blender/blender/pulls/116198
2023-12-19 16:13:45 +01:00
Miguel Pozo b1e83f8323 Draw: Reuse GPUViewport when doing viewport render animations
Allows supporting motion blur for EEVEE-Next viewport render animations.
It should also provide a slight performance improvement.

Pull Request: https://projects.blender.org/blender/blender/pulls/116199
2023-12-19 16:12:30 +01:00
Philipp Oeser 17acedf965 Cleanup: correct outdated comment 2023-12-19 15:54:32 +01:00
Jacques Lucke 5d610ad43a Fix #116308: muted nodes don't do type conversion correctly
A similar issue was fixed in the commit below for inserting implicit
conversions for links, but it wasn't corrected for conversions in
muted nodes.

Caused by e1d0d70911
2023-12-19 15:50:10 +01:00
Philipp Oeser cc03661686 Cleanup: comment style 2023-12-19 15:47:18 +01:00
Philipp Oeser 85bf6814c7 Fix #116325: crash assigning non-valid `material.paint_active_slot`
Similar to 64e955f522 (but extended a bit).

Fix by preventing access of non-existent (or out of bounds)
`TexPaintSlot`.

In the future, we should probably even prevent it further by using
`RNA_def_property_int_funcs` (but that is for a later commit).

Pull Request: https://projects.blender.org/blender/blender/pulls/116345
2023-12-19 15:46:03 +01:00
Hans Goudey 7c69c8827b Mesh: Rename MLoopTri variable names, and functions
Make the naming consistent with the recent change from "loop" to
"corner". Avoid the need for a special type for these triangles by
conveying the semantics in the naming instead.

- `looptris` -> `corner_tris`
- `lt` -> `tri` (or `corner_tri` when there is less context)
- `looptri_index` -> `tri_index` (or `corner_tri_index`)
- `lt->tri[0]` -> `tri[0]`
- `Span<MLoopTri>` -> `Span<int3>`
- `looptri_faces` -> `tri_faces` (or `corner_tri_faces`)

If we followed the naming pattern of "corner_verts" and "edge_verts"
exactly, we'd probably use "tri_corners" instead. But that sounds much
worse and less intuitive to me.

I've found that by using standard vector types for this sort of data,
the commonalities with other areas become much clearer, and code ends
up being naturally more data oriented. Besides that, the consistency
is nice, and we get to mostly remove use of `DNA_meshdata_types.h`.

Pull Request: https://projects.blender.org/blender/blender/pulls/116238
2023-12-19 14:57:49 +01:00
Jeroen Bakker 3f33b06dde Fix #116229: Fix EEVEE GLitches on Legacy AMD Platforms
According to the issue not all legacy AMD platforms that required the
high quality normals workaround where enabled. I have not been able to
reproduce the issue due hardware availability.

This PR will enable the workaround for all HD ATI GPUs.

Pull Request: https://projects.blender.org/blender/blender/pulls/116340
2023-12-19 14:35:28 +01:00
Julian Plak b85011aee0 Geometry Nodes: initial display of attribute values as text in 3d viewport
Previously, attribute values were only visualized as color overlay in the 3d viewport.
Now it's possible to optionally show the attribute values as text. This can be enabled
in the `Viewer Node` overlay settings in the 3d view.

This is just the first initial version. More work towards making it look better
will be done next.

Pull Request: https://projects.blender.org/blender/blender/pulls/115664
2023-12-19 13:30:16 +01:00
Jacques Lucke e0aa05996f Fix: normalize option not shown in noise texture node
Caused by f7e8021b2a.
2023-12-19 12:56:37 +01:00
Philipp Oeser 820a0f7240 Fix #116239: Propagate to Shapes overwrites all vertices with mirroring
Since 4d0dbab5b1, `EDBM_verts_mirror_cache` is used to find mirror
verts (but this was initialized with `use_select` being `true`, so the
cache was only set up for selected verts). `EDBM_verts_mirror_get`
behaves in a way that if you then query a vert that does not have a true
mirror, it would always return the vert with index zero in this case (so
basically would look like the index zero vert is the mirror for verts
not covered in the cache). Now if that zero index vert happened to be
selected, verts would not be skipped and the whole mesh would be
overwritten.

To solve this, we need to initialize the `EDBM_verts_mirror_cache` with
`use_select` being `false` -- this way all verts are covered and we
always get back the true mirror (checking selection on that one is fine
then and everything behaves as expected).

Pull Request: https://projects.blender.org/blender/blender/pulls/116329
2023-12-19 12:34:56 +01:00
Clément Foucault 5e5345cd2c Fix: EEVEE-Next: Subsurface artifact on M1
This is caused by the local cache optimization.
Disabling it for now on this platform.
2023-12-19 23:42:35 +13:00
Clément Foucault 07be933218 Fix: EEVEE-Next: Undefined behavior on gbuffer load
This caused issue in the SSS setup and could
have caused other issues.
2023-12-19 23:42:35 +13:00
Clément Foucault 6f50e71029 Fix: EEVEE-Next: Workaround Load/Store broken on M1
Load/store action is broken on Metal.
2023-12-19 23:42:35 +13:00
Clément Foucault d73050114b EEVEE-Next: Volume: Combine the volume closure nodes
instead of randomly choosing one.
This avoid noise when mixing them.
2023-12-19 23:42:35 +13:00
Sybren A. Stüvel a3160393ee Anim: clarify description of `armature.bone_collection_unassign_named`
The 'named' is about the name of the bone that's being unassigned. This
was already clear from the parameters, and it's now mentioned in its
description too.

No functional changes.
2023-12-19 10:41:57 +01:00
Sybren A. Stüvel a04bbc8a1f Anim: better check for overrides when (un)assigning bone collections
When (un)assigning bone collections, don't just check that the armature is
linked, but also check for the existence of a library override.
2023-12-19 10:41:57 +01:00
Sybren A. Stüvel b70ebf96e7 Anim: bone collections, split `ARMATURE_OT_collection_assign` in two
Split the `armature.collection_assign` operator in two. Before, the
operator could do two things: assign selected bones to the active/named
bone collection, or create a new bone collection with the given name.

This is now split up, where `armature.collection_assign` only assigns to
existing bone collections, and `armature.collection_create_and_assign`
always creates a new bone collection.

This makes the purpose of each operator clearer & more predictable.
2023-12-19 10:41:57 +01:00
Campbell Barton 0ec50b56ad Extensions: add option to enable/disable an extensions repo
Note that this option isn't used from Blender, it's up to
scripts that use extensions repositories to respect the setting.
2023-12-19 18:11:17 +11:00
Campbell Barton dfce570198 Cleanup: move extensions flag to DNA_userdef_types.h, rename flag 2023-12-19 18:11:15 +11:00
Campbell Barton 69d22a42d0 Fix #116297: Context override error passing in a window without a screen
When overriding the contexts window but not the screen, the context
override would attempt to use the current screen with the new window.

This raised an error and could crash when editing properties in the
key-map editor for the "context toggle" operator.
2023-12-19 11:09:28 +11:00
Campbell Barton 9f05144fc9 Cleanup: specify defines for enum values stored in blend-files 2023-12-19 10:19:20 +11:00
Campbell Barton 7949b68e5e Cleanup: remove unused include 2023-12-19 10:17:50 +11:00
Campbell Barton 866d092994 Cleanup: use doxygen comments for usd.h
Avoid awkwardly wrapped multi-line trailing comment.
2023-12-19 10:17:48 +11:00
Campbell Barton 482ba7806d Cleanup: spelling correction: "adjacent" & spelling in comments 2023-12-19 09:54:53 +11:00
Jacques Lucke e51126500e Fix: compile error in debug build
Caused by 8bf73a7a97
2023-12-18 22:46:18 +01:00
Hans Goudey 4ee151e204 Cleanup: Remove unnecessary function and data in PBVH 2023-12-18 15:36:55 -05:00
Hans Goudey 8bf73a7a97 Cleanup: Tweak PBVH grid faces update retrieval
The function really just gives an index mask of all the faces in the
provided nodes. The multires usage of the function didn't need that,
since it just passed all nodes. Also pass the SubdivCCG directly rather
than the PBVH. And rename the function to make this clearer.
2023-12-18 15:29:17 -05:00
Miguel Pozo 25102af766 Fix: EEVEE-Next: Metal shader compilation
Pull Request: https://projects.blender.org/blender/blender/pulls/116310
2023-12-18 20:50:31 +01:00
Iliya Katueshenock c106066900 Geometry Nodes: Improve Shortest Edge Paths node performance
Speedup of node Shortest Edge Paths node by creating an array for
other_edge_vert's and computing them in parallel separate loop.
This also provides better CPU cache by avoiding reading edges in main
loop to find other vertex (which happen multiple time for each vertex).

For cuboid with `700`x`700`x`700` points and `0.066667%` random
selection of `Edge Vertex` this will change `1012.4 ms` -> `618.9 ms`
the in `shortest_paths` function.

Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/114707
2023-12-18 20:32:14 +01:00
Miguel Pozo 89ec7f5360 Fix #116031: EEVEE-Next: Nishita sky does not work
Add missing sky texture binding to the new draw manager.
2023-12-18 19:36:44 +01:00
Pratik Borhade 592c884e52 Fix #116270: Sculpt: Simplify brush crash
Crash is due to garbage value stored in `vd->cd_vert_mask_offset`
This is because `BKE_pbvh_vertex_iter_begin` is removed so `vd` became
unused/unassigned.

Pull Request: https://projects.blender.org/blender/blender/pulls/116291
2023-12-18 16:33:30 +01:00
Miguel Pozo 97785b6fbb EEVEE-Next: Irradiance Grid smooth transitions
Smooth the transition at grid bounds.

The transition size is fixed at 1 grid cell,
but it may be useful to expose a user setting for controlling this.

Pull Request: https://projects.blender.org/blender/blender/pulls/112842
2023-12-18 16:25:20 +01:00
Hans Goudey 5de57e7001 Refactor: Move evaluate on domain field input to be reusable
This is used in #116066 to find the curve selection on the point
domain without having a user-visible difference in behavior.
2023-12-18 10:06:38 -05:00
Hans Goudey 0ceb272832 Curves: Support View Selected in edit mode
The operator was working in sculpt mode but not object mode. Avoid the
"transverts" abstraction for this since we already have the necessary
positions array and selection readily accessible.
2023-12-18 08:46:25 -05:00
Germano Cavalcante 0b00b360f7 Fix #116058: 'Align Rotation to Target' does not consider object orientation
Correction of 3612e0ef04.

`ElementRotation_ex` only works with matrix in global space.
Therefore convert the vectors to global space.
2023-12-18 10:27:18 -03:00
Philipp Oeser f2cd1873ea Fix #116275: Snap (align to target) crash without valid target location
Caused by 9c2e768f5b

Since above commit, drawing of the normal is not done in
`ED_view3d_cursor_snap_draw_util` anymore [that function checked the
existence of a valid target location], now add the check back.

Pull Request: https://projects.blender.org/blender/blender/pulls/116292
2023-12-18 14:18:39 +01:00
Jeroen Bakker e1cec452da Lookdev: Use Mid Grey for Diffuse HDRI Sphere
When the lookdev balls where initially added we didn't had the
experience community compared to now and reused a value we
used for our default materials.

Nowadays we have actually industry experts asking to use a mid grey
albedo of 18% as that is widely used in the vfx studios. This PR
changes the default diffuse HDRI sphere to be 50% grey.

For references see:
- https://en.wikipedia.org/wiki/Middle_gray

![image](/attachments/f7dc5943-84e9-4aa0-900c-8eb9ddf1f557)

Pull Request: https://projects.blender.org/blender/blender/pulls/116175
2023-12-18 13:43:43 +01:00
Jacques Lucke 00eaddbd51 Geometry Nodes: new Bake node
This adds a new `Bake` node which allows saving and loading intermediate geometries.
Typical use cases we want address with this currently are:
* Bake some data for use with a render engine.
* Bake parts of the node tree explicitly for better performance.

For now, the format that is written to disk is not considered to be an import/export format.
It's not guaranteed that data written with one Blender version can be read by another
Blender version. For that it's better to use proper interchange formats. Better support for
those will be added eventually as well. We also plan an `Import Bake` node that allows
reading the blender-specific baked data independent of the Bake node and at different frames.

The baking works very similar to the baking in the simulation zone (UI and implementation
wise). Major differences are:
* The Bake node has a `Bake Still` and `Bake Animation` mode.
* The Bake node doesn't do automatic caching.

Implementation details:
* Refactored how we create the Python operators for moving socket items so that it also
  makes sense for non-zones.
* The `ModifierCache` stores an independent map of `SimulationNodeCache` and
  `BakeNodeCache`, but both share a common data structure for the actually baked data.
* For baking, the `Bake` node is added as a side-effect-node in the modifier. This will make
  sure that the node is baked even if it's currently not connected to the output.
* Had to add a new `DEG_id_tag_update_for_side_effect_request` function that is used
  during baking. It's necessary because I want to evaluate the object again even though none
  of its inputs changed. The reevaluation is necessary to create the baked data. Using
  `DEG_id_tag_update` technically works as well, but has the problem that it also uses the
  `DEG_UPDATE_SOURCE_USER_EDIT` flag which (rightly) invalidates simulation caches
  which shouldn't happen here.
* Slightly refactored the timeline drawing so that it can also show the baked ranges of
  Bake nodes. It does not show anything for baked nodes with a in Still mode though.
* The bake operator is refactored to bake a list of `NodeBakeRequest` which makes the
  code easier to follow compared to the previous nested
  `ObjectBakeData > ModifierBakeData > NodeBakeData` data structure.
* The bake operators are disabled when the .blend file is not yet saved. This is technically
  only necessary when the bake path depends on the .blend file path but seems ok to force
  the user anyway (otherwise the bake path may be lost as well if it's set explicitly).
* The same operators are used to bake and delete single bakes in `Bake` nodes and
  `Simulation Zones`. On top of that, there are separate operators of baking and deleting all
  simulation bakes (those ignore bake nodes).
* The `Bake` node remembers which inputs have been fields and thus may be baked as attributes.
  For that it uses an `Is Attribute` flag on the socket item. This is needed because the baked data
  may still contain attribute data, even if the inputs to the bake node are disconnected.
* Similar to simulation zones, the behavior of `Bake` nodes is passed into the geometry nodes
  evaluation from the outside (from the modifier only currently). This is done by providing the
  new `GeoNodesBakeParams` in `GeoNodesCallData` when executing geometry nodes.

Next Steps (mostly because they also involve simulations):
* Visualize nodes that have not been evaluated in the last evaluation.
* Fix issue with seemingly loosing baked data after undo.
* Improve error handling when baked data is not found.
* Show bake node in link drag search.
* Higher level tools for managing bakes.

Pull Request: https://projects.blender.org/blender/blender/pulls/115466
2023-12-18 13:01:06 +01:00
Jacques Lucke 2189a34312 Fix: crash when there is no tree logger in geometry nodes 2023-12-18 12:19:13 +01:00
Hoshinova f7e8021b2a Fix #116256: Unintentional override of node type property in API
Rename new noise node type to avoid conflict with node type.

Pull Request: https://projects.blender.org/blender/blender/pulls/116278
2023-12-18 10:35:20 +01:00
Casey Bianco-Davis 1a92fbf31a GPv3: Drawing color conversion
Correctly convert brush color to stroke color when drawing.

Pull Request: https://projects.blender.org/blender/blender/pulls/116236
2023-12-18 10:33:37 +01:00
Campbell Barton 62e1059960 Cleanup: variable naming, reduce variable scope 2023-12-18 12:26:39 +11:00
Campbell Barton 8275232614 Cleanup: remove redundant path join for recursive operations on Haiku 2023-12-18 12:09:20 +11:00
Campbell Barton 27fdda2f85 Fix use after free error on abort()
When aborting, the Global shared pointer for memory usage tracking
would be freed before Blender's temporary directory was purged.

Removing the temporary directory would then use MEM_* functions which
accessed the freed memory usage class.

Resolve by using malloc/free for the internal recursive_operation(..)
utility function.

Remove strip_last_slash utility function as it's a specific operation
which can be written in 2 lines & was only used once after this change.
2023-12-18 12:09:19 +11:00
Brecht Van Lommel eaede06456 Fix: crash with sequencer scene strips after previous refactor 2023-12-17 21:07:33 +01:00
Richard Antalik 3d03dbfa4c Cleanup: VSE strips update callback
Split the code, use preconditions, use rather plain language for
function names and add comments where it is not totally obvious, what
the code is supposed to do.
2023-12-17 18:36:54 +01:00
Brecht Van Lommel 84591ac1a7 Cleanup: make format 2023-12-17 16:18:21 +01:00
Jacques Lucke e1d0d70911 Geometry Nodes: refactor storage for socket values
This refactors `SocketValueVariant` with the following goals in mind:
* Support type erasure so that not all users of `SocketValueVariant` have
  to know about all the types sockets can have.
* Move towards supporting "rainbow sockets" which are sockets whoose
  type is only known at run-time.
* Reduce complexity when dealing with socket values in general. Previously,
  one had to use `SocketValueVariantCPPType` a lot to manage uninitialized
  memory. This is better abstracted away now.

One related change that I had to do that I didn't see coming at first was that
I had to refactor `set_default_remaining_outputs` because now the default value
of a `SocketValueVariant` would not contain any value. Previously, it was
initialized the zero-value of the template parameter. Similarly, I had to change
how implicit conversions are created, because comparing the `CPPType` of linked
sockets was not enough anymore to determine if a conversion is necessary.

We could potentially use `SocketValueVariant` for the remaining socket types in the
future as well. Not entirely sure if that helps yet. `SocketValueVariant` can easily be
adapted to make that work though. That would also justify the name
"SocketValueVariant" better.

Pull Request: https://projects.blender.org/blender/blender/pulls/116231
2023-12-17 14:00:07 +01:00
Habib Gahbiche 80ab3338df Compositor: Unify relative translate behavior with realtime compositor
"Relative" in translation means relative to input size and not render size, as described in the user manual.

Pull Request: https://projects.blender.org/blender/blender/pulls/115947
2023-12-17 12:52:00 +01:00
Campbell Barton d2ba632b89 Cleanup: odd line wrapping for doc-string
Caused by C++ migration.
2023-12-17 20:26:33 +11:00
Campbell Barton 950334a02c Cleanup: remove duplicate null check in blf_search_by_mem_name 2023-12-17 16:43:18 +11:00
Campbell Barton 4d965615fc Cleanup: various C++ changes (use ELEM & string copy macros) 2023-12-17 16:25:10 +11:00
Campbell Barton 2b3c379850 Cleanup: use boolean & nullptr literals 2023-12-17 16:04:44 +11:00
Campbell Barton 240b159918 Cleanup: remove unused defines 2023-12-17 16:04:42 +11:00
Campbell Barton 53a51d2148 Cleanup: use color after doxygen parameters 2023-12-17 16:04:40 +11:00
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