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.
This commit is contained in:
parent
a4e843c250
commit
68906c605f
Notes:
blender-bot
2023-02-13 13:50:36 +01:00
Referenced by issue #103080, Regression: Setup tracking scene is disabled
|
@ -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
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue