[Bf-blender-cvs] [1300da6d392] master: Cleanup: More clear function name in tracking module
Sergey Sharybin
noreply at git.blender.org
Tue Nov 22 11:54:22 CET 2022
Commit: 1300da6d3928ce80a494044b39455180e75302de
Author: Sergey Sharybin
Date: Fri Oct 7 09:46:11 2022 +0200
Branches: master
https://developer.blender.org/rB1300da6d3928ce80a494044b39455180e75302de
Cleanup: More clear function name in tracking module
Make it more obvious in the name that an operation is not
cheap, and that the function operates on a tracks from
object and does not need a global tracking structure.
===================================================================
M source/blender/blenkernel/BKE_tracking.h
M source/blender/blenkernel/intern/constraint.c
M source/blender/blenkernel/intern/mask.c
M source/blender/blenkernel/intern/tracking.c
M source/blender/compositor/operations/COM_PlaneTrackOperation.cc
M source/blender/compositor/operations/COM_TrackPositionOperation.cc
M source/blender/editors/object/object_constraint.c
M source/blender/makesrna/intern/rna_mask.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h
index 11356aa0384..8e66cf2e670 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -248,8 +248,6 @@ void BKE_tracking_tracks_average(struct MovieTrackingTrack *dst_track,
/*const*/ struct MovieTrackingTrack **src_tracks,
int num_src_tracks);
-struct MovieTrackingTrack *BKE_tracking_track_get_named(
- struct MovieTracking *tracking, struct MovieTrackingObject *tracking_object, const char *name);
struct MovieTrackingTrack *BKE_tracking_track_get_indexed(struct MovieTracking *tracking,
int tracknr,
struct ListBase **r_tracksbase);
@@ -380,9 +378,6 @@ bool BKE_tracking_plane_track_has_marker_at_frame(struct MovieTrackingPlaneTrack
bool BKE_tracking_plane_track_has_enabled_marker_at_frame(
struct MovieTrackingPlaneTrack *plane_track, int framenr);
-struct MovieTrackingPlaneTrack *BKE_tracking_plane_track_get_named(
- struct MovieTracking *tracking, struct MovieTrackingObject *tracking_object, const char *name);
-
struct MovieTrackingPlaneTrack *BKE_tracking_plane_track_get_active(
struct MovieTracking *tracking);
@@ -450,6 +445,16 @@ struct MovieTrackingObject *BKE_tracking_object_get_named(struct MovieTracking *
struct MovieTrackingObject *BKE_tracking_object_get_active(const struct MovieTracking *tracking);
struct MovieTrackingObject *BKE_tracking_object_get_camera(const struct MovieTracking *tracking);
+/* Find point track with the given name in the tracking object.
+ * If such track does not exist NULL is returned. */
+struct MovieTrackingTrack *BKE_tracking_object_find_track_with_name(
+ struct MovieTrackingObject *tracking_object, const char *name);
+
+/* Find plane track with the given name in the tracking object.
+ * If such track does not exist NULL is returned. */
+struct MovieTrackingPlaneTrack *BKE_tracking_object_find_plane_track_with_name(
+ struct MovieTrackingObject *tracking_object, const char *name);
+
/* --------------------------------------------------------------------
* Camera.
*/
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 986f432b2fe..03613058b5b 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4880,8 +4880,7 @@ static bool followtrack_context_init(FollowTrackContext *context,
return false;
}
- context->track = BKE_tracking_track_get_named(
- context->tracking, context->tracking_object, data->track);
+ context->track = BKE_tracking_object_find_track_with_name(context->tracking_object, data->track);
if (context->track == NULL) {
return false;
}
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index d877620855f..b6e82fb9ecf 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -1298,8 +1298,8 @@ void BKE_mask_point_parent_matrix_get(MaskSplinePoint *point,
BKE_movieclip_user_set_frame(&user, ctime);
if (parent->type == MASK_PARENT_POINT_TRACK) {
- MovieTrackingTrack *track = BKE_tracking_track_get_named(
- tracking, ob, parent->sub_parent);
+ MovieTrackingTrack *track = BKE_tracking_object_find_track_with_name(ob,
+ parent->sub_parent);
if (track) {
float marker_position[2], parent_co[2];
@@ -1309,8 +1309,8 @@ void BKE_mask_point_parent_matrix_get(MaskSplinePoint *point,
}
}
else /* if (parent->type == MASK_PARENT_PLANE_TRACK) */ {
- MovieTrackingPlaneTrack *plane_track = BKE_tracking_plane_track_get_named(
- tracking, ob, parent->sub_parent);
+ MovieTrackingPlaneTrack *plane_track = BKE_tracking_object_find_plane_track_with_name(
+ ob, parent->sub_parent);
if (plane_track) {
float corners[4][2];
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 32e31cdfc0f..8277a731eef 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1034,19 +1034,6 @@ void BKE_tracking_tracks_average(MovieTrackingTrack *dst_track,
tracking_average_tracks(dst_track, src_tracks, num_src_tracks);
}
-MovieTrackingTrack *BKE_tracking_track_get_named(MovieTracking *UNUSED(tracking),
- MovieTrackingObject *tracking_object,
- const char *name)
-{
- LISTBASE_FOREACH (MovieTrackingTrack *, track, &tracking_object->tracks) {
- if (STREQ(track->name, name)) {
- return track;
- }
- }
-
- return NULL;
-}
-
MovieTrackingTrack *BKE_tracking_track_get_indexed(MovieTracking *tracking,
int tracknr,
ListBase **r_tracksbase)
@@ -1680,19 +1667,6 @@ void BKE_tracking_plane_track_free(MovieTrackingPlaneTrack *plane_track)
MEM_freeN(plane_track->point_tracks);
}
-MovieTrackingPlaneTrack *BKE_tracking_plane_track_get_named(MovieTracking *UNUSED(tracking),
- MovieTrackingObject *tracking_object,
- const char *name)
-{
- LISTBASE_FOREACH (MovieTrackingPlaneTrack *, plane_track, &tracking_object->plane_tracks) {
- if (STREQ(plane_track->name, name)) {
- return plane_track;
- }
- }
-
- return NULL;
-}
-
MovieTrackingPlaneTrack *BKE_tracking_plane_track_get_active(struct MovieTracking *tracking)
{
MovieTrackingObject *tracking_object = BKE_tracking_object_get_active(tracking);
@@ -2068,6 +2042,30 @@ MovieTrackingObject *BKE_tracking_object_get_camera(const MovieTracking *trackin
return NULL;
}
+MovieTrackingTrack *BKE_tracking_object_find_track_with_name(MovieTrackingObject *tracking_object,
+ const char *name)
+{
+ LISTBASE_FOREACH (MovieTrackingTrack *, track, &tracking_object->tracks) {
+ if (STREQ(track->name, name)) {
+ return track;
+ }
+ }
+
+ return NULL;
+}
+
+MovieTrackingPlaneTrack *BKE_tracking_object_find_plane_track_with_name(
+ MovieTrackingObject *tracking_object, const char *name)
+{
+ LISTBASE_FOREACH (MovieTrackingPlaneTrack *, plane_track, &tracking_object->plane_tracks) {
+ if (STREQ(plane_track->name, name)) {
+ return plane_track;
+ }
+ }
+
+ return NULL;
+}
+
/* --------------------------------------------------------------------
* Camera.
*/
diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.cc b/source/blender/compositor/operations/COM_PlaneTrackOperation.cc
index 58302510791..db0912fa370 100644
--- a/source/blender/compositor/operations/COM_PlaneTrackOperation.cc
+++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.cc
@@ -52,7 +52,8 @@ void PlaneTrackCommon::read_corners_from_track(float corners[4][2], float frame)
tracking_object_name_);
if (tracking_object) {
MovieTrackingPlaneTrack *plane_track;
- plane_track = BKE_tracking_plane_track_get_named(tracking, tracking_object, plane_track_name_);
+ plane_track = BKE_tracking_object_find_plane_track_with_name(tracking_object,
+ plane_track_name_);
if (plane_track) {
float clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movie_clip_, frame);
BKE_tracking_plane_marker_get_subframe_corners(plane_track, clip_framenr, corners);
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cc b/source/blender/compositor/operations/COM_TrackPositionOperation.cc
index d8c4b4f3ddb..3e7a2d3cbd9 100644
--- a/source/blender/compositor/operations/COM_TrackPositionOperation.cc
+++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cc
@@ -54,8 +54,8 @@ void TrackPositionOperation::calc_track_position()
MovieTrackingObject *tracking_object = BKE_tracking_object_get_named(tracking,
tracking_object_name_);
if (tracking_object) {
- MovieTrackingTrack *track = BKE_tracking_track_get_named(
- tracking, tracking_object, track_name_);
+ MovieTrackingTrack *track = BKE_tracking_object_find_track_with_name(tracking_object,
+ track_name_);
if (track) {
MovieTrackingMarker *marker;
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index cbed01442ee..19e51bfa2d4 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -428,7 +428,7 @@ static void test_constraint(
con->flag |= CONSTRAINT_DISABLE;
}
else {
- if (!BKE_tracking_track_get_named(tracking, tracking_object, data->track)) {
+ if (!BKE_tracking_object_find_track_with_name(tracking_object, data->track)) {
con->flag |= CONSTRAINT_DISABLE;
}
}
diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c
index 2303cde997f..3dd2f5626c0 100644
--- a/source/blender/makesrna/intern/rna_mask.c
+++ b/source/blender/makesrna/intern/rna_mask.c
@@ -66,8 +66,8 @@ static void rna_Mask_update_parent(Main *bmain, Scene *scene, PointerRNA *ptr)
int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, scene->r.cfra);
if (parent->type == MASK_PARENT_POINT_TRACK) {
- MovieTrackingTrack *track = BKE_tracking_track_get_named(
- tracking, tracking_object, parent
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list