When resyncing linked liboverride data, new IDs may be created that do
not exist in actual library file (since the lib file has not been resynced).
If such 'virtual linked liboverrides' data-blocks are used locally (e.g.
by adding such object to a local collection), on next file read they will be
detected as missing.
Now resync code will list such missing linked IDs that were
liboverrides, and try to re-use them when matching (by root name and
library) with newly generated virtual liboverrides.
The process may not be 100% perfect, especially a perfect one-to-one
remapping cannot be ensured if source data keep being changed over and
over (because of the order in which virtual linked liboverrides
generated by resync may change over time). However, in practice this
should fix the vast majority of issues, especially if sane naming
practices are used on IDs.
---------------
For the record, an attempt was made to write liboverride data together
with the placeholders for linked IDs in .blendfile. In theory, this
should ensure a perfect and fully valid re-usage of such IDs.
However, for this to work, not only the liboverride data of linked IDs need
to be written on disk, but also all ID references in this data has to be
considered as directly linked, to ensure that such liboverride data can
be re-read properly.
Otherwise, these placeholders would get a liboverride data with NULL ID
pointers, which is useless.
Such change feels way to intrusive for the very limited benefit, so for
now would consider current solution as the best option.
Pull Request: https://projects.blender.org/blender/blender/pulls/107144
Add a notifier when setting `scene.cursor.matrix`. This was already in
place for `cursor.location` and `cursor.rotation`, but was still missing
for `cursor.matrix`, which caused the cursor to remain displayed in its
old transform.
Vulkan test cases uses SRGB conversion. These test cases where failing
as the conversion table wasn't initialized.
This PR initializes the conversion table and fix the Vulkan data
conversion tests.
This would iterate over all files and call the sneaky `filelist_file()`,
meaning each file would be added to the cache for a minor query. That's
plenty of unnecessary work and kinda defeats the purpose of the partial
cache design.
`filelist_file()` is an easy way to do a bunch of unnecessary work and
fill the file browser caching for little reason. Unfortunately the
caching affects too many things to be a mere API implementation detail,
so rather be clear about this and point out alternatives.
The details on the file cache lookup just look confusing and make the
function look daunting. Encapsulate it into a function so it's trivial
to see what's going on
This case was not properly handled by the previous fix in #107621.
The viewer node path function still assumes that the node editor space
has a valid ID pointer (`snode.id`) and that it is an `Object`.
The ID pointer can be null when setting a pinned node tree through the
python API, like so:
```Py
space.pin = True
space.node_tree = some_other_node_tree
```
In this case the `ED_node_tree_start` function is called without and ID
pointer, which is allowed! This patch makes sure that the viewer node
path function is only used with a valid object context.
Pull Request: https://projects.blender.org/blender/blender/pulls/107737
Fixes crashes in timeline and spreadsheet editors during simulation
nodes baking:
* Timeline tries to access the `states_at_frames_` list of the cache to
determine which frames to draw as baked. This can collide with the
baking thread. Needs a mutex to safely access the cache state.
Note: the old point cache has a pre-allocated flag array
`cached_frames` which the baking thread writes into while timeline is
reading it concurrently - not thread-safe but harmless.
* Spreadsheet keeps a data pointer during drawing, which may become
deallocated when the cache is updated. Common approach here is to use
`G.is_rendering` to lock the editor while baking.
Pull Request: https://projects.blender.org/blender/blender/pulls/107621
Remove the assumption that quaternions are always fully keyed in a pose
asset. Even though quaternions really should be fully keyed, better not
make Blender crash when this assumption doesn't hold.
If the quaternion is only partially keyed, the other components are taken
to be from the unit quaternion (`[1, 0, 0, 0]`) and the result is
normalized before blending into the existing pose.
This fixesblender/blender-addons#104591, which was reported against the
pose library add-on, but actually was caused by an issue in Blender.
The maximum delta time is still capped to one frame even if multiple
frames are skipped. Passing in a too large delta time is mostly unexpected
and can reduce the stability of the simulation. Also it can be very slow
when the simulation uses the delta time to determine e.g. how many particles
should be added.
The `NC_SCENE | ND_FRAME` was originally added so that the sequencer
preview is redrawn so that the fps stops showing (2855485565).
Using this specific notifier has the side effect that it also causes a depsgraph
update in `wm_event_do_notifiers`. However, that is not necessary just to
trigger the redraw. Using the `NC_SPACE | ND_SPACE_SEQUENCER` notifier
also triggers the redraw without causing a depsgraph update.
The sequencer has a feature where it only draws a preview while scrubbing.
This was introduced in 8abdc89912.
When scrubbing ends, the sequencer requires an extra update so that the
non-preview version is shown again.
This is only needed by the sequencer and hence the update should not be
done if the sequencer is not used.
Changing `screen->scrubbing` is moved out of the sequencer specific
functions, because it's used elsewhere as well.
Previously, there was always a depsgraph update when the mouse moves
while scrubbing in the timeline. Even when the mouse movement does
not change the actual frame. This can happen when e.g. the mouse first
hovers over frame 5.2 and then it moves to frame 5.3. In both cases the
actual frame is rounded to 5, so no update is necessary (that is unless
subframes are used).
Part of #59244
This was heavily requested since there are a lot of usages of
`operator_menu_enum` around in our UI [and these menus all cannot be
added to Quick Favorites atm.].
The following are just a small sample from the 3D viewport menus (object
mode), but there are many more.
- Object
-- Set Origin
-- Relations >> Make Local...
-- Convert To
- Add
-- Grease Pencil
-- Empty
-- Force Field
-- Collection Instance
- Select
-- Select All by Type
-- Select Grouped
-- Select Linked
- ...
So in order to make this work, `USER_MENU_TYPE_OPERATOR` /
`bUserMenuItem_Op` is reused (but extended with a string to the property
in question). (Alternatively, a new type could be introduced -- but
would share most of the code with the type that is reused in this
patch).
Depending on being used with an enum or not [detected by the usage of
that new string] we then either call `uiItemFullO_ptr` or
`uiItemMenuEnumFullO_ptr` in `screen_user_menu_draw`.
NOTE: support for other enums (property enums such as pivot point or
transform orientations) will follow in a separate commit (building upon
6a13b6324b, trying to solve the way these draw as menus)
NOTE: opening User Preferences with such "new" Quick Favorites even
works (just not drawn with a menu)
Pull Request: https://projects.blender.org/blender/blender/pulls/107616
Replace MAXPATHLEN with FILE_MAX, always allocate if the buffer isn't
big enough since creating a truncated directory isn't useful.
Having some code-paths only run in an ifdef complicated the code
and made it more difficult to follow.
Also assert the path doesn't contain ".." directories as they aren't
supported.
Renamed geometry node "Face Is Planar" to "Is Face Planar"
so that the name in the menu and in the node are the same.
Translations now also works as expected.
Pull Request: https://projects.blender.org/blender/blender/pulls/107713
- The official spelling of FFMPEG is FFmpeg (upper, then lower case).
- The normal vector copy and paste operators shoud be singular because
they can only be used on a single element.
- The "Parent File" file browser operator goes up one level in the
file hierarchy. It should be called "Parent Directory", like the
current description "Go to the parent directory".
- "Mass Vertex Group" used to define the mass, but was reused at some
point and now actually defines cloth pinning so it should be called
"Pin Vertex Group", as in the UI.
- The Transformation constraint's Map To Type suffered from a
typo (probably of -> on).
- "Fall-off" is more commonly spelled "Falloff".
- "Effected" should really be "Affected" in this case.
- Rephrase the descriptions for the curve painting tools drawing
plane, which did not seem to match what the settings do. Namely,
they allow selecting in which plane to draw curves using the Curve
Draw tool.
Reported by @Joan-Pujolar in #43295:
- Force exporting animation on every objects [objects singular]
- Color of the interface widgets text insertion cursor (caret) [delete
interface widgets]
- Index of active aov [AOV in uppercase everywhere else]
- Does this tool use an painting canvas [an]
- This script was written Blender version %d.%d.%d ["for" missing
before "Blender"]
- [fcurve -> F-curve]
- unknown error stating file [statting]
- Offset into each stroke before the beginning of the dashed segment
generation [Two spaces between of and the]
- Find the nearest element in the a group. [either "the" or "a"]
Pull Request: https://projects.blender.org/blender/blender/pulls/107699
- Don't duplicate/allocate the path on each recursion,
instead make a single copy which is modified in-place.
- Move slash-stepping to a BLI_path utility function that accesses
the end position of the parent directory, handles multiple slashes
and '/./'.
Only use the term len & maxlen when they represent the length & maximum
length of a string. Instead of the available bytes to use.
Also include the data they're referencing as a suffix, otherwise it's
not always clear what the length is in reference to.
Reserve the term `len` for string length, some functions used this for
an string/array length, others a destination buffer size
(even within a single function declaration).
Also improve naming consistency across different functions.
Support string size debug so it can be used for regular development.
It works be writing values into strings, ensuring the buffer size
given is actually available. Developers can use this with memory
checking tools such as ASAN/valgrind to force an error when
the value used for the size of a buffer is larger than the buffer.
Resolve remaining issue with RNA using BLI_strncpy* in generated
callback functions where the size argument didn't represent the
size of the destination buffer.
This is automatically enabled along with ASAN for the
blender_developer.cmake configuration.
Ref PR !107602.
`sinf(float_angle)` is sometimes producing different results on
x86_64 cpus and apple silicon cpus. Convert to double precision
to increase accuracy and consistency.
Partial fix for #104513. More to come.
This addresses the 'liboverrides still tagged for resync after resync
process' error reports.
Turns out, this situation is (unfortunately) normal in some rare cases,
hwne the hierarchies in the liboverride and the reference data have
drastically diverged.Since the detection of liboverrides to resync, and
which one are valid partial resync roots, happens on the 'old' override
hierarchy, it may not match the actual hierarchy recreated from the
reference data, leading to some part of it being ignored by the resync
code.
There is no real way to avoid this situation, the only thing that can be
done is detect it, and re-process the resync code again when it happens.
From quick limited tests in (extremely dirty/outdated) Pets production files,
most of the time only one resync process is needed. Worst case so far
required 5 reprocessing of the same set of data.
There is no error messages from resync anymore in these tests, so at the
very least resync process should now be significantly more reliable than
before...
This issue tackled here is essentially the same as in ac1ac6be9a
(recursive Purge of unused IDs could delete actually used IDs): handling
of dependency loops is extremely delicate...
This commit essentially rewrites from scratch the code that ensures that
all liboverrides and their dependencies that need it are tagged for resync,
and identifies the partial resync roots.
Dependency loops whitin a hierarchy make this process very complex, as
they can lead to having to recursively process more than once some IDs.
Partial resync roots are also a source of complexity, since some IDs may
be detected a potential roots, and later as dependencies of another
partial resync hierarchy.
This new code generates waaaaaayyyyy less error messages when resyncing
nightmare-like production files (i.e. production files which libraries
have been _heavily_ modified). There are still a few error reports in
some cases though, which are the synptoms of another issue that will be
fixed in the next commit.
While in practice this was probably not a big issue (since usually e.g.
objects used by a nodetree would also be used by other objects or
collections in the liboverride hierarchy), in some corner cases it could
have caused missing 'tag for resync' and improper partial resync roots
detection.
Introduces "Optimal" packing, where the layout is a theoretical
best possible for a given input.
e.g. https://erich-friedman.github.io/packing/squinsqu
Also calls multiple packing algorithms, and chooses the best one.