0
$\begingroup$

I work a lot in the Timeline Editor. If I bind a camera to a Marker and it is named the same way, I thought that maybe I could have a script that auto-selects the corresponding camera after selecting the Marker. That would be so helpful to ease work with keyframes after selecting a Marker.

But in the Info Panel, selecting a Marker doesn't show any command. Also there is no Python tooltip after hovering over a Marker.

How to achieve this behavior?

$\endgroup$
1
  • $\begingroup$ Do you mean when selecting the marker at the bottom or is it ok if the camera gets selected based on a frame selected? $\endgroup$ Jan 13, 2023 at 13:43

1 Answer 1

1
$\begingroup$

I couldn't find a way to trigger a script when directly clicking the marker, but here is an alternative way when going to a frame in the timeline. For example when you have a camera bound to frame $20$, you can click frame $20$ which would automatically select the corresponding camera:

import bpy

bpy.app.handlers.frame_change_post.clear()

def select_camera_from_marker(scene):
    current_frame = scene.frame_current
    
    for o in bpy.data.objects:
        o.select_set(False)

    for marker in scene.timeline_markers:
        if marker.frame == current_frame:
            scene.camera = bpy.data.objects[marker.camera.name]
            bpy.data.objects[marker.camera.name].select_set(True)
            break

bpy.app.handlers.frame_change_post.append(select_camera_from_marker)
$\endgroup$
6
  • $\begingroup$ Thank you for trying to help me! :) Your script selects camera in the outliner and 3D viewport, but doesn't selecting it in properties editor and the selection made this way don't update 3D View Side Bar parameters to the newly selected camera (I want to use side bar for quicker setting up animations) If you know how to fix that I will be very happy :) ! $\endgroup$
    – evilferber
    Jan 14, 2023 at 7:37
  • $\begingroup$ Hi. Can you show screenshots of the "Properties Editor" and the "3D View Side Bar"? I'm not sure what you mean by those. $\endgroup$ Jan 14, 2023 at 7:53
  • $\begingroup$ pasteboard.co/Xn683R637vjQ.jpg $\endgroup$
    – evilferber
    Jan 14, 2023 at 8:45
  • $\begingroup$ Do you want me to upload on yt short video? Maybe the screenshot and my early morning description of the problem isn't so easy to read :D I really can record ~1 minute video if it could help. $\endgroup$
    – evilferber
    Jan 14, 2023 at 8:53
  • $\begingroup$ sorry im only on blender 3.4. there are no Properties Editor in my version so i can't help you with that. $\endgroup$ Jan 14, 2023 at 12:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .