Commit Graph

18 Commits

Author SHA1 Message Date
Lukas Tönne dfec8171cc Modifiers: Increase the length of name strings in ModifierTypeInfo
These name fields run out of space for some of the new Grease Pencil
modifiers, like "GreasePencilEnvelopeModifierData". Only one of these
strings is stored for each modifier type, so this should have almost no
impact on size.

Pull Request: https://projects.blender.org/blender/blender/pulls/117980
2024-02-08 12:34:27 +01:00
Jacques Lucke 29e2dcd2c8 Modifiers: remove modifier session_uid in favor of persistent_uid
Since 1497005054, there is a new `ModifierData.persistent_uid` which
has more use cases than the old `session_uid`. This patch removes
`ModifierData.session_uid` and replaces its usages with the new `persistent_uid`.

Pull Request: https://projects.blender.org/blender/blender/pulls/117909
2024-02-06 18:02:32 +01:00
Jacques Lucke 1497005054 Modifiers: add unique modifier identifiers
This adds a new `ModifierData.persistent_uid` integer property with the following properties:
* It's unique within the object.
* Match between the original and evaluated object.
* Stable across Blender sessions.
* Stable across renames and reorderings of modifiers.

Potential use-cases:
* Everywhere where we currently use the name as identifier. For example,
  `ModifierComputeContext` and `ModifierViewerPathElem`.
* Can be used as part of a key in `IDCacheKey` to support caches that stay
  in-tact across undo steps.
* Can be stored in the `SpaceNode` to identify the modifier whose geometry node
  tree is currently pinned (this could use the name currently, but that hasn't been
  implemented yet).

This new identifier has some overlap with `ModifierData.session_uid`, but there
are some differences:
* `session_uid` is unique within the entire Blender session (except for duplicates
  between the original and evaluated data blocks).
* `session_uid` is not stable across Blender sessions.

Especially due to the first difference, it's not immediately obvious that the new
`persistent_uid` can fulfill all use-cases of the existing `session_uid`. Nevertheless,
this seems likely and will be cleaned up separately.

Unfortunately, there is not a single place where modifiers are added to objects currently.
Therefore, there are quite a few places that need to ensure valid identifiers. I tried to catch
all the places, but it's hard to be sure. Therefore, I added an assert in `object_copy_data`
that checks if all identifiers are valid. This way, we should be notified relatively quickly if
issues are caused by invalid identifiers.

Pull Request: https://projects.blender.org/blender/blender/pulls/117347
2024-02-06 17:10:40 +01:00
Jacques Lucke 311ca3e6af Core: rename Session UUID to Session UID
`UUID` generally stands for "universally unique identifier". The session identifier that
we use is neither universally unique, nor does it follow the standard. Therefor, the term
"session uuid" is confusing and should be replaced.

In #116888 we briefly talked about a better name and ended up with "session uid".
The reason for "uid" instead of "id" is that the latter is a very overloaded term in Blender
already.

This patch changes all uses of "uuid" to "uid" where it's used in the context of a
"session uid". It's not always trivial to see whether a specific mention of "uuid" refers
to an actual uuid or something else. Therefore, I might have missed some renames.
I can't think of an automated way to differentiate the case.

BMesh also uses the term "uuid" sometimes in a the wrong context (e.g. `UUIDFaceStepItem`)
but there it also does not mean "session uid", so it's *not* changed by this patch.

Pull Request: https://projects.blender.org/blender/blender/pulls/117350
2024-01-22 13:47:13 +01:00
Jacques Lucke f4e52f447a Modifiers: add ModifierTypeInfo::foreach_cache callback
This allows modifiers to have cache pointers that are preserved over undo steps.
I intend to use this for the baked data cache for the geometry nodes modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/117307
2024-01-18 22:51:30 +01:00
Falk David c448fd214c Fix: `ModifierTypeFlag` max value
The maximum value of `ModifierTypeFlag` was not updated.
2024-01-18 11:46:10 +01:00
Hans Goudey 3e76a1a6c2 Cleanup: Move BKE_lib_id.h to C++ 2024-01-15 12:44:14 -05:00
Campbell Barton d2c392dec6 Docs: add doc-strings for modifier mapping flags & edit-mesh cage 2024-01-11 14:07:36 +11:00
Hans Goudey 06eda2a484 Cleanup: Remove most indirect includes of BKE_customdata.hh
Some common headers were including this. Separating the includes
will ideally lead to better conceptual separation between CustomData
and the attribute API too. Mostly the change is adding the file to
places where it was included indirectly before. But some code is
shuffled around to hopefully better places as well.
2023-12-26 23:59:44 -05:00
Hans Goudey 854cdd1180 Cleanup: Use consistent "mesh" variable name (replace "me")
"mesh" reads much better than "me" since "me" is a different word.
There's no reason to avoid using two more characters here. Replacing
all of these at once is better than encountering it repeatedly and
doing the same change bit by bit.
2023-12-08 16:40:06 -05:00
Hans Goudey 3a075a95ee Cleanup: Remove unused modifier functions 2023-12-05 09:36:13 -05:00
Hans Goudey fe3b8b6e9b Cleanup: Remove remnants of old color layer preview system
For context, see 6d09fa3577. Overall, these values were still
written in some cases, but never used. Nowadays the viewer node and
attribute overlays give even better answers to these needs.
2023-12-05 09:36:13 -05:00
Campbell Barton 27c660707d Cleanup: spelling in comments, variables 2023-11-27 09:54:36 +11:00
Hans Goudey 3d57bc4397 Cleanup: Move several blenkernel headers to C++
Mostly focus on areas where we're already using C++ features,
where combining C and C++ APIs is getting in the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/114972
2023-11-16 11:41:55 +01:00
Hans Goudey 8f5ff2c5dd Cleanup: Use C++ types for modifier type deform callbacks 2023-11-14 10:54:57 +01:00
Hans Goudey 805e6b7525 Cleanup: Use enum class for ModifierTypeType 2023-11-14 10:03:56 +01:00
Hans Goudey 0c1bb82fc4 Cleanup: Remove unnecessary struct and typedef keywords from C++ headers 2023-11-14 09:51:41 +01:00
Hans Goudey 7b51d32dd9 Cleanup: Move BKE_modifier.h to C++ 2023-11-14 09:30:40 +01:00