[Bf-blender-cvs] [68906c605f3] master: Fix T103080: Regression: Setup tracking scene is disabled

Sergey Sharybin noreply at git.blender.org
Mon Jan 2 12:47:46 CET 2023


Commit: 68906c605f34ff82c840de09c0b85bd84b9d4410
Author: Sergey Sharybin
Date:   Mon Jan 2 12:44:10 2023 +0100
Branches: master
https://developer.blender.org/rB68906c605f34ff82c840de09c0b85bd84b9d4410

Fix T103080: Regression: Setup tracking scene is disabled

There are two underlying issues which got uncovered by the report:

First, is that the poll() function for the operator was using legacy
API which is on its way of removal in the next major version release.

This part is fixed in this patch based on a patch provided by Philipp
Oeser (P3389) with the modification that the `clip` is not accessed
prior to None check. Ended up in a bit annoying one-liner, the entire
function could be refactored to use early returns.

The second issue is that the Python access to the legacy property
was wrong: need to access camera reconstruction instead of accessing
deprecated DNA field.

===================================================================

M	release/scripts/startup/bl_operators/clip.py
M	source/blender/makesrna/intern/rna_tracking.c

===================================================================

diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py
index 4e018ffc457..4bdf20d207c 100644
--- a/release/scripts/startup/bl_operators/clip.py
+++ b/release/scripts/startup/bl_operators/clip.py
@@ -540,7 +540,7 @@ class CLIP_OT_setup_tracking_scene(Operator):
         sc = context.space_data
         if sc and sc.type == 'CLIP_EDITOR':
             clip = sc.clip
-            if clip and clip.tracking.reconstruction.is_valid:
+            if clip and clip.tracking.objects.active.reconstruction.is_valid:
                 return True
         return False
 
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index f08cd2fe95d..a4c3dab4b5d 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -101,6 +101,15 @@ static void rna_trackingPlaneTracks_begin(CollectionPropertyIterator *iter, Poin
   rna_iterator_listbase_begin(iter, &tracking_camera_object->plane_tracks, NULL);
 }
 
+static PointerRNA rna_trackingReconstruction_get(PointerRNA *ptr)
+{
+  MovieClip *clip = (MovieClip *)ptr->owner_id;
+  MovieTrackingObject *tracking_camera_object = BKE_tracking_object_get_camera(&clip->tracking);
+
+  return rna_pointer_inherit_refine(
+      ptr, &RNA_MovieTrackingReconstruction, &tracking_camera_object->reconstruction);
+}
+
 static void rna_trackingObjects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
   MovieClip *clip = (MovieClip *)ptr->owner_id;
@@ -2609,6 +2618,7 @@ static void rna_def_tracking(BlenderRNA *brna)
   /* reconstruction */
   prop = RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
   RNA_def_property_pointer_sdna(prop, NULL, "reconstruction_legacy");
+  RNA_def_property_pointer_funcs(prop, "rna_trackingReconstruction_get", NULL, NULL, NULL);
   RNA_def_property_struct_type(prop, "MovieTrackingReconstruction");
 
   /* objects */



More information about the Bf-blender-cvs mailing list