diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_idtype.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_movieclip.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/idtype.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_id_delete.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 93 |
6 files changed, 60 insertions, 62 deletions
diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h index 91c0216db0b..226b35080b1 100644 --- a/source/blender/blenkernel/BKE_idtype.h +++ b/source/blender/blenkernel/BKE_idtype.h @@ -152,7 +152,7 @@ extern IDTypeInfo IDType_ID_BR; extern IDTypeInfo IDType_ID_PA; // extern IDTypeInfo IDType_ID_GD; extern IDTypeInfo IDType_ID_WM; -// extern IDTypeInfo IDType_ID_MC; +extern IDTypeInfo IDType_ID_MC; // extern IDTypeInfo IDType_ID_MSK; // extern IDTypeInfo IDType_ID_LS; // extern IDTypeInfo IDType_ID_PAL; diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h index d49fab78afa..dbd6eb15bf2 100644 --- a/source/blender/blenkernel/BKE_movieclip.h +++ b/source/blender/blenkernel/BKE_movieclip.h @@ -36,14 +36,7 @@ struct MovieClipScopes; struct MovieClipUser; struct MovieDistortion; -void BKE_movieclip_free(struct MovieClip *clip); - -void BKE_movieclip_copy_data(struct Main *bmain, - struct MovieClip *clip_dst, - const struct MovieClip *clip_src, - const int flag); struct MovieClip *BKE_movieclip_copy(struct Main *bmain, const struct MovieClip *clip); -void BKE_movieclip_make_local(struct Main *bmain, struct MovieClip *clip, const int flags); struct MovieClip *BKE_movieclip_file_add(struct Main *bmain, const char *name); struct MovieClip *BKE_movieclip_file_add_exists_ex(struct Main *bmain, diff --git a/source/blender/blenkernel/intern/idtype.c b/source/blender/blenkernel/intern/idtype.c index 56b85f32ff7..2c19e8bc113 100644 --- a/source/blender/blenkernel/intern/idtype.c +++ b/source/blender/blenkernel/intern/idtype.c @@ -79,7 +79,7 @@ static void id_type_init(void) INIT_TYPE(ID_PA); // INIT_TYPE(ID_GD); INIT_TYPE(ID_WM); - // INIT_TYPE(ID_MC); + INIT_TYPE(ID_MC); // INIT_TYPE(ID_MSK); // INIT_TYPE(ID_LS); // INIT_TYPE(ID_PAL); diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index 37b416918c7..ff07b6e579c 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -541,9 +541,7 @@ bool BKE_lib_id_make_local(Main *bmain, ID *id, const bool test, const int flags } return true; case ID_MC: - if (!test) { - BKE_movieclip_make_local(bmain, (MovieClip *)id, flags); - } + BLI_assert(0); return true; case ID_MSK: if (!test) { @@ -749,7 +747,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag) BKE_gpencil_copy_data((bGPdata *)*r_newid, (bGPdata *)id, flag); break; case ID_MC: - BKE_movieclip_copy_data(bmain, (MovieClip *)*r_newid, (MovieClip *)id, flag); + BLI_assert(0); break; case ID_MSK: BKE_mask_copy_data(bmain, (Mask *)*r_newid, (Mask *)id, flag); @@ -1300,7 +1298,7 @@ void BKE_libblock_init_empty(ID *id) BLI_assert(0); break; case ID_LI: - /* Nothing to do. */ + BLI_assert(0); break; case ID_OB: BLI_assert(0); @@ -1342,7 +1340,7 @@ void BKE_libblock_init_empty(ID *id) BLI_assert(0); break; case ID_SCR: - /* Nothing to do. */ + BLI_assert(0); break; case ID_VF: BLI_assert(0); @@ -1354,13 +1352,13 @@ void BKE_libblock_init_empty(ID *id) BLI_assert(0); break; case ID_GR: - /* Nothing to do. */ + BLI_assert(0); break; case ID_AR: - /* Nothing to do. */ + BLI_assert(0); break; case ID_AC: - /* Nothing to do. */ + BLI_assert(0); break; case ID_NT: BLI_assert(0); diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c index 268e906333d..3ccfcfbd8a1 100644 --- a/source/blender/blenkernel/intern/lib_id_delete.c +++ b/source/blender/blenkernel/intern/lib_id_delete.c @@ -223,7 +223,7 @@ void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag)) BKE_gpencil_free((bGPdata *)id, true); break; case ID_MC: - BKE_movieclip_free((MovieClip *)id); + BLI_assert(0); break; case ID_MSK: BKE_mask_free((Mask *)id); diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 8e64c02fbb3..796681876e0 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -51,9 +51,12 @@ #include "BLI_math.h" #include "BLI_threads.h" +#include "BLT_translation.h" + #include "BKE_animsys.h" #include "BKE_colortools.h" #include "BKE_global.h" +#include "BKE_idtype.h" #include "BKE_lib_id.h" #include "BKE_main.h" #include "BKE_movieclip.h" @@ -74,6 +77,53 @@ # include "intern/openexr/openexr_multi.h" #endif +static void free_buffers(MovieClip *clip); + +static void movie_clip_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag) +{ + MovieClip *movie_clip_dst = (MovieClip *)id_dst; + const MovieClip *movie_clip_src = (const MovieClip *)id_src; + + /* We never handle usercount here for own data. */ + const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + + movie_clip_dst->anim = NULL; + movie_clip_dst->cache = NULL; + + BKE_tracking_copy(&movie_clip_dst->tracking, &movie_clip_src->tracking, flag_subdata); + movie_clip_dst->tracking_context = NULL; + + BKE_color_managed_colorspace_settings_copy(&movie_clip_dst->colorspace_settings, + &movie_clip_src->colorspace_settings); +} + +static void movie_clip_free_data(ID *id) +{ + MovieClip *movie_clip = (MovieClip *)id; + + /* Also frees animdata. */ + free_buffers(movie_clip); + + BKE_tracking_free(&movie_clip->tracking); + BKE_animdata_free((ID *)movie_clip, false); +} + +IDTypeInfo IDType_ID_MC = { + .id_code = ID_MC, + .id_filter = FILTER_ID_MC, + .main_listbase_index = INDEX_ID_MC, + .struct_size = sizeof(MovieClip), + .name = "MovieClip", + .name_plural = "movieclips", + .translation_context = BLT_I18NCONTEXT_ID_MOVIECLIP, + .flags = 0, + + .init_data = NULL, + .copy_data = movie_clip_copy_data, + .free_data = movie_clip_free_data, + .make_local = NULL, +}; + /*********************** movieclip buffer loaders *************************/ static int sequence_guess_offset(const char *full_name, int head_len, unsigned short numlen) @@ -1621,44 +1671,6 @@ void BKE_movieclip_build_proxy_frame_for_ibuf(MovieClip *clip, } } -/** Free (or release) any data used by this movie clip (does not free the clip itself). */ -void BKE_movieclip_free(MovieClip *clip) -{ - /* Also frees animdata. */ - free_buffers(clip); - - BKE_tracking_free(&clip->tracking); - BKE_animdata_free((ID *)clip, false); -} - -/** - * Only copy internal data of MovieClip ID from source - * to already allocated/initialized destination. - * You probably never want to use that directly, - * use #BKE_id_copy or #BKE_id_copy_ex for typical needs. - * - * WARNING! This function will not handle ID user count! - * - * \param flag: Copying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more). - */ -void BKE_movieclip_copy_data(Main *UNUSED(bmain), - MovieClip *clip_dst, - const MovieClip *clip_src, - const int flag) -{ - /* We never handle usercount here for own data. */ - const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; - - clip_dst->anim = NULL; - clip_dst->cache = NULL; - - BKE_tracking_copy(&clip_dst->tracking, &clip_src->tracking, flag_subdata); - clip_dst->tracking_context = NULL; - - BKE_color_managed_colorspace_settings_copy(&clip_dst->colorspace_settings, - &clip_src->colorspace_settings); -} - MovieClip *BKE_movieclip_copy(Main *bmain, const MovieClip *clip) { MovieClip *clip_copy; @@ -1666,11 +1678,6 @@ MovieClip *BKE_movieclip_copy(Main *bmain, const MovieClip *clip) return clip_copy; } -void BKE_movieclip_make_local(Main *bmain, MovieClip *clip, const int flags) -{ - BKE_lib_id_make_local_generic(bmain, &clip->id, flags); -} - float BKE_movieclip_remap_scene_to_clip_frame(const MovieClip *clip, float framenr) { return framenr - (float)clip->start_frame + 1.0f; |