Compositor: Make Hue Correct node wrap
This patch makes the Hue Correct node as well as the Hue Correct VSE
modifiers to wrap, such that no discontinuities occur for the red hue.
Since it now wraps, the default curve preset now exempts the last point
of the curve.
A new CUMA_USE_WRAPPING flag was added to specify wrapping for curve
maps. The implementation works by adding two virtual points before and
after the terminal points in the curve map, such that their handles
match, and would then produce a continues curve.
This is a breaking change, since existing curves were also adjusted
using versioning. However, the change will not be significant, since in
most realistic cases, the terminal points will be close to each other,
and even with wrapping, the connection will be very sharp, almost
matching the old behavior.
Pull Request: https://projects.blender.org/blender/blender/pulls/117114
This patch adds clamped boundaries variants of the nearest interpolation
functions in the BLI module. The naming convention used by the bilinear
functions were followed.
Needed by #119414.
Pull Request: https://projects.blender.org/blender/blender/pulls/119732
Even though there is a dialog users must accept when removing a
repository & directory being removed is shown, it's possible users
assume this only removes files which are part of the repository after
pointing the custom-directory to their home directory or similar.
Removing repositories which point to a custom-directory now only
remove packages and server meta-data to prevent accidents.
Resolves#119481.
When the edit mesh modifier stack first deforms the original edit mesh,
it creates deformed positions in a separate array. That array is copied
to the mesh's vertex positions if a subsequent modifier requires an
actual mesh rather than a mesh wrapper.
However, if that last deform modifier is the last "on cage" modifier
and the next modifier requires a real Mesh, we hit a code path that
didn't copy the temporary position array, since it was contained in the
separate `EditMeshData` struct that must be handled manually.
This was a regression in 91b27ab637. In the future I hope to
make this simpler by expanding the use of implicit sharing and making
the conversion from original BMesh to a Mesh more lazy / const correct.
Pull Request: https://projects.blender.org/blender/blender/pulls/119718
Those shouldn't really exist at all currently, since we forbid them in 354915cf3c.
Unfortunately, not all cases were removed, and many node trees with such sockets
have been created during the development of 4.1 due to the auto-smooth changes.
I'm not entirely sure if it's still possible to properly remove them now. The commit
above mentions that we might lose links due to changed identifiers. Maybe we're
better off just supporting these inlined sockets while also allowing the "align with
previous socket" functionality.
Either way, not creating more of such node trees for now is reasonable, since we
explicitly disabled that functionality for now.
Pull Request: https://projects.blender.org/blender/blender/pulls/119654
- Prefix comments before members is used practically everywhere,
remove C99 syntax from inside comments.
- Replace double quotes with backticks for code styling.
This uses Spherical Harmonics to store the indirect lighting and
distant lighting visibility.
We can then reuse this information for each closure which divide
the cost of it by 2 or 3 in many cases, doing the scanning once.
The storage cost is higher than previous method, so we split the
resolution scaling to be independant of raytracing.
The spatial filtering has been split to its own pass for performance
reason. Upsampling now only uses 4 bilinearly interpolated samples
(instead of 9) using bilateral weights to avoid bleeding.
This also add a missing dot product (which soften the lighting
around corners) and fixes the blocky artifacts seen at lower
resolution.
Pull Request: https://projects.blender.org/blender/blender/pulls/118924
For historical reasons, the `multi_input_socket_index` was actually reversed
(large index comes first). This patch renames it to `multi_input_sort_id` and
adds a comment. This new name makes it less confusing that the id is reversed.
Pull Request: https://projects.blender.org/blender/blender/pulls/119652
It seems that the compiler on windows struggled to
correctly assign the namespace of the `LocalMemArena`
destructor because the struct was defined locally
in a lambda.
This moves the struct definition out of the lambda.
Fix a crash when inserting a key with tweak mode enabled, but where
`AnimData::actstrip` was NULL.
The root cause of this is that two pointers in the `AnimData` struct
(`act_track` and `actstrip`) are expected to be set when NLA tweak mode
is enabled, BUT these are not exposed to RNA and thus invisible to the
library overrides system. As such, they are NULL when loading from disk,
while the `ADT_NLA_EDIT_ON` flag still indicates they are to be used.
Rather than adding a NULL pointer check (and having to add that in many
more places), I used this two-pronged approach:
- Extend the 'NLA tweakmode' override apply code, to set the `act_track`
and `actstrip` pointers when they are incorrectly NULL. This is done
by lookup of the track and strip by name.
- Add versioning code to exit out of tweak mode whenever the
`ADT_NLA_EDIT_ON` flag is set, but those two pointers are still NULL.
The last step was necessary with the example file attached to the bug
report, as that was saved with a buggy blender version. New saves work
just fine.
Pull Request: https://projects.blender.org/blender/blender/pulls/119632
This became a bottleneck in one of the test files during playback.
A grease pencil object was using an array modifier which tags the triangle
caches to be invalidated. Then it re computed the fills on every frame, which
was slow (when single threaded).
With this patch, the playback went from ~43fps to 60+fps.
Pull Request: https://projects.blender.org/blender/blender/pulls/119531
If the bevel "Harden Normals" option is on, custom normals will be
generated. In that case, the automatic sharp edge tagging based on the
angle shouldn't run. This PR extends the earlier fix to #116395 to
handle this case and also extends the check to not just check the last
modifier, which doesn't work in this test file which has a collision
modifier at the end. That makes sense anyway, since what we really care
about is whether the evaluated mesh has custom normals or not.
Pull Request: https://projects.blender.org/blender/blender/pulls/119638
This PR fixes several issues with the versioning that replaces the old
auto smooth flag with a modifier.
One issue is that the flag wasn't cleared in the initial versioning
code. That means some objects have the replacement modifier but their
meshes still have the flag set. The fix for that is to make the
versioning idempotent by trying to find an existing node group before
adding a new one. The versioning is now re-run on all objects to clear
the flags. Flags on all meshes are cleared too, even unused meshes.
That could cause loss of the auto-smooth when the mesh is linked from
a different blend-file, but that situation should be very rare.
Another issue was that the versioning wasn't run when linking objects.
That was simple to solve by adding the versioning where the proxy
versioning already existed for that case.
Finally, arguably the largest issue was that the the newly added node
groups were always added as local data-blocks. When linking, having
library data-blocks point to local data-blocks not in that library is
quite bad and breaks assumptions around Blender. This is solved by
having an auto smooth node group per library.
Resolves#119516, #119455, #119447
Pull Request: https://projects.blender.org/blender/blender/pulls/119539
If a bone was specified (but now missing), the driver would fallback to
using the object as a target (which can lead to unintended behavior).
So now check if a bone is specified, if it is missing, mark the driver
invalid. If no bone is specified at all, then use the armature object as
the target.
NOTE: `DTAR_FLAG_INVALID` is not granular enough to distinguish the
object and bone targets, so both will be marked in red in the UI (there
is already comments about it in code). If necessary, we could introduce
an additional DTAR_FLAG_BONE_INVALID and use that in a couple of places.
Pull Request: https://projects.blender.org/blender/blender/pulls/119533
This reverts commit c6497dd9f7.
This wasn't working the way I expected, it seems the LIB_TAG_NEW isn't
set here. Better to address the fundamental issues anyway. Sorry for
the noise.
When appending objects from an older file, versioning needs to run to add
an auto smooth modifier if necessary. However, this was running for all
objects rather than just the newly appended objects. It's quite wrong to
modify existing objects here, so add an explicit check for that. This could
improve performance as well, but skipping checks for objects when
the work is unnecessary.
The crash will hopefully be resolved by other improvements to the auto
smooth versioning (making it properly idempotent and running it again
should fix the problem with the hidden legacy flags still set). But I still think
this PR is worth committing, to be very explicit about only modifying new
objects in versioning code.
Pull Request: https://projects.blender.org/blender/blender/pulls/119467
Previously I misunderstood the subsurf modifier's handling of custom
normals. The "use custom normals" check in 4.0 checked if there were
custom normals and whether the auto smooth flag was checked. I wrongly
changed that to check the mesh normals domain instead of whether there
was custom normals. In 4.1, auto smooth isn't required to use custom
normals, but that should be the only change here.
In this PR, that change is done for CPU and GPU subdivision, and for
the versioning which adds a modifier. The versioning now only puts the
new modifier before the subsurf modifier if it would have used the
custom normals interpolation in 4.0.
The last change causes two test failures which I also misunderstood
before. The previous results were arguably incorrect, because the
Cycles experimental adaptive subdivision ignored the auto smooth
angle, which was 5 degrees. It should have been 180 degrees.
I will modify those test files to remove auto smooth from the meshes.
Pull Request: https://projects.blender.org/blender/blender/pulls/119485
This adds conversion for the following flags:
- `GREASE_PENCIL_ANIM_CHANNEL_EXPANDED`
- `GREASE_PENCIL_AUTOLOCK_LAYERS`
- `GREASE_PENCIL_STROKE_ORDER_3D`
Note: The last two are not expose through the UI yet.
This fixes an issue where the `use_masks` functions on layers
and groups returned the wrong value.
The issue was that the root group doesn't have this flag set
which then propagates to all the layers and groups.
To fix this we invert the `GP_LAYER_TREE_NODE_USE_MASKS` flag (now called `GP_LAYER_TREE_NODE_HIDE_MASKS`).
The API still uses the `use_masks` function.
Layer masks were partly already there. This PR completes the implementation and expose them through the UI.
This also adds three operators to:
- add a layer mask
- remove a layer mask
- reorder layer masks
Note: These are not used by the renderer yet. Will be done in a following PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/119433
This adds the `viewlayername` property to grease pencil v3 layers.
It's exposed as `viewlayer_render` in python.
Note: this is not used in the renderer yet. Will be used in a following PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/119422
- Remove the unnecessary `ContainerValue` from the class hierarchy
- Construct `StringValue` with a `std::string` by value to avoid copies
- Remove some indirection by using type names directly instead of aliases
- Use utility methods to lookup/append specific data types for arrays/dicts
- Simplify conversion from unique_ptr to shared_ptr
- Avoid use of `new` and `delete`
- Avoid creating maps of all elements in vector for a single lookup
The Weighted Normal modifier has a "Keep Sharp" option that used to
recalculate the sharp edge tags based on the mesh's smoothing angle.
To keep the same behavior, an auto smooth versioning modifier has to
be added before that modifier when the option is on.
Pull Request: https://projects.blender.org/blender/blender/pulls/119400
Unfortunately the only versioning code that can "properly" add data-
blocks is not run when linking or appending (`do_versions_after_setup`
has details). The versioning has to be done manually for this case.
Fortunately that is simple since the versioning function already just
operators on a main database.
With some data-type conversions we can do a best-effort conversion of
UI data like default values and min and max to the new data type.
This can help to make Python scripts simpler and to avoid bugs like
#105965.
Pull Request: https://projects.blender.org/blender/blender/pulls/106161
The core of the issue was that `sculpt_flag` was used by three different enums (`eGP_Sculpt_Flag`, `eGP_Sculpt_Mode_Flag`, and `eBrushFlags`). This resulted in the flag getting overriden because `ENUM_OPERATORS` expected the maximum value of `eGP_Sculpt_Flag` to be `(1 << 3)` which it wasn't.
The `sculpt_flag` was exposed through python as `"direction"`.
In the UI this meant that it was effectively used as `brush.direction`. This fix replaces `brush.gpencil_settings.direction` with `brush.direction`.
It also makes sure `sculpt_flag` is only ever used with values from `eGP_Sculpt_Flag`.
Pull Request: https://projects.blender.org/blender/blender/pulls/119373
The function didn't return early in case the domain was empty.
The fix makes sure we return an empty `MutableSpan` in this case
(add doesn't try to create a new custom data layer).
Grease Pencil provides custom vertex group attributes as VArrays that
are a view on the `MDeformVert` buffer. These attributes are not spans,
which the curve conversion code was expecting. Non-span VArrays must be
materialized first.
Pull Request: https://projects.blender.org/blender/blender/pulls/119212
There seems to be an integer overflow in OpenVDB code. For now just avoid rendering
the volume when the indices are very large, which is an extreme case anyway.
Pull Request: https://projects.blender.org/blender/blender/pulls/119279
Header file is renamed to GEO_mesh_boolean_convert.cc and
files that included it are updated to use that path.
This is in preparation for bigger changes to the internal
boolean API, which make more sense as a "geometry" API
than a kernel API.
Pull Request: https://projects.blender.org/blender/blender/pulls/119336
The issue was that calling `ensure_geometry_instances` converts all instances to a
geometry, even the ones that can't be converted. The comment already says that
non-geometry instances should stay intact, but that didn't work correctly yet:
```
/**
* If references have a collection or object type, convert them into geometry instances
* recursively. After that, the geometry sets can be edited. There may still be instances of
* other types of they can't be converted to geometry sets.
*/
```
Pull Request: https://projects.blender.org/blender/blender/pulls/119324
Moving a set of keyframes could cause crashes by setting invalid
`drawing_index` in `GreasePencilFrame` data.
The transform operator for grease pencil keyframes can add and remove
keyframes by overwriting existing frames. The `move_duplicate_frames`
function in particular has to keep track of drawing user counts to
ensure that the drawings referenced by the frames are still alive at the
end.
This was broken when moving multiple keyframes at once, such that later
keyframes would overwrite the target positions for earlier frames (for
example moving frames [1,2,3] to [2,3,4]). The `move_duplicate_frames`
was first removing the source frame and then adding it back at the
destination. In case the source frame was already the destination of an
earlier keyframe, this will cause incorrect user count because the frame
being removed is not the same as the one being added back.
To avoid this problem, remove all the source keyframes first before any
other modification of the destination layer. That way we can be sure the
frames at the source index is actually the expected frame.
Pull Request: https://projects.blender.org/blender/blender/pulls/119207
Fixes vertex group data loss after the `Draw Tool`, `Delete`, `Dissolve` operators.
Note: This is not a exhaustive list and there are other operators that will still loss vertex group data.
Pull Request: https://projects.blender.org/blender/blender/pulls/119034
Add two snapping increment options: a regular value
(activated with Ctrl) and a precise value (activated with Ctrl+Shift).
These values are separate for 2D and 3D views.
Ref !118760
"r_map" is null for the generate layers operator (rather than the modifier
evaluation). It should disable the creation of the "CD_NORMAL" layer too,
like the crease, bevel weight, sharp edge, and uv seam attributes above.
As mentioned in new code comments, the auto smooth behavior in 4.0 was
to skip sharp angle tagging when the evaluated mesh had custom normals.
There was already a check for custom normals on the original mesh (we
can't access the evaluated mesh from versioning code). But that didn't
handle cases where custom normals were created by modifiers (the normal
edit and weighted normal modifiers). Now skip adding the new modifier
when those modifiers come last in the stack. Alternatively we could
check if they existed in the stack at all, but that seems a bit more
risky.
When linking a collection from library, it can be linked inside another
linked/overrided collection if it is selected in outliner. This can be
prevented by linking with editable parent collection.
Pull Request: https://projects.blender.org/blender/blender/pulls/119144
Add support for add-ons to define commands using the new argument
`-c` or `--command`.
Commands behave as follows:
- Passing in a command enables background mode without the need to pass
in `--background`.
- All arguments following the command are passed to the command
(without the need to use the `--` argument).
- Add-ons can define their own commands via
`bpy.utils.register_cli_command` (see examples in API docs).
- Passing in `--command help` lists all available commands.
Ref !119115
"Own" (the adjective) cannot be used on its own. It should be combined
with something like "its own", "our own", "her own", or "the object's own".
It also isn't used separately to mean something like "separate".
Also, "its own" is correct instead of "it's own" which is a misues of the verb.
Did not realize it, but original commit was re-generating some 'static'
strings (at modifier level) for each and every processed FCurves!
Now create these base RNA paths only once per modifier, outside of the
lambda callback.
Introduce new DNA for the `Animation` data-block and its sub-data.
This includes the blenkernel code for reading & writing to blend files,
and for memory management (freeing, duplicating). Minimal C++ wrappers
are included, with just the functionality needed for blenkernel to do
its job.
The Outliner code is extended so that it knows about the new data-type,
nothing more.
For more info, see issue #113594.
Pull Request: https://projects.blender.org/blender/blender/pulls/119077
Caused by 9c1da81a4c.
This happened in the case where objects shared the same data and slots
are assigned to object and receiving object did not have a material slot
yet.
Then, `ob->matbits` may be NULL, now just check for this, too.
Pull Request: https://projects.blender.org/blender/blender/pulls/119161
These containers (Set, Vector, Map, Span), etc. have default constructors,
making the braces unnecessary for default initialization. Better to depend
on that consistently rather than having braces in some places and not others.
This replaces the somewhat hackish and usafe code used previously.
Also fixes a potential bug, where the newly created `local_id` was
dereferenced before checking for it to be non-null.
Pull Request: https://projects.blender.org/blender/blender/pulls/108328
Seems to work OK in basic cases, but needs more work when copying
outside of Main at least.
Note: There is no behavioral changes expected from this commit.
Note that there are at least two known usecases for this change:
* Liboverrides, as with recursive resync and proxies conversion it
often ends up creating 'virtual' linked data that does not actually
exists in the library blend files.
* Complex versionning code (`do_versions_after_setup`) when it needs
to create new IDs (currently handling linked data that way is just not
supported!).
Implements #107847.
For example, creating the "position" attribute with the wrong name or type
could crash Blender when exiting edit mode. This is because some data isn't
stored as attributes in Blender, and the attribute API doesn't work very well
with BMesh.
Two parts to the solution:
- Remove builtin attributes with incorrect domains or names when
converting from BMesh to Mesh.
- Add error messages when creating builtin attributes in edit mode. It's still
possible to create name-convention attributes, because Blender should be
able to handle different types and domains for them.
Pull Request: https://projects.blender.org/blender/blender/pulls/119110
The copy constructor of the Layer class didn't do a copy
of the frames storage (DNA) and only a copy of the frames map (runtime).
This is fine, but we need to make sure to tag the frames storage,
because it is out of sync otherwise.
During edit mode undo, the layers were copied (but the frames storage not tagged) which meant that after undoing and then saving the file,
the frames would be gone after reloading.
The fix makes sure we tag the frames storage, so that it is properly synced.
The "capture field on geometry" utility is used in many places to store
the result of field evaluation as an attribute. There is a special case
for when an attribute already exists with the same name, data type, and
domain. But when exactly the same attribute was stored, it would assert
because it ended up copying an array to itself. Arguments for those copy
functions aren't supposed to alias each other.
As a fix, clarify the logic a bit to return earlier in this case.
Also remove a redundant case handling the same thing later on
in the function.
Pull Request: https://projects.blender.org/blender/blender/pulls/119063
This allows deleting a bunch of duplicate code, since there doesn't
need to be a special single-threaded case anymore. It also just
reduces the necessary boilerplate.
Also change naming a bit and use signed integers instead of unsigned.
I didn't notice any performance difference.
Pull Request: https://projects.blender.org/blender/blender/pulls/119069
Split `BKE_fcurve_blend_write(writer, listbase)` into two functions:
- `BKE_fcurve_blend_write_data(writer, fcurve)` for the data of a single
F-Curve, and
- `BKE_fcurve_blend_write_listbase(writer, listbase)` for writing a list
of F-Curves.
And the same for `BKE_fcurve_blend_read_data()`.
This is necessary for the upcoming Animation data-block, which will
store F-Curves as arrays instead of `ListBase`s.
No functional changes.
- Pass null instead of an empty string to BKE_tempdir_init
because the string isn't meant to be used.
- Never pass null to BLI_temp_directory_path_copy_if_valid
(the caller must check).
- Additional comments for which checks are performed & why
from discussion about #95411.
It's possible that multiple custom data layers share the same underlying data.
This data is only written once (per data-block) currently. However, when reading
the data again, two separate `ImplicitSharingInfo` were constructed which
referenced the same underlying memory. The fix is to reuse previously created
`ImplicitSharingInfo` that manage the same data.
Pull Request: https://projects.blender.org/blender/blender/pulls/118991
Second issue reported in the comment was caused by some shapekeys
flagged as embedded liboverride data, when their owner ID (Mesh e.g.)
is not a liboverride at all.
The `BKE_lib_override_library_validate` called on file read was only
covering real liboverride IDs, which where then supposed to take care of
their own embedded data. But since the owner ID is already a full
non-override ID, its embedded data ended up never being properly
sanitized.
Most likely more corruption data from quite old files and/or deprecated
experimental features.
No functional changes.
This PR replaces the uses of the C-style `BLI_BITMAP`
with `blender::BitVector` in `keyframing.cc`.
Note that in `BKE_animsys_nla_remap_keyframe_values` I had to
add code that maps from one to the other because I don't feel
comfortable ripping out the `BLI_BITMAP` from
`NlaEvalChannelSnapshot->remap_domain`
Pull Request: https://projects.blender.org/blender/blender/pulls/118957
This adds implicit sharing support for the `MemFile` undo-step. This decreases memory
usage and increases performance.
Implicit sharing allows the undo system to take (shared) ownership of some data.
Previously, the data would always be serialized and compared to the previous undo-step.
So this turns an O(n) operation into O(1) (in terms of memory usage and time).
Read/write code that wants to make use of this has to use the new `BLO_read_shared`
and `BLO_write_shared` functions respectively. Those either make use of implicit-sharing
internally or do the "full" read/write based on a passed-in function. It seems possible to
use the same API in the future to store shared data to .blend files.
Improvements:
* Much faster undo step creation in many cases by avoiding the majority data copies
and equality checks. This fixes#98574. I found undo step creation and undo step
decoding to be 2-5 times faster in some demo files from the blender website and in
some production files from the Heist project.
* Reduced memory usage when there is large data in `bmain`. For example, when
loading the same highly subdivided mesh that I used in #106228 the memory usage
is 1.03 GB now (compared to 1.62 GB in `main` currently). The main remaining copy
of the data now is done by rendering code.
* Some significant performance improvements were also measured for the new grease
pencil type (#105540).
There is one main downside of using implicit-sharing as implemented here: `MemFile`
undo steps can't be written as .blend files anymore. This has a few consequences:
* Auto-save becomes slower (up to 3x), because it can't just save the previous undo step
anymore and does a normal save instead. This has been discussed in more detail here:
https://devtalk.blender.org/t/remove-support-for-saving-memfile-undo-steps-as-blend-files-proposal/33544
It would be nice to work towards asynchronous auto-save to alleviate this problem.
Some previous work has been done to reduce the impact of this change in 41b10424c7
and f0f304e240. This has been committed separately in efb511a76d.
* Writing `quit.blend` has to do a normal file save now. So it's a bit slower too, but it's
less of a problem in practice.
* The `USE_WRITE_CRASH_BLEND` functionality does not work anymore. It doesn't seem
to be used by anyone (removed in e90f5d03c4)
There are also benefits to not writing `MemFile` from undo steps to disk. It allows us to
more safely do undo-specific optimizations without risking corrupted .blend files. This
is especially useful when we want to preserve forward compatibility in some cases.
This requires converting data before writing the .blend files, but this conversion is not
necessary for undo steps. Trying to implement this kind of optimization in the past has
often lead to bugs (e.g. 43b37fbc93).
Another new problem is that it is harder to know the size of each undo step. Currently, a
heuristic is used to approximate the memory usage, but better solutions could be found
if necessary.
Pull Request: https://projects.blender.org/blender/blender/pulls/106903
Add percentage closer filtering to shadowmap sampling and a
`shadow_filter_radius` property to lights to control it.
Notes:
* This adds PCF to `eevee_shadow_tracing_lib`, but not to
`eevee_shadow_lib`, which is used by volumes (not required) and
thickness.
* PCF is computed based on the LOD0 size. This assumes that higher
LODs are only used when the shadowmap resolution is actually good
enough to match the render resolution.
Pull Request: https://projects.blender.org/blender/blender/pulls/118220
- Skip leading forward slashes when setting the temp directory.
- Add a utility function to set the temporary directory
which is used for the user preferences & environment variables.
This issue was raised by #95411 where "//" resolves to "/",
then asserts when passed to Blender's file-system functions.
However the crash referenced in this report looks to be caused
by Collada failing to write to the temporary directory which
can be handled separately.
Ref !118872
Adds two nodes as "grid" equivalents to the existing volume nodes:
- **Grid to Mesh**
- **Distribute Points in Grid**
The code for the latter is just duplicated for now. In a later step
old node can be replaced by versioning with two new nodes.
Pull Request: https://projects.blender.org/blender/blender/pulls/118830
Any access to this after calling what_does_obaction would reference
invalid stack memory with undefined behavior.
Set to null to ensure this never happens.
There probably are more cases where crash will happen as it is
rooting into the issue with BKE_object_workob_calc_parent() which
is used in multiple places.
The issue is caused by the access to a runtime field of workob
outside of the BKE_object_workob_calc_parent(): the runtime field
is stack-allocated in the function, and can not be accessed outside
of the function.
The easiest way to reproduce is to use ASAN, and parent mesh to an
armature with automatic weights. Although, on macOS ASAN did not
report issues, so setting workob->runtime to nullptr at the end of
of the BKE_object_workob_calc_parent() was the easiest.
The solution is simple: make the function to return the matrix,
and take care of the working object inside of it, so all tricky
parts are hidden from the API.
The patch is targeting the main branch, as in 4.1 it is not
required to do such change because all uses of the function only
access object_to_world, which is stored in the object in 4.1.
A double-check in the what_does_obaction() might be needed as it
follows the similar pattern, but it does not seem that runtime
field of the workob is accessed in usages of the what_does_obaction().
Pull Request: https://projects.blender.org/blender/blender/pulls/118847
The time offset modifier was working differently than in GPv2. This is because in the new implementation, the time offset modifier actually modifies the keyframe mappings. And thus the order of the modifiers, and where the time offset modifier is placed in the stack, matters.
The problem is that this can lead to unexpected results like seeing unmodified drawings.
Technically, the issue here is that other modifiers only modify the current frame as supposed to all drawings in the timeline.
This is done as an optimization, but doesn't work when drawings can be shifted around on the timeline using the time offset modifier.
The fix changes the way the modifiers are executed. Because the time offset modifier can only modify **when** the drawings
are show, and not the drawing data themselves, we execute all the time offset modifiers first (in the order they appear in the stack) and then execute all the other modifiers after.
This means that the user can no longer run into the issue of "moving" drawings away from the current frame where they can't be seen.
It also makes time offset modifier behave the same as they did in GPv2.
Pull Request: https://projects.blender.org/blender/blender/pulls/118842
This rewrites the Alembic and USD data importers to work with and
output GeometrySets instead of Meshes.
The main motivation for this change is to be able to import properly
point clouds, which are currently imported as Meshes, and curves
data, which suffer from a lot of issues due to limitations of
legacy curves structures (fixed by the new curves data-block) and are
also converted to Meshes. Further, for Curves, it will allow importing
arbitrary attributes.
This patch was primarily meant for Alembic, but changes to USD import
were necessary as they share the same modifier.
For Alembic:
There should be no behavioral changes for Meshes
Curves are imported as the new Curves object type
Points are imported as PointClouds
For USD:
There should be no behavioral changes for Meshes
Curves are imported as the new Curves object type
Note that the current USD importer does not support loading PointClouds,
so this patch does not add support for it.
For both Alembic and USD, knots arrays are not read anymore, as the new
Curves object does not expose the ability to set them. Improvements can
be made in the future if and when example assets are provided.
This fixes at least the following:
#58704: Animated Alembic curves don't update on render
#112308: Curves have offset animations (alembic / USD)
#118261: wrong motion blur from usd in cycles and reverting to the first
frame when disabeling motion blur
Co-authored-by: Jesse Yurkovich <jesse.y@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/115623
String attributes are not handled correctly (or at all) by geometry nodes
currently because their storage is very inefficient and will likely have to
change in the future anyway. Elsewhere processing string attributes was
explicitly disabled. That was missing in these cases.
Pull Request: https://projects.blender.org/blender/blender/pulls/118802