Commit Graph

90 Commits

Author SHA1 Message Date
Campbell Barton
97de4f07a3 Cleanup: doxy sections, parameter syntax 2021-09-15 10:53:12 +10:00
Bastien Montagne
edb95b3fcb Cleanup: Use ID_IS_LINKED instead of direct id.lib pointer check. 2021-08-26 15:01:14 +02:00
Bastien Montagne
1d06d35034 LibOverride: Do not report embedded IDs as non-overridable in 'foreach_id' code.
Embedded IDs (root nodetrees, master collection, etc.) pointer itself is
not editable, but their content may be overridden.

LibOverride code is supposed to know how to handle those embedded IDs.
2021-08-18 16:49:20 +02:00
Campbell Barton
9b89de2571 Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXX
Also use doxy style function reference `#` prefix chars when
referencing identifiers.
2021-07-04 00:43:40 +10:00
Campbell Barton
4b9ff3cd42 Cleanup: comment blocks, trailing space in comments 2021-06-24 15:59:34 +10:00
Bastien Montagne
ee849ca0f8 ID management: Do not assume that NO_MAIN means NO_USER_REFCOUNT
While this is still very fuzzy in current code, this old behavior makes
it close to impossible to efficiently use out-of-main temp data, as it
implies that we'd need to update refcounts everytime we add something
back into BMain (an 'un-refcount' ID usages when removing from BMain).

Now that we have two separate flags/tags for those two different things,
let's not merge them anymore.

Note that this is somewhat on-going process, still needs more checks and
cleanup. Related to T88555.
2021-05-26 17:05:00 +02:00
Campbell Barton
efc6f4675d Cleanup: spelling 2021-05-06 08:09:05 +10:00
Bastien Montagne
fff80afe39 LibQuery: Cleanup: Document more fields of LibraryForeachIDData struct. 2021-05-05 12:51:59 +02:00
Bastien Montagne
693a215dc4 LibOverride: Fix usage of IDProps that are not overridable.
Not all python-defined ID properties are overridable (yet), this needs
to be detected by libquery 'foreach id' code, such that those ID
pointers can be ignored by override code when working on override
hierarchies.

Fixes part of the issues found while investigating studio files (namely,
some py-defined ID pointer properties from rigify that are not currently
overridable would cause issues and false detections during resync).
2021-05-05 12:51:59 +02:00
Bastien Montagne
b616c522d9 LibOverride/LibQuery: Refactor 'non-overridable' status management.
Move the detection/decision of whether an ID pointer should be taken
into account in library override hierarchy processing to the LibQuery
area of code, by introducing a new callback flag.

This allows to factorize the test logic, be explicit in liboverride code
about ID relationships that can be ignored when exploring the override
hierarchy, and adds the possibility to do more checks about pointers to
be tagged as non-overridable in the future.

Note that all but the 'special' ID pointers (loop-back, embedded, etc.)
should be overridable. If some is not, relevant IDType 'foreach_id'
callback code is reponsible to tag it properly.

Python-defined IDProperties however are not systematicaly overridable
(yet), so this should allow us to detect that case and act accordingly
in an incomming commit.

No behavioral change expected in this commit.
2021-05-05 12:51:59 +02:00
Bastien Montagne
fd4c01a75c LibQuery: Add an option to process internal runtime ID pointers.
In some cases (advanced, low-level code) we also want to process ID
pointers like `ID.newid` or `ID.orig_id`.
2021-03-12 09:46:11 +01:00
Bastien Montagne
63b7ff9f4e Cleanup: Main foreach ID code: Remove MAX_LIBARRAY and improve comments.
The `MAX_LIBARRAY` define was an annoying doublon to the `INDEX_ID_MAX` enum value
now defined in `DNA_ID.h`, and it is no more useful.

And comments were somewhat outdated. Also added an explanation about
chosen order for the `INDEX_ID_<IDTYPE>` order.
2021-03-04 18:43:30 +01:00
Campbell Barton
fc08fe82ae Cleanup: spelling 2021-03-01 11:00:22 +11:00
Bastien Montagne
b958a59c79 BKE_lib_query: Add a function to detect and tag all unused IDs.
With the option to detect orphaned data recursively (i.e. if ID `a` is the
only user of ID `b`, and ID `a` is unused, ID `b` will also get tagged
as unused).

To be used by the Purge operation.
2021-02-25 17:48:54 +01:00
Jacques Lucke
dff51d418a Fix: window manager can reference scenes and workspaces
This also fixes T83592 for me.

Differential Revision: https://developer.blender.org/D10046
2021-02-04 11:31:01 +01:00
Bastien Montagne
131a758b6f Refactor BMain relations temp data.
`bmain.relations` is used to store temp data of relations between IDs,
to speed-up some complex processes heavily relying on such information.

Previous implementation was failry unclear/confusing, and required a
not-so-nice hack to 'tag' some ID as processed.

New code changes as such:
* Using `from`/`to` naming (instead of `user`/`used`).
* More clear separation between `to` `id_pointer` and `from` one,
  using an union instead of hacking around difference between `ID *` and
  `ID **` pointers.
* Adds storage of `session_uuid` informations (mainly useful as
  debug/ensuring proper consistency of data currently).
* Adds a structure per ID in the mapping. This enables possibility of
  storing tags (and potentially more  data in the future) per-ID,
  without polluting the IDs themselves with very short-life info.

Differential Revision: https://developer.blender.org/D10164
2021-01-22 16:05:17 +01:00
Sybren A. Stüvel
1b272a649b Cleanup: Blenkernel, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/blenkernel` module.

No functional changes.
2020-08-07 13:38:06 +02:00
Jacques Lucke
750899fd31 Simulation: improve depsgraph integration
A simulation data block has an embedded node tree, which requires
special handling in a couple of places. Some of those places were
missing beforehand.

This also adds a relation to make sure that the simulation is evaluated
after animations on the embedded node tree are evaluated.
2020-07-22 19:16:33 +02:00
Bastien Montagne
13e17cbd47 Cleanup: remove unused includes from lib_query.c 2020-05-26 12:33:28 +02:00
Bastien Montagne
13b10ab852 Fix/refactor foreach_id handling of animdata.
Now callbacks for animdata, nla strip and fcurve are in their own proper
BKE files (mimicking `foreach_id` callback of `IDTypeInfo`).

This commit also fixes some missing handling of ID pointers (text ID and
IDProperties of script fcurve modifier...).
2020-05-26 12:33:28 +02:00
Bastien Montagne
b01d2ea72a Libquery: Refactor: add bmain to data passed to callback.
No reason to enforce defining own callback user data for something that
controlling has already available...
2020-05-25 15:28:15 +02:00
Bastien Montagne
70c483e7db libquery: Cleanup: finish refactor by removing no more used code. 2020-05-21 19:37:57 +02:00
Bastien Montagne
3cb6efd3ab Libquery refactor: Cleanup (remove no more used macros). 2020-05-21 19:36:05 +02:00
Bastien Montagne
1f6ef73f98 Refactor: Move scene foreach_id to new IDTypeInfo structure. 2020-05-21 19:29:55 +02:00
Bastien Montagne
c732edbaa4 Refactor: Move object foreach_id to new IDTypeInfo structure. 2020-05-21 19:09:48 +02:00
Bastien Montagne
b9aa2acecd Refactor: Move collection foreach_id to new IDTypeInfo structure. 2020-05-20 18:43:47 +02:00
Bastien Montagne
e2b87aabb6 Cleanup collection handling in lib_query code.
Now we do not need anymore that extra function...
2020-05-20 18:43:47 +02:00
Bastien Montagne
1c79484d53 Libquery: refactor: handle scene's master collection like any othe embedded ID. 2020-05-20 18:43:46 +02:00
Bastien Montagne
3a284a37fd Refactor: Move simulation foreach_id to new IDTypeInfo structure. 2020-05-20 18:43:46 +02:00
Bastien Montagne
ee44283393 Refactor: Move pointcloud and volume foreach_id to new IDTypeInfo structure. 2020-05-20 18:43:46 +02:00
Bastien Montagne
4d613018ee Refactor: Move hair foreach_id to new IDTypeInfo structure. 2020-05-20 18:43:46 +02:00
Bastien Montagne
140935ee7e Refactor: Move grease pencil foreach_id to new IDTypeInfo structure. 2020-05-20 18:43:46 +02:00
Bastien Montagne
06c57d3e7a Refactor: Move workspace foreach_id to new IDTypeInfo structure. 2020-05-18 19:01:20 +02:00
Bastien Montagne
8f10f9d5dc Refactor: Move WindowManager and Screen foreach_id to new IDTypeInfo structure.
That one was a bit more complicated, and is still only partial refactor
(ultimately we want to have a foreach_id callback in SpaceType itself I
think...).
2020-05-18 18:51:06 +02:00
Bastien Montagne
ae97a7ac10 Refactor: Move action foreach_id to new IDTypeInfo structure. 2020-05-18 18:43:11 +02:00
Bastien Montagne
a8fc3c88ef Refactor: Move linestyle foreach_id to new IDTypeInfo structure. 2020-05-15 19:03:53 +02:00
Bastien Montagne
7ff933089a Refactor: Move mask foreach_id to new IDTypeInfo structure. 2020-05-15 19:03:53 +02:00
Bastien Montagne
c44d6fb987 Refactor: Move movieclip foreach_id to new IDTypeInfo structure. 2020-05-15 19:03:53 +02:00
Bastien Montagne
0055aa994d Refactor: Move particle foreach_id to new IDTypeInfo structure. 2020-05-15 19:03:53 +02:00
Bastien Montagne
4da3044abc Refactor: Move brush foreach_id to new IDTypeInfo structure. 2020-05-13 19:52:19 +02:00
Bastien Montagne
e4890fa564 Refactor: Move lightprobe foreach_id to new IDTypeInfo structure. 2020-05-13 19:39:47 +02:00
Bastien Montagne
58cc5c8573 Refactor: Move speaker foreach_id to new IDTypeInfo structure. 2020-05-13 19:30:04 +02:00
Bastien Montagne
3a896bb373 Refactor: Move world foreach_id to new IDTypeInfo structure. 2020-05-13 19:22:46 +02:00
Bastien Montagne
73f38f8db0 Refactor: Move shapekey foreach_id to new IDTypeInfo structure. 2020-05-13 19:08:54 +02:00
Bastien Montagne
9ac5413ac0 Refactor: Move camera foreach_id to new IDTypeInfo structure. 2020-05-13 19:01:20 +02:00
Bastien Montagne
13d0f74b80 Refactor: Move lamp foreach_id to new IDTypeInfo structure. 2020-05-12 18:54:57 +02:00
Bastien Montagne
8ce0c9111d Refactor: Move texture foreach_id to new IDTypeInfo structure. 2020-05-12 18:54:57 +02:00
Bastien Montagne
5fd64c014f Refactor: Move armature foreach_id to new IDTypeInfo structure. 2020-05-12 18:54:57 +02:00
Bastien Montagne
9996688b71 Refactor: Move library foreach_id to new IDTypeInfo structure. 2020-05-12 18:54:57 +02:00
Bastien Montagne
70b73732fe Refactor: Move lattice foreach_id to new IDTypeInfo structure. 2020-05-12 18:54:57 +02:00