Refactor: Replace DNA_DEPRECATED attribute with _legacy suffix #105340

Merged
Sergey Sharybin merged 1 commits from Sergey/blender:tracking_deprecated into main 2023-03-01 15:19:07 +01:00
5 changed files with 31 additions and 29 deletions

View File

@ -329,7 +329,7 @@ static void movieclip_blend_read_data(BlendDataReader *reader, ID *id)
BLI_listbase_clear(&clip->runtime.gputextures); BLI_listbase_clear(&clip->runtime.gputextures);
/* Needed for proper versioning, will be NULL for all newer files anyway. */ /* Needed for proper versioning, will be NULL for all newer files anyway. */
BLO_read_data_address(reader, &clip->tracking.stabilization.rot_track); BLO_read_data_address(reader, &clip->tracking.stabilization.rot_track_legacy);
clip->tracking.dopesheet.ok = 0; clip->tracking.dopesheet.ok = 0;
BLI_listbase_clear(&clip->tracking.dopesheet.channels); BLI_listbase_clear(&clip->tracking.dopesheet.channels);

View File

@ -456,22 +456,22 @@ static void do_versions_affine_tracker_track(MovieTrackingTrack *track)
if (is_zero_v2(marker->pattern_corners[0]) && is_zero_v2(marker->pattern_corners[1]) && if (is_zero_v2(marker->pattern_corners[0]) && is_zero_v2(marker->pattern_corners[1]) &&
is_zero_v2(marker->pattern_corners[2]) && is_zero_v2(marker->pattern_corners[3])) { is_zero_v2(marker->pattern_corners[2]) && is_zero_v2(marker->pattern_corners[3])) {
marker->pattern_corners[0][0] = track->pat_min[0]; marker->pattern_corners[0][0] = track->pat_min_legacy[0];
marker->pattern_corners[0][1] = track->pat_min[1]; marker->pattern_corners[0][1] = track->pat_min_legacy[1];
marker->pattern_corners[1][0] = track->pat_max[0]; marker->pattern_corners[1][0] = track->pat_max_legacy[0];
marker->pattern_corners[1][1] = track->pat_min[1]; marker->pattern_corners[1][1] = track->pat_min_legacy[1];
marker->pattern_corners[2][0] = track->pat_max[0]; marker->pattern_corners[2][0] = track->pat_max_legacy[0];
marker->pattern_corners[2][1] = track->pat_max[1]; marker->pattern_corners[2][1] = track->pat_max_legacy[1];
marker->pattern_corners[3][0] = track->pat_min[0]; marker->pattern_corners[3][0] = track->pat_min_legacy[0];
marker->pattern_corners[3][1] = track->pat_max[1]; marker->pattern_corners[3][1] = track->pat_max_legacy[1];
} }
if (is_zero_v2(marker->search_min) && is_zero_v2(marker->search_max)) { if (is_zero_v2(marker->search_min) && is_zero_v2(marker->search_max)) {
copy_v2_v2(marker->search_min, track->search_min); copy_v2_v2(marker->search_min, track->search_min_legacy);
copy_v2_v2(marker->search_max, track->search_max); copy_v2_v2(marker->search_max, track->search_max_legacy);
} }
} }
} }
@ -1625,8 +1625,8 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (tracking_object = tracking->objects.first; tracking_object; for (tracking_object = tracking->objects.first; tracking_object;
tracking_object = tracking_object->next) { tracking_object = tracking_object->next) {
if (tracking_object->keyframe1 == 0 && tracking_object->keyframe2 == 0) { if (tracking_object->keyframe1 == 0 && tracking_object->keyframe2 == 0) {
tracking_object->keyframe1 = tracking->settings.keyframe1; tracking_object->keyframe1 = tracking->settings.keyframe1_legacy;
tracking_object->keyframe2 = tracking->settings.keyframe2; tracking_object->keyframe2 = tracking->settings.keyframe2_legacy;
} }
} }
} }

View File

@ -149,13 +149,13 @@ static bGPDpalettecolor *BKE_gpencil_palettecolor_addnew(bGPDpalette *palette, c
*/ */
static void migrate_single_rot_stabilization_track_settings(MovieTrackingStabilization *stab) static void migrate_single_rot_stabilization_track_settings(MovieTrackingStabilization *stab)
{ {
if (stab->rot_track) { if (stab->rot_track_legacy) {
if (!(stab->rot_track->flag & TRACK_USE_2D_STAB_ROT)) { if (!(stab->rot_track_legacy->flag & TRACK_USE_2D_STAB_ROT)) {
stab->tot_rot_track++; stab->tot_rot_track++;
stab->rot_track->flag |= TRACK_USE_2D_STAB_ROT; stab->rot_track_legacy->flag |= TRACK_USE_2D_STAB_ROT;
} }
} }
stab->rot_track = NULL; /* this field is now ignored */ stab->rot_track_legacy = NULL; /* this field is now ignored */
} }
static void do_version_constraints_radians_degrees_270_1(ListBase *lb) static void do_version_constraints_radians_degrees_270_1(ListBase *lb)
@ -1406,7 +1406,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
fd->filesdna, "MovieTrackingStabilization", "int", "tot_rot_track")) { fd->filesdna, "MovieTrackingStabilization", "int", "tot_rot_track")) {
MovieClip *clip; MovieClip *clip;
for (clip = bmain->movieclips.first; clip != NULL; clip = clip->id.next) { for (clip = bmain->movieclips.first; clip != NULL; clip = clip->id.next) {
if (clip->tracking.stabilization.rot_track) { if (clip->tracking.stabilization.rot_track_legacy) {
migrate_single_rot_stabilization_track_settings(&clip->tracking.stabilization); migrate_single_rot_stabilization_track_settings(&clip->tracking.stabilization);
} }
if (clip->tracking.stabilization.scale == 0.0f) { if (clip->tracking.stabilization.scale == 0.0f) {
@ -1420,8 +1420,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
clip->tracking.stabilization.anchor_frame = 1; clip->tracking.stabilization.anchor_frame = 1;
/* by default show the track lists expanded, to improve "discoverability" */ /* by default show the track lists expanded, to improve "discoverability" */
clip->tracking.stabilization.flag |= TRACKING_SHOW_STAB_TRACKS; clip->tracking.stabilization.flag |= TRACKING_SHOW_STAB_TRACKS;
/* deprecated, not used anymore */
clip->tracking.stabilization.ok = false;
} }
} }
} }

View File

@ -121,13 +121,13 @@ typedef struct MovieTrackingTrack {
* relative to marker->pos) * relative to marker->pos)
* moved to marker's corners since planar tracking implementation * moved to marker's corners since planar tracking implementation
*/ */
float pat_min[2] DNA_DEPRECATED, pat_max[2] DNA_DEPRECATED; float pat_min_legacy[2], pat_max_legacy[2];
/* positions of left-bottom and right-top corners of search area (in unified 0..1 units, /* positions of left-bottom and right-top corners of search area (in unified 0..1 units,
* relative to marker->pos * relative to marker->pos
* moved to marker since affine tracking implementation * moved to marker since affine tracking implementation
*/ */
float search_min[2] DNA_DEPRECATED, search_max[2] DNA_DEPRECATED; float search_min_legacy[2], search_max_legacy[2];
/** Offset to "parenting" point. */ /** Offset to "parenting" point. */
float offset[2]; float offset[2];
@ -281,8 +281,8 @@ typedef struct MovieTrackingSettings {
/* two keyframes for reconstruction initialization /* two keyframes for reconstruction initialization
* were moved to per-tracking object settings * were moved to per-tracking object settings
*/ */
int keyframe1 DNA_DEPRECATED; int keyframe1_legacy;
int keyframe2 DNA_DEPRECATED; int keyframe2_legacy;
int reconstruction_flag; int reconstruction_flag;
@ -315,7 +315,7 @@ typedef struct MovieTrackingStabilization {
/** Max auto-scale factor. */ /** Max auto-scale factor. */
float maxscale; float maxscale;
/** Use TRACK_USE_2D_STAB_ROT on individual tracks instead. */ /** Use TRACK_USE_2D_STAB_ROT on individual tracks instead. */
MovieTrackingTrack *rot_track DNA_DEPRECATED; MovieTrackingTrack *rot_track_legacy;
/** Reference point to anchor stabilization offset. */ /** Reference point to anchor stabilization offset. */
int anchor_frame; int anchor_frame;
@ -332,10 +332,7 @@ typedef struct MovieTrackingStabilization {
/** Filter used for pixel interpolation. */ /** Filter used for pixel interpolation. */
int filter; int filter;
/* initialization and run-time data */ int _pad;
/** Without effect now, we initialize on every frame.
* Formerly used for caching of init values. */
int ok DNA_DEPRECATED;
} MovieTrackingStabilization; } MovieTrackingStabilization;
typedef struct MovieTrackingReconstruction { typedef struct MovieTrackingReconstruction {

View File

@ -110,6 +110,13 @@ DNA_STRUCT_RENAME_ELEM(MovieTracking, act_track, act_track_legacy)
DNA_STRUCT_RENAME_ELEM(MovieTracking, plane_tracks, plane_tracks_legacy) DNA_STRUCT_RENAME_ELEM(MovieTracking, plane_tracks, plane_tracks_legacy)
DNA_STRUCT_RENAME_ELEM(MovieTracking, reconstruction, reconstruction_legacy) DNA_STRUCT_RENAME_ELEM(MovieTracking, reconstruction, reconstruction_legacy)
DNA_STRUCT_RENAME_ELEM(MovieTracking, tracks, tracks_legacy) DNA_STRUCT_RENAME_ELEM(MovieTracking, tracks, tracks_legacy)
DNA_STRUCT_RENAME_ELEM(MovieTrackingTrack, pat_min, pat_min_legacy)
DNA_STRUCT_RENAME_ELEM(MovieTrackingTrack, pat_max, pat_max_legacy)
DNA_STRUCT_RENAME_ELEM(MovieTrackingTrack, search_min, search_min_legacy)
DNA_STRUCT_RENAME_ELEM(MovieTrackingTrack, search_max, search_max_legacy)
DNA_STRUCT_RENAME_ELEM(MovieTrackingSettings, keyframe1, keyframe1_legacy)
DNA_STRUCT_RENAME_ELEM(MovieTrackingSettings, keyframe2, keyframe2_legacy)
DNA_STRUCT_RENAME_ELEM(MovieTrackingStabilization, rot_track, rot_track_legacy)
DNA_STRUCT_RENAME_ELEM(MovieTrackingCamera, principal, principal_legacy) DNA_STRUCT_RENAME_ELEM(MovieTrackingCamera, principal, principal_legacy)
DNA_STRUCT_RENAME_ELEM(NodeCryptomatte, num_inputs, inputs_num) DNA_STRUCT_RENAME_ELEM(NodeCryptomatte, num_inputs, inputs_num)
DNA_STRUCT_RENAME_ELEM(Object, col, color) DNA_STRUCT_RENAME_ELEM(Object, col, color)