diff options
Diffstat (limited to 'source/blender/blenkernel/intern/movieclip.c')
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 93 |
1 files changed, 50 insertions, 43 deletions
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; |