Age | Commit message (Collapse) | Author |
|
Part of T91671.
Not much else to say, this is mainly a massive deletion of code.
Note that a few cleanups possible after this proxy removal were kept out
of this commit to try to reduce a bit its size.
Reviewed By: sergey, brecht
Maniphest Tasks: T91671
Differential Revision: https://developer.blender.org/D13995
|
|
Some IDs (like text ones) can be linked and only kept around thanks to
editors, allow making such IDs local in `BKE_lib_id_make_local_generic`.
Also refactor logic checking whether ID should be made directly local or
copied into its own util function, so that we can remain sure all
special-cases 'make local' code still uses the same logic here.
|
|
MSVC used to warn about const mismatch for arguments passed by value.
Remove these as newer versions of MSVC no longer show this warning.
|
|
- Added space below non doc-string comments to make it clear
these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
- Minor improvements to doc-strings.
Ref T92709
|
|
|
|
All constraints were 'made local', including the ones comming from the
reference linked object.
|
|
|
|
During animation playback, data-blocks are reallocated, so storing
pointers to the resulting data is not okay. Instead, the data should
be retrieved from the context. This works when the applied search
item is the "dummy" item added for non-matches. However, it still
crashes for every other item, because the memory is owned by the
modifier value log, which has been freed by the time the exec function
runs.
The next part of the solution is to allow uiSearchItems
to own memory for the search items.
|
|
This is useful to allow the use of features made in C++.
Differential Revision: https://developer.blender.org/D13115
|
|
When appending an asset from the asset browser, its asset data needs to
be cleared.
However, linking an asset (or regular append from the file browser)
should not clear such data. In linking case, it would be there again
after a blend file reload anyway.
So this commit introduces a new `BLO_LIBLINK_APPEND_ASSET_DATA_CLEAR`
option.
NOTE: in case the appended ID needs to be copied from its linked data
(instead of making the later directly local), asset data is lost anyway
since it is never copied with the ID currently.
Ref. {T91749} and D11768.
|
|
Handling of RigidBody data in duplicate of scenes/collections was very
wrong. This commit:
- Add handling of duplication of RB collections when fully duplicating
a scene.
- Fix Object duplication trying to add duplicated RB objects to
matching RBW collections.
While the later behavior is desired when only duplicated objects, when
duplicating their collections and/or scenes it is actually very bad, as
it would add back new object duplicates to old (RBW) collections.
|
|
|
|
Mixing testing and actual action in a single function is just not a good
way to do things, and the 'testing' feature is not used anywhere
anymore, time to get rid of it.
|
|
them local.
This is to be used when calling code already knows whether the 'made
local' linked ID should be copied, or can directly be converted to a
local one.
Currently unused , this is preparation for rewrite of append code.
|
|
We need to separate the flag telling duplicate code to not handle
remapping to new IDs etc., from the one telling the code that we are
currently duplicating a 'root' ID (i.e. not a dependency of another
duplicated ID).
This whole duplicate code/logic is still fairly unsatisfying, think it
will need further refactor, or maybe even re-design, at some point...
|
|
function.
|
|
ID data-blocks that could be accessed from Python and weren't freed
using BKE_id_free_ex did not release the Python reference count.
Add BKE_libblock_free_data_py function to clear the Python reference
in this case.
Add asserts to ensure no Python reference is held in situations
when ID's are copied for internal use (not exposed through the RNA API),
to ensure these kinds of leaks don't go by unnoticed again.
|
|
Avoid computationally expensive copying operations
when only some settings have been modified.
This is done by adding support for updating parameters
without tagging for copy-on-write.
Currently only mesh data blocks are supported,
other data-blocks can be added individually.
This prepares for changing values such as edit-mesh auto-smooth angle
in edit-mode without duplicating all mesh-data.
The benefit will only be seen when the user interface no longer tags
all ID's for copy on write updates.
ID_RECALC_GEOMETRY_ALL_MODES has been added to support situations
where non edit-mode geometry is modified in edit-mode.
While this isn't something user are likely to do,
Python scripts may change the underlying mesh.
Reviewed By: sergey
Ref D11377
|
|
This is mandatory for liboverride resync, since this feature may imply
we have to create linked overrides in libraries, and there may be
several copies of those.
This is also a first step to a more general support of IDmanagement-editing
library data.
Note that this commit should have absolutely no effect on current code,
as the only function allowed to check unique names for linked IDs
currently is `BKE_libblock_management_main_add`, which is unused.
This commit also adds some basic testing for `BKE_id_new_name_validate`.
|
|
It wasn't obvious this function cleared the tag as well.
|
|
Resolve ownership ambiguity with shared physics pointers.
Previously, LIB_ID_CREATE_NO_MAIN allowed pointer sharing with
the source ID so physics caches can be shared between original and
evaluated data: (Object.soft.shared & Object.rigidbody_object.shared).
This only worked properly for LIB_TAG_COPIED_ON_WRITE ID's,
as LIB_TAG_NO_MAIN can be used in situations where the original ID's
lifetime limited by it's original data.
This commit adds `LIB_ID_COPY_SET_COPIED_ON_WRITE` so ID's only share
memory with original data for ID's evaluated in the depsgraph.
For all other uses, a full copy of physics data is made.
Ref D11228#287094
|
|
Relying on only no-main for that was weak, and inn the end it turns out
we sometimes also need to ifnore override data during copy of Main
data-blocks.
NOTE: The new `LIB_ID_COPY_NO_LIB_OVERRIDE` is also added to the
`LIB_ID_COPY_LOCALIZE` set of flags.
NOTE: The fact that we may now copy liboverrides in some non-main cases
may cause issues in some cases, pretty impossible to track all possible
ones from reading the code... Would not expect too many problem though,
usages of `LIB_ID_CREATE_NO_MAIN` by itself are not so common.
|
|
|
|
Sometimes multiple calls to `bpy.data.orphans_purge()` are needed to
delete all orphans, because a call can turn previously-used datablocks
into orphans. Returning the number of deleted datablocks makes it
possible to keep looping until nothing can be deleted any more.
This patch keeps track of deletions in `id_delete()` so that it can be
returned up the call stack.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D9918
|
|
|
|
This makes it possible to turn data-blocks into assets and back into normal
data-blocks. A core design decision made for the asset system is that not every
data-block should be an asset, because not every data-block is made for reuse.
Users have to explicitly mark data-blocks as assets.
Exposes "Mark Asset" and "Clear Asset" in Outliner context menus (currently ID
Data submenu) and button context menus. We are still not too happy with the
names, they may change.
This uses the new context members to pass data-blocks to operators, added in
af008f553293 and 0c1d4769235c.
Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.
Differential Revision: https://developer.blender.org/D9717
Reviewed by: Brecht Van Lommel
|
|
No reasons to keep the new ID pointer as parameter here.
Part of T71219.
|
|
Note that possibility to pass the new ID pointer as parameter was kept,
as this is needed for some rather specific cases (like in depsgraph/COW,
when copying into already allocated memory).
Part of T71219.
|
|
code.
Besides the NodeTree case (which remains unchanged), the localize code
is only used in one place (to generate previews of shading data-blocks).
This commit introduces a new `LIB_ID_CREATE_LOCAL` option for ID
creation/copying, which essentially implements the behavior of the
removed `BKE_XXX_localize()` functions into regular mainstream ID copy
code. When this option is set:
- new ID is tagged with `LIB_TAG_LOCALIZED`;
- Some ID copying callbacks have specific behaviors, mainly the root
nodetree of shading IDs gets duplicated with specialized
`ntreeLocalize()` function.
Note that I would not consider getting rid of `ntreeLocalize` for now,
this function is recursive, which should ideally never happen within ID
management copying code (this introduces all kind of complications).
No behavioral change expected from this commit.
|
|
Add a specific flag for nodetree deep-copy special localization code.
And add a new `LIB_ID_CREATE_LOCALIZE` flag, similar to
`LIB_ID_COPY_LOCALIZE`, for creation purposes.
No behavioral changes expected here.
|
|
|
|
No functional changes
|
|
I'm also adding `BKE_id_blend_write`, so that it can be accessed
outside of `readfile.c`.
|
|
This replaces header include guards with `#pragma once`.
A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`),
because they are used in other places.
This patch has been generated by P1561 followed by `make format`.
Differential Revision: https://developer.blender.org/D8466
|
|
Regression from d6cefef98f87a
This also fixes an unreported issue where finding an exact match
wasn't being detected for items that contained an ID prefix.
|
|
Note that this behavior is enforced on user level for now, but on code
side it is controlled with a flag, which should make it easy to refine
that behavior if needed.
Only exception is when we duplicate a linked ID directly (then we assume
user wants a local deep-copy of that linked data, and we always also
duplicate linked sub-data-blocks).
Note that this commit also slightly refactor the handling of actions of
animdata, by simplifying `BKE_animdata_copy_id_action()` and adding an
explicit new `BKE_animdata_duplicate_id_action()` to be used during ID
duplication (deep copy).
This also allows us to get rid of the special case for liboverrides.
|
|
Rather than a `L` (linked), `O` (overridden) or `M` (missing) prefix for the
name, show the existing library status icons. See D7999 for screenshots.
Note that when using preview icons, or if the search menu contains items with
own icons (e.g. brush icons), we still fallback to the prefix solution.
Zero or fake user is still indicated with a prefix.
Differential Revision: https://developer.blender.org/D7999
Reviewed by: Bastien Montagne, William Reynish
|
|
Now that we have a uniform consistent behavior in all our ID duplicate
funtions, we can easily factorize it greatly. Code gets cleaner,
smaller, and less error-prone.
Note that ultimately, this duplicate/deep copy behavior could be added
as a callback of IDTypeInfo.
We could also rethink the duplicate flags (some data, even some obdata,
like Lattice, are not coverred currently).
And so on. But at least code should now be much more easily maintainable
and extendable.
|
|
Main change from user side, besides that all pointers should now be
properly remapped to new IDs, is that linked objects are no longer
preserved when doing a full copy of scenes.
Will open a task to check whether we actually still want that behavior
(and re-code it in a more correct way then).
This is the main part of work done here, it aims at uniformizing and
sanitizing that 'deep copy' process for supported IDs (currently scenes,
collections and objects).
Note that there will be more follow up commits after that one, but this
should be the most risky and changing one.
|
|
Should separate the data-block name better from the library name and improve
readability.
|
|
|
|
Remove resetting of ID uuid session counter, it is not really needed
anymore, and not trivial to do this properly everytime.
Thanks @brecht for investigating this.
|
|
Surrounding includes with an 'extern "C"' block is not necessary anymore.
Also that made it harder to add any C++ code to some headers, or include headers
that have "optional" C++ code like `MEM_guardedalloc.h`.
I tested compilation on linux and windows (and got help from @LazyDodo).
If this still breaks compilation due to some linker error, the header containing
the symbol in question is probably missing an 'extern "C"' block.
Differential Revision: https://developer.blender.org/D7653
|
|
We need to re-generate a new session uuid for the UI-related data-blocks
that are kept across file reading, when load UI is disabled. Otherwise
there will be several IDs with same uuid, which is an ensured way to
crash in new undo code.
|
|
|
|
Preliminary work for undo-speedup.
Part of T60695/D6580.
|
|
"session-wise" here mean while editing a same .blend file. So creating
or opening a new one will reset the uuid counter. This should avoid any
overflow in practice.
Only IDs added to Main database get an uuid, runtime-only ones are not
affected.
This is intended to provide undo with a way to find IDs across several
'memory realms' (undo speedup project).
No behavior change is expected from this commit itself.
Part of T60695.
Differential Revision: https://developer.blender.org/D7007
|
|
Instead of using anonymous booleans flags, also allows to keep the same
behavior in all cases, without needing special handling from calling
code for our beloved oddballs object proxies...
|
|
This info is now stored in ID tags themselves, so no need to pass an
extra anonymous boolean parameter around, yay!
|
|
Also removed some only used locally from the header, `BKE_lib_id.h`
is already way too big, no need to overload it with unused things.
|