I'm working on a script which should add a trim mode to the sequencer. The preview area is split into two preview areas, until the trimming has finished and the two areas are joined again, but I can't figure out how to get the values needed for the area_join function right. How do I get the script to join the two areas into one area again?
Some example code:
import bpy
original_area = bpy.context.area
for region in original_area.regions:
print(region.type)
if region.type == 'WINDOW':
old_area_x=region.x
old_area_y=region.y
start_areas = bpy.context.screen.areas[:]
bpy.ops.screen.area_split(direction='VERTICAL', factor=0.5) # Split
#[Here things will happen(modal trimming) in the two preview areas before they will be joined into one again]
for area in bpy.context.screen.areas:
if area not in start_areas:
new_area=area
for region in new_area.regions:
print(region.type)
if region.type == 'WINDOW':
new_area_x=region.x + region.width
new_area_y=region.y + region.height
print("ox "+str(old_area_x))
print("oy "+str(old_area_y))
print("nx "+str(new_area_x))
print("ny "+str(new_area_y))
# I'm not sure I understand these values right?
bpy.ops.screen.area_join(min_x=old_area_x, min_y=old_area_y, max_x=new_area_x, max_y=new_area_y) #Join - not working
A few words on what I need this function for: https://blenderartists.org/t/wip-vse-quick-functions-snaps-fades-zoom-parenting-titling-play-speed/611831/93