2
$\begingroup$

i made a small python script, it creates 2 markers see below. All i want is to be able to select 2 markers as we can do on screen

Also this script flips the coding text pannel into graph editor i wonder if it is possible to use the allready opened graph editor?

ob = bpy.context.active_object
frame_num = 30

bpy.context.scene.frame_set(frame_num)
selected = bpy.context.selected_objects
scene = bpy.context.scene

bpy.context.area.type = 'GRAPH_EDITOR'
#add marker
bpy.ops.marker.add()
bpy.ops.marker.rename(name= "start" )

frame_end = frame_num + 20

bpy.context.scene.frame_set(frame_end)

bpy.ops.marker.add()
bpy.ops.marker.rename(name= "end" )
bpy.ops.marker.select()
bpy.context.scene.frame_set(frame_num)
bpy.ops.marker.select(extend=True )    #it doesnt work to add to marker selection
$\endgroup$
1
$\begingroup$

Can do this without the operators

import bpy
from bpy import context

scene = context.scene

start_marker = scene.timeline_markers.new("start") # make a new marker
start_marker.frame = scene.frame_start # set a frame
start_marker.select = True # set selected
end_marker = scene.timeline_markers.new("end")
end_marker.frame = scene.frame_end
end_marker.select = True

# get a marker
marker = scene.timeline_markers.get("start")
if marker:
    print(marker.name, marker.frame, marker.select)
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.