From bab47b60cb69c500869a3339654ad7d48dddf385 Mon Sep 17 00:00:00 2001 From: Simon Lenz Date: Wed, 12 Jan 2022 18:02:08 +0100 Subject: DNA: Add space clip editor defaults This is my attempt of adding defaults for the space clip editor struct (in line with https://developer.blender.org/T80164). It adds the default allocation for `SpaceClip` and `node_composite_movieclip.cc`. This also solves the error below (for C++ files using the DNA_default_alloc), which was put forward by Sergey Sharybin. Differential Revision: https://developer.blender.org/D13367 Reviewed by: Julian Eisel --- source/blender/blenkernel/intern/mask.c | 3 +- source/blender/blenkernel/intern/movieclip.c | 2 +- .../blenkernel/intern/tracking_region_tracker.c | 3 +- source/blender/compositor/CMakeLists.txt | 3 + .../operations/COM_KeyingScreenOperation.cc | 6 +- .../operations/COM_MovieDistortionOperation.cc | 4 +- .../operations/COM_PlaneTrackOperation.cc | 4 +- .../operations/COM_TrackPositionOperation.cc | 4 +- source/blender/editors/space_clip/CMakeLists.txt | 3 + source/blender/editors/space_clip/clip_editor.c | 9 +-- source/blender/editors/space_clip/clip_ops.c | 3 +- source/blender/editors/space_clip/space_clip.c | 11 +--- source/blender/makesdna/DNA_defaults.h | 4 +- source/blender/makesdna/DNA_movieclip_defaults.h | 28 +++++++++ source/blender/makesdna/DNA_space_defaults.h | 67 ++++++++++++++++++++++ source/blender/makesdna/intern/CMakeLists.txt | 1 + source/blender/makesdna/intern/dna_defaults.c | 16 ++++++ source/blender/makesrna/intern/CMakeLists.txt | 3 + source/blender/makesrna/intern/rna_mask.c | 3 +- source/blender/makesrna/intern/rna_tracking.c | 3 +- source/blender/nodes/CMakeLists.txt | 3 + source/blender/nodes/composite/CMakeLists.txt | 3 + .../composite/nodes/node_composite_movieclip.cc | 3 +- source/blender/sequencer/intern/render.c | 5 +- 24 files changed, 166 insertions(+), 28 deletions(-) create mode 100644 source/blender/makesdna/DNA_space_defaults.h (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 6f498c5c9e7..12bbab57cf2 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -38,6 +38,7 @@ #include "BLT_translation.h" +#include "DNA_defaults.h" #include "DNA_mask_types.h" #include "BKE_animsys.h" @@ -1308,7 +1309,7 @@ void BKE_mask_point_parent_matrix_get(MaskSplinePoint *point, MovieTrackingObject *ob = BKE_tracking_object_get_named(tracking, parent->parent); if (ob) { - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); float clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, ctime); BKE_movieclip_user_set_frame(&user, ctime); diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index e8975c82c46..88da789cdc4 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -953,7 +953,7 @@ static MovieClip *movieclip_alloc(Main *bmain, const char *name) static void movieclip_load_get_size(MovieClip *clip) { int width, height; - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); user.framenr = BKE_movieclip_remap_clip_to_scene_frame(clip, 1); BKE_movieclip_get_size(clip, &user, &width, &height); diff --git a/source/blender/blenkernel/intern/tracking_region_tracker.c b/source/blender/blenkernel/intern/tracking_region_tracker.c index 2265c05463b..4b23f74bc8f 100644 --- a/source/blender/blenkernel/intern/tracking_region_tracker.c +++ b/source/blender/blenkernel/intern/tracking_region_tracker.c @@ -26,6 +26,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_defaults.h" #include "DNA_movieclip_types.h" #include "BLI_threads.h" @@ -322,7 +323,7 @@ void BKE_tracking_refine_marker(MovieClip *clip, int search_area_height, search_area_width; int clip_flag = clip->flag & MCLIP_TIMECODE_FLAGS; int reference_framenr; - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); double dst_pixel_x[5], dst_pixel_y[5]; bool tracked; diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 905d1443002..af0ac6aee2e 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -40,6 +40,9 @@ set(INC ../../../intern/atomic ../../../intern/guardedalloc ../../../intern/clog + + # dna_type_offsets.h + ${CMAKE_CURRENT_BINARY_DIR}/../makesdna/intern ) set(INC_SYS diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc index aa92c5c0c2b..5d12f29b83f 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc @@ -18,6 +18,8 @@ #include "COM_KeyingScreenOperation.h" +#include "DNA_defaults.h" + #include "BKE_movieclip.h" #include "BKE_tracking.h" @@ -75,7 +77,7 @@ void KeyingScreenOperation::deinit_execution() KeyingScreenOperation::TriangulationData *KeyingScreenOperation::build_voronoi_triangulation() { - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); TriangulationData *triangulation; MovieTracking *tracking = &movie_clip_->tracking; MovieTrackingTrack *track; @@ -301,7 +303,7 @@ void KeyingScreenOperation::determine_canvas(const rcti &preferred_area, rcti &r r_area = COM_AREA_NONE; if (movie_clip_) { - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); int width, height; int clip_frame = BKE_movieclip_remap_scene_to_clip_frame(movie_clip_, framenumber_); diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cc b/source/blender/compositor/operations/COM_MovieDistortionOperation.cc index d04a970bc03..b25073394a2 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cc @@ -18,6 +18,8 @@ #include "COM_MovieDistortionOperation.h" +#include "DNA_defaults.h" + #include "BKE_movieclip.h" namespace blender::compositor { @@ -36,7 +38,7 @@ void MovieDistortionOperation::init_data() { if (movie_clip_) { MovieTracking *tracking = &movie_clip_->tracking; - MovieClipUser clip_user = {0}; + MovieClipUser clip_user = *DNA_struct_default_get(MovieClipUser); int calibration_width, calibration_height; BKE_movieclip_user_set_frame(&clip_user, framenumber_); diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.cc b/source/blender/compositor/operations/COM_PlaneTrackOperation.cc index 28da200c615..cb73fa9af7b 100644 --- a/source/blender/compositor/operations/COM_PlaneTrackOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.cc @@ -18,6 +18,8 @@ #include "COM_PlaneTrackOperation.h" +#include "DNA_defaults.h" + #include "BKE_movieclip.h" #include "BKE_tracking.h" @@ -80,7 +82,7 @@ void PlaneTrackCommon::determine_canvas(const rcti &preferred_area, rcti &r_area r_area = COM_AREA_NONE; if (movie_clip_) { int width, height; - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); BKE_movieclip_user_set_frame(&user, framenumber_); BKE_movieclip_get_size(movie_clip_, &user, &width, &height); r_area = preferred_area; diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cc b/source/blender/compositor/operations/COM_TrackPositionOperation.cc index fc6be97a29c..61ce750a2f4 100644 --- a/source/blender/compositor/operations/COM_TrackPositionOperation.cc +++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cc @@ -18,6 +18,8 @@ #include "COM_TrackPositionOperation.h" +#include "DNA_defaults.h" + #include "BKE_movieclip.h" #include "BKE_node.h" #include "BKE_tracking.h" @@ -50,7 +52,7 @@ void TrackPositionOperation::calc_track_position() { is_track_position_calculated_ = true; MovieTracking *tracking = nullptr; - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); MovieTrackingObject *object; track_position_ = 0; diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt index 8c7f59d61dd..06179ffdd95 100644 --- a/source/blender/editors/space_clip/CMakeLists.txt +++ b/source/blender/editors/space_clip/CMakeLists.txt @@ -31,6 +31,9 @@ set(INC ../../windowmanager ../../../../intern/glew-mx ../../../../intern/guardedalloc + + # dna_type_offsets.h + ${CMAKE_CURRENT_BINARY_DIR}/../../makesdna/intern ) set(SRC diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 09daed7e2e7..d22e4864ecf 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -34,6 +34,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_defaults.h" #include "DNA_mask_types.h" #include "BLI_fileops.h" @@ -686,7 +687,7 @@ static bool check_prefetch_break(void) static uchar *prefetch_read_file_to_memory( MovieClip *clip, int current_frame, short render_size, short render_flag, size_t *r_size) { - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); user.framenr = current_frame; user.render_size = render_size; user.render_flag = render_flag; @@ -733,7 +734,7 @@ static int prefetch_find_uncached_frame(MovieClip *clip, short direction) { int current_frame; - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); user.render_size = render_size; user.render_flag = render_flag; @@ -833,7 +834,7 @@ static void prefetch_task_func(TaskPool *__restrict pool, void *task_data) while ((mem = prefetch_thread_next_frame(queue, clip, &size, ¤t_frame))) { ImBuf *ibuf; - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); int flag = IB_rect | IB_multilayer | IB_alphamode_detect | IB_metadata; int result; char *colorspace_name = NULL; @@ -915,7 +916,7 @@ static bool prefetch_movie_frame(MovieClip *clip, short render_flag, short *stop) { - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); if (check_prefetch_break() || *stop) { return false; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 0aa7e35aed6..ef522e57d02 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -33,6 +33,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_defaults.h" #include "DNA_scene_types.h" /* min/max frames */ #include "DNA_userdef_types.h" @@ -1321,7 +1322,7 @@ static uchar *proxy_thread_next_frame(ProxyQueue *queue, BLI_spin_lock(&queue->spin); if (!*queue->stop && queue->cfra <= queue->efra) { - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); char name[FILE_MAX]; size_t size; int file; diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 847cba32c69..b6dbda79a2d 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -24,6 +24,8 @@ #include #include +#include "DNA_defaults.h" + #include "DNA_mask_types.h" #include "DNA_movieclip_types.h" #include "DNA_scene_types.h" @@ -239,14 +241,7 @@ static SpaceLink *clip_create(const ScrArea *area, const Scene *scene) ARegion *region; SpaceClip *sc; - sc = MEM_callocN(sizeof(SpaceClip), "initclip"); - sc->spacetype = SPACE_CLIP; - sc->flag = SC_SHOW_MARKER_PATTERN | SC_SHOW_TRACK_PATH | SC_SHOW_GRAPH_TRACKS_MOTION | - SC_SHOW_GRAPH_FRAMES | SC_SHOW_ANNOTATION; - sc->zoom = 1.0f; - sc->path_length = 20; - sc->scopes.track_preview_height = 120; - sc->around = V3D_AROUND_CENTER_MEDIAN; + sc = DNA_struct_default_alloc(SpaceClip); /* header */ region = MEM_callocN(sizeof(ARegion), "header for clip"); diff --git a/source/blender/makesdna/DNA_defaults.h b/source/blender/makesdna/DNA_defaults.h index 6e986129143..ef7f573e7a8 100644 --- a/source/blender/makesdna/DNA_defaults.h +++ b/source/blender/makesdna/DNA_defaults.h @@ -48,7 +48,9 @@ uint8_t *_DNA_struct_default_alloc_impl(const uint8_t *data_src, #define DNA_struct_default_alloc(struct_name) \ (struct_name *)_DNA_struct_default_alloc_impl( \ - DNA_default_table[SDNA_TYPE_FROM_STRUCT(struct_name)], sizeof(struct_name), __func__) + (const uint8_t *)DNA_default_table[SDNA_TYPE_FROM_STRUCT(struct_name)], \ + sizeof(struct_name), \ + __func__) #ifdef __cplusplus } diff --git a/source/blender/makesdna/DNA_movieclip_defaults.h b/source/blender/makesdna/DNA_movieclip_defaults.h index 753147eb072..e9013b08d79 100644 --- a/source/blender/makesdna/DNA_movieclip_defaults.h +++ b/source/blender/makesdna/DNA_movieclip_defaults.h @@ -45,6 +45,34 @@ .frame_offset = 0, \ } +#define _DNA_DEFAULT_MovieClipUser \ + { \ + .framenr = 1, \ + .render_size = MCLIP_PROXY_RENDER_SIZE_FULL, \ + .render_flag = 0, \ + } + +#define _DNA_DEFAULT_MovieClipScopes \ + { \ + .ok = 0, \ + .use_track_mask = 0, \ + .track_preview_height = 120, \ + .frame_width = 0, \ + .frame_height = 0, \ + .undist_marker = _DNA_DEFAULT_MovieTrackingMarker, \ + .track_pos = {0, 0}, \ + .track_disabled = 0, \ + .track_locked = 0, \ + .scene_framenr = 0, \ + .slide_scale = {0.0f, 0.0f}, \ + } + +/* initialise as all zeros */ +#define _DNA_DEFAULT_MovieTrackingMarker \ + { \ + 0, \ + } + /** \} */ /* clang-format on */ diff --git a/source/blender/makesdna/DNA_space_defaults.h b/source/blender/makesdna/DNA_space_defaults.h new file mode 100644 index 00000000000..94577adc0d1 --- /dev/null +++ b/source/blender/makesdna/DNA_space_defaults.h @@ -0,0 +1,67 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup DNA + */ + +#pragma once + +/* Struct members on own line. */ +/* clang-format off */ + +/* -------------------------------------------------------------------- */ +/** \name Spaceclip Struct + * \{ */ + +#define _DNA_DEFAULT_MaskSpaceInfo \ + { \ + .draw_flag = 0, \ + .draw_type = MASK_DT_OUTLINE, \ + .overlay_mode = MASK_OVERLAY_ALPHACHANNEL, \ + } + +#define _DNA_DEFAULT_SpaceClip \ + { \ + .spacetype = SPACE_CLIP, \ + .link_flag = 0, \ + .xof = 0, \ + .yof = 0, \ + .xlockof = 0, \ + .ylockof = 0, \ + .zoom = 1.0f, \ + .user = _DNA_DEFAULT_MovieClipUser, \ + .scopes = _DNA_DEFAULT_MovieClipScopes, \ + .flag = SC_SHOW_MARKER_PATTERN | SC_SHOW_TRACK_PATH | SC_SHOW_GRAPH_TRACKS_MOTION | \ + SC_SHOW_GRAPH_FRAMES | SC_SHOW_ANNOTATION, \ + .mode = SC_MODE_TRACKING, \ + .view = SC_VIEW_CLIP, \ + .path_length = 20, \ + .loc = {0, 0}, \ + .scale = 0, \ + .angle = 0, \ + .stabmat = _DNA_DEFAULT_UNIT_M4, \ + .unistabmat = _DNA_DEFAULT_UNIT_M4, \ + .postproc_flag = 0, \ + .gpencil_src = SC_GPENCIL_SRC_CLIP, \ + .around = V3D_AROUND_CENTER_MEDIAN, \ + .cursor = {0, 0}, \ + .mask_info = _DNA_DEFAULT_MaskSpaceInfo, \ + } + +/** \} */ + +/* clang-format on */ diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index db34cf83fa9..a3c54e91780 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -159,6 +159,7 @@ set(SRC ../DNA_pointcloud_defaults.h ../DNA_scene_defaults.h ../DNA_simulation_defaults.h + ../DNA_space_defaults.h ../DNA_speaker_defaults.h ../DNA_texture_defaults.h ../DNA_vec_defaults.h diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c index 1d4257328a4..cc060e1241c 100644 --- a/source/blender/makesdna/intern/dna_defaults.c +++ b/source/blender/makesdna/intern/dna_defaults.c @@ -103,6 +103,7 @@ #include "DNA_light_types.h" #include "DNA_lightprobe_types.h" #include "DNA_linestyle_types.h" +#include "DNA_mask_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" #include "DNA_meta_types.h" @@ -144,6 +145,7 @@ #include "DNA_pointcloud_defaults.h" #include "DNA_scene_defaults.h" #include "DNA_simulation_defaults.h" +#include "DNA_space_defaults.h" #include "DNA_speaker_defaults.h" #include "DNA_texture_defaults.h" #include "DNA_volume_defaults.h" @@ -208,6 +210,9 @@ SDNA_DEFAULT_DECL_STRUCT(MetaBall); /* DNA_movieclip_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(MovieClip); +SDNA_DEFAULT_DECL_STRUCT(MovieClipUser); +SDNA_DEFAULT_DECL_STRUCT(MovieClipScopes); +SDNA_DEFAULT_DECL_STRUCT(MovieTrackingMarker); /* DNA_object_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(Object); @@ -225,6 +230,10 @@ SDNA_DEFAULT_DECL_STRUCT(ToolSettings); /* DNA_simulation_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(Simulation); +/* DNA_space_defaults.h */ +SDNA_DEFAULT_DECL_STRUCT(MaskSpaceInfo); +SDNA_DEFAULT_DECL_STRUCT(SpaceClip); + /* DNA_speaker_defaults.h */ SDNA_DEFAULT_DECL_STRUCT(Speaker); @@ -406,11 +415,18 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = { /* DNA_mesh_defaults.h */ SDNA_DEFAULT_DECL(Mesh), + /* DNA_space_defaults.h */ + SDNA_DEFAULT_DECL(SpaceClip), + SDNA_DEFAULT_DECL_EX(MaskSpaceInfo, SpaceClip.mask_info), + SDNA_DEFAULT_DECL_EX(MovieClipUser, SpaceClip.user), + SDNA_DEFAULT_DECL_EX(MovieClipScopes, SpaceClip.scopes), + /* DNA_meta_defaults.h */ SDNA_DEFAULT_DECL(MetaBall), /* DNA_movieclip_defaults.h */ SDNA_DEFAULT_DECL(MovieClip), + SDNA_DEFAULT_DECL_EX(MovieTrackingMarker, MovieClipScopes.undist_marker), /* DNA_object_defaults.h */ SDNA_DEFAULT_DECL(Object), diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 7e6d0aea2ee..f057d8e9d4c 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -203,6 +203,9 @@ set(INC ../../blenloader ${CMAKE_BINARY_DIR}/source/blender/makesdna/intern + + # dna_type_offsets.h + ${CMAKE_CURRENT_BINARY_DIR}/../../makesdna/intern ) set(INC_SYS diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index 9c90c209389..21bacf2e6be 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -23,6 +23,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_defaults.h" #include "DNA_mask_types.h" #include "DNA_object_types.h" /* SELECT */ #include "DNA_scene_types.h" @@ -84,7 +85,7 @@ static void rna_Mask_update_parent(Main *bmain, Scene *scene, PointerRNA *ptr) if (track) { MovieTrackingMarker *marker = BKE_tracking_marker_get(track, clip_framenr); float marker_pos_ofs[2], parmask_pos[2]; - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); BKE_movieclip_user_set_frame(&user, scene->r.cfra); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 03f4acdae79..2d4d5ee766f 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -32,6 +32,7 @@ #include "rna_internal.h" +#include "DNA_defaults.h" #include "DNA_movieclip_types.h" #include "DNA_object_types.h" /* SELECT */ #include "DNA_scene_types.h" @@ -609,7 +610,7 @@ static MovieTrackingTrack *add_track_to_base( MovieClip *clip, MovieTracking *tracking, ListBase *tracksbase, const char *name, int frame) { int width, height; - MovieClipUser user = {0}; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); MovieTrackingTrack *track; user.framenr = 1; diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index f965302be5e..957c5b78342 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -48,6 +48,9 @@ set(INC ../windowmanager ../../../intern/glew-mx ../../../intern/guardedalloc + + # dna_type_offsets.h + ${CMAKE_CURRENT_BINARY_DIR}/../makesdna/intern ) diff --git a/source/blender/nodes/composite/CMakeLists.txt b/source/blender/nodes/composite/CMakeLists.txt index c2d9c8a71bb..0374f913d4b 100644 --- a/source/blender/nodes/composite/CMakeLists.txt +++ b/source/blender/nodes/composite/CMakeLists.txt @@ -33,6 +33,9 @@ set(INC ../../render ../../windowmanager ../../../../intern/guardedalloc + + # dna_type_offsets.h + ${CMAKE_CURRENT_BINARY_DIR}/../../makesdna/intern ) diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc index 94f32ae8db4..f6f00864839 100644 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc @@ -23,6 +23,7 @@ #include "BKE_context.h" #include "BKE_lib_id.h" +#include "DNA_defaults.h" #include "RNA_access.h" @@ -47,7 +48,7 @@ static void init(const bContext *C, PointerRNA *ptr) { bNode *node = (bNode *)ptr->data; Scene *scene = CTX_data_scene(C); - MovieClipUser *user = MEM_cnew(__func__); + MovieClipUser *user = DNA_struct_default_alloc(MovieClipUser); node->id = (ID *)scene->clip; id_us_plus(node->id); diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index 9f4e07820fa..482425e70d3 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -29,6 +29,7 @@ #include "MEM_guardedalloc.h" #include "DNA_anim_types.h" +#include "DNA_defaults.h" #include "DNA_mask_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" @@ -1188,15 +1189,13 @@ static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, bool *r_is_proxy_image) { ImBuf *ibuf = NULL; - MovieClipUser user; + MovieClipUser user = *DNA_struct_default_get(MovieClipUser); IMB_Proxy_Size psize = SEQ_rendersize_to_proxysize(context->preview_render_size); if (!seq->clip) { return NULL; } - memset(&user, 0, sizeof(MovieClipUser)); - BKE_movieclip_user_set_frame(&user, frame_index + seq->anim_startofs + seq->clip->start_frame); user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL; -- cgit v1.2.3