1
$\begingroup$

I'm stuck trying to access the Keyframe A and B options through Blender's Python API. To give you a better idea, here's a screenshot of the options I'm talking about::enter image description here

I've tried a few things to get to them but haven't had any luck. For example, I tried using Blender tooltips, but the text keeps getting cut off, no matter how wide I make the window. Here's what I'm seeing:

bpy.data.movieclips["0001.png"] ... keyframe_a.

enter image description here

I also tried selecting the value and hitting enter to see if it would show up in the info window. I even tried changing the number, but both actions gave me the same result:

bpy.data.movieclips["0001.png"].(null) = 30

bpy.data.movieclips["0001.png"].(null) = 59

enter image description here

I would greatly appreciate any assistance.Thank you in advance!

$\endgroup$

1 Answer 1

2
$\begingroup$

If you right click on Keyframe A and select Edit Source

enter image description here

You will get this class in the text editor.

class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
    bl_space_type = 'CLIP_EDITOR'
    bl_region_type = 'TOOLS'
    bl_label = "Solve"
    bl_category = "Solve"

    def draw(self, context):
        layout = self.layout
        layout.use_property_split = True
        layout.use_property_decorate = False

        clip = context.space_data.clip
        tracking = clip.tracking
        settings = tracking.settings
        tracking_object = tracking.objects.active
        camera = clip.tracking.camera

        col = layout.column()
        col.prop(settings, "use_tripod_solver", text="Tripod")
        col = layout.column()
        col.active = not settings.use_tripod_solver
        col.prop(settings, "use_keyframe_selection", text="Keyframe")

        col = layout.column(align=True)
        col.active = (not settings.use_tripod_solver and
                      not settings.use_keyframe_selection)
        col.prop(tracking_object, "keyframe_a")
        col.prop(tracking_object, "keyframe_b")

        col = layout.column(heading="Refine", align=True)
        col.active = tracking_object.is_camera
        col.prop(settings, "refine_intrinsics_focal_length", text="Focal Length")
        col.prop(settings, "refine_intrinsics_principal_point", text="Optical Center")

        col.prop(settings, "refine_intrinsics_radial_distortion", text="Radial Distortion")

        row = col.row()
        row.active = (camera.distortion_model == 'BROWN')
        row.prop(settings, "refine_intrinsics_tangential_distortion", text="Tangential Distortion")

        col = layout.column(align=True)
        col.scale_y = 2.0

        col.operator("clip.solve_camera",
                     text="Solve Camera Motion" if tracking_object.is_camera
                     else "Solve Object Motion")

Now the keyframe_a and keyframe_a props has the data of tracking_object

clip = context.space_data.clip
tracking = clip.tracking
tracking_object = tracking.objects.active

col.prop(tracking_object, "keyframe_a")
col.prop(tracking_object, "keyframe_b")

To modify Keyframe A and Keyframe B, try this in the console.

# replace `footage.mp4` with your movieclip name
D.movieclips['footage.mp4'].tracking.objects.active.keyframe_a = 5
D.movieclips['footage.mp4'].tracking.objects.active.keyframe_b = 10
$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.