Previously these used a special "menu func" that used an argument value
passed through each menu button's a2 value. This was more complex than
necessary given the existence of generic button callbacks.
So use std::function in these remaining cases, and remove the now-unused
`butm_func` and `butm_func_arg` values in the uiBlock.
Recurse selection was not restricted to "mouse over icon" during range
selection (i.e. if we shift- double click on any area of tree element,
resurse select is still executed, which is wrong)
Also did a bit cleanup to use existing `is_over_icon` instead of calling
`outliner_item_is_co_over_icon` multiple times
Pull Request: https://projects.blender.org/blender/blender/pulls/118556
The `RNA_property_animateable` would check for some conditions, where it
is not valid to add or edit animations (e.g. if using a linked Action
ID...).
Add a new `RNA_property_drivable`, which is essentially a call to
`RNA_property_animateable` with extra checks in liboverride cases, as
drivers are stored directly in the AnimData struct, instead of their own
dedicated ID.
Pull Request: https://projects.blender.org/blender/blender/pulls/118809
The line separator needs to know vertical or horizontal orientation
at draw time, and is independent of button rect. This PR removes the
use of uiBut->a1 for this in favor of a derived struct.
Pull Request: https://projects.blender.org/blender/blender/pulls/118969
There seems to not be a strict rule to only have armatures as parents to
single bones, apparently collada files can also be set up to have mesh
parents for bones. As a consequence, the collada importer
`joint_parent_map` is not safe to fetch objects from and assume their
data can be cast to `bArmature`.
Ultimately, the `joint_parent_map` needs to be looked at again, this
patch just avoids a crash in this scenario (so no such joints will be
iported). Still better than crashing I guess.
Pull Request: https://projects.blender.org/blender/blender/pulls/118751
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 required to apply a small fix in the Metal texture uploader.
Without synchronization pixels of a wrong pass can be uploaded to
a wrong texture. This is because this code path is heavily reusing
temporary allocations, and at some point the allocation is not
considered as still in use, unless the command buffer used by the
texture uploader is submitted.
Ref #118919
Pull Request: https://projects.blender.org/blender/blender/pulls/118920
No functional changes.
This PR just replaces the `KEYFRAME_OK_CHECKS` macro with a function
`keyframe_ok_checks`.
The motivation for this is to remove the confusing use of nested macros.
Since the actual check has to be passed in, this new function takes a function as an argument.
Pull Request: https://projects.blender.org/blender/blender/pulls/118914
One of the consequences of the mistake in 3fcf535d2e (fixed in previous
commit), was that the more recent `LIB_EMBEDDED_DATA_LIB_OVERRIDE` ID
flag could be wrongly set in some nodetrees from pre-2.76 blendfiles.
This commit adds a check that embedded IDs flagged with
`LIB_EMBEDDED_DATA_LIB_OVERRIDE` are actually embedded IDs of a
liboverride.
Pull Request: https://projects.blender.org/blender/blender/pulls/118921
In 3fcf535d2e, the `ID.flag` data was split, keeping persisten flags in
`ID.flag`, and moving runtime ones into a new `ID.tag` data.
Some versionning code was then added to cleanup the existing `ID.flag`
on file read, but embedded IDs (root node trees only, back then) are not
stored in Main data-base, and were skipped.
Note that this fixes the conversion of older (2.76.4 and older) files.
There is no reliable way to cleanup files opened and saved from more
recent versions of Blender unfortunately.
Blender crashes when using the compositor debugger. That's because it
assumes the names of the operation classes will be demangled and will
proceed to slice them causing crashes. The standard makes no guarantees
about the form of the returned type_info::name, and it is implementation
defined.
While it is possible to demangle those names and return something that
is more human readable, it doesn't seem worth it as this is only used by
developers who should have no problem identifying mangled names. So we
just display the name as is.
Pull Request: https://projects.blender.org/blender/blender/pulls/118904
Remove uses for `uiDefButS`. -1 was passed as a2 still in a few
places, but that was most likely just because of copy & paste,
it doesn't look like that's actually used anywhere.
The color luminosity was written to this value, but never read
anywhere. uiBut::a2 is only read in three more places, none of
which could reasonably use this value.
Sort the incoming Alembic objects by name before processing them. This
mirrors what is already done in USD to partially side-step Blender's
quadratic behavior when checking object names.
The file contained in issue #118839 contains over 365000 individual
objects. This change allows loading to be ~4x faster; from 2.2 hours
down to 28 minutes.
Additionally, change the progress bar to report in finer-grained steps
to better indicate that progress is still being made.
Pull Request: https://projects.blender.org/blender/blender/pulls/118869
Note that this still isn't entirely thread safe since the catalogs of
the asset libraries may still be edited in various ways while building
the all asset library. But at least this avoids a data race when
assigning the catalog service once done building it.
Some of these members are not expected to change throughout the lifetime
of the class instances, so make them constant and only set them via the
constructor. Making them immutable this way helps making clear which
data needs extra attention for thread safety.
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
These shouldn't need to be accessed from outside the asset system
itself, so they should not be exposed with its API. Move them to an own
asset system private headers. This is a further step towards making
asset system classes more encapuslated, so behavior and data flow can be
controlled better (which helps addressing threat safety issues).
Personally I've found it quite confusing to work on higher level issues
of the asset catalog system, because I got lost in the multiple classes.
Hopefully separating them more clearly helps with that too.
Making the member private (or at least protected) makes threat safety
more tangible, and we don't need to expose locking in the API. Generally
we need to make data more encapsulated, so we can make edits more
controlled and threat safe.
Asset libraries also always have a catalog-service, so it can accessed
by reference, rather than pointer that would have to be null-checked.
In many modes, Blender uses the `MemFile` undo step, which serializes all DNA
data in RAM almost as if writing a .blend file. For auto-save, Blender used to
write the last `MemFile` undo step to disk because that was faster serializing
all of DNA again. Furthermore, saving the `quit.blend` file when closing Blender
also used this.
This functionality is now removed in preparate for supporting implicit sharing
in the undo system (#106903). Auto-save and saving the quit.blend file now use
regular file saving.
The removal of this feature and its implications have also been discussed here:
https://devtalk.blender.org/t/remove-support-for-saving-memfile-undo-steps-as-blend-files-proposal/33544
This was a debug feature for developers that allowed writing the last MemFile
undo step as a .blend file when Blender crashed. This was rarely/never used
nowadays and is now removed.
This is in preparation for #106903 which removes support for writing `MemFile`
undo steps as .blend files.