Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <mont29>2021-11-29 16:20:58 +0300
committerBastien Montagne <bastien@blender.org>2021-11-29 16:22:38 +0300
commite5e8db73df86ee04260c5f2bd2c61dfa8eb7943f (patch)
tree46a5840efb51a363f17e64b93d5132679a5dbec4 /source/blender/blenkernel/intern/vfont.c
parent6ae34bb0714859d9ef0b7fa2aceb16b4531df48f (diff)
Refactor BKE_bpath module.
The main goal of this refactor is to make BPath module use `IDTypeInfo`, and move each ID-specific part of the `foreach_path` looper into their own IDTypeInfo struct, using a new `foreach_path` callback. Additionally, following improvements/cleanups are included: * Attempt to get better, more consistent namings. ** In particular, move from `path_visitor` to more standard `foreach_path`. * Update and extend documentation. ** API doc was moved to header, according to recent discussions on this topic. * Remove `BKE_bpath_relocate_visitor` from API, this is specific callback that belongs in `lib_id.c` user code. NOTE: This commit is expected to be 100% non-behavioral-change. This implies that several potential further changes were only noted as comments (like using a more generic solution for `lib_id_library_local_paths`, addressing inconsistencies like path of packed libraries always being skipped, regardless of the `BKE_BPATH_FOREACH_PATH_SKIP_PACKED` `eBPathForeachFlag` flag value, etc.). NOTE: basic unittests were added to master already in rBdcc500e5a265093bc9cc. Reviewed By: brecht Differential Revision: https://developer.blender.org/D13381
Diffstat (limited to 'source/blender/blenkernel/intern/vfont.c')
-rw-r--r--source/blender/blenkernel/intern/vfont.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/vfont.c b/source/blender/blenkernel/intern/vfont.c
index 9ec81989d53..a17a57dc5ef 100644
--- a/source/blender/blenkernel/intern/vfont.c
+++ b/source/blender/blenkernel/intern/vfont.c
@@ -49,6 +49,7 @@
#include "DNA_vfont_types.h"
#include "BKE_anim_path.h"
+#include "BKE_bpath.h"
#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_idtype.h"
@@ -123,6 +124,21 @@ static void vfont_free_data(ID *id)
}
}
+static void vfont_foreach_path(ID *id, BPathForeachPathData *bpath_data)
+{
+ VFont *vfont = (VFont *)id;
+
+ if (vfont->packedfile != NULL && (bpath_data->flag & BKE_BPATH_FOREACH_PATH_SKIP_PACKED) != 0) {
+ return;
+ }
+
+ if (BKE_vfont_is_builtin(vfont)) {
+ return;
+ }
+
+ BKE_bpath_foreach_path_fixed_process(bpath_data, vfont->filepath);
+}
+
static void vfont_blend_write(BlendWriter *writer, ID *id, const void *id_address)
{
VFont *vf = (VFont *)id;
@@ -170,6 +186,7 @@ IDTypeInfo IDType_ID_VF = {
.make_local = NULL,
.foreach_id = NULL,
.foreach_cache = NULL,
+ .foreach_path = vfont_foreach_path,
.owner_get = NULL,
.blend_write = vfont_blend_write,