I know with ctrl + middle mouse button I can view vertical zoom , but how do I do this in python?

Zoom vertically

  • 1
    To be able to view the current settings, this needs to be done without operators. For the 3d view, this information is held in, and can be set from 'context.area.spaces[0].region_3d' , but the space for the sequencer seems to have no equivalent. – Snu Oct 23 at 0:37

I guess that it is somehow connected to "bpy.ops.sequencer.view_ghost_border", but nothing happens when using that function(Click the "Zoom Y " button in the sequencer header menu):

import bpy

def MyFunction(context):
    if not bpy.context.scene.sequence_editor: #create sequence, if missing
        bpy.context.scene.sequence_editor_create()  

    bpy.ops.sequencer.view_ghost_border(gesture_mode=0, xmin=0, xmax=200, ymin=0, ymax=200)

class MyOperator(bpy.types.Operator): 
    '''Tooltip for MyOperator'''
    bl_idname = "object.my_operator"  
    bl_label = "My Operator" 
    bl_options = {"REGISTER", "UNDO"} 

    @classmethod
    def poll(cls, context): 
        if context.object != None: 
            return context.object.select
        return False

    def execute(self, context):

        MyFunction(context)
        return {'FINISHED'}

    def invoke(self, context, event): 
        return self.execute(context)

def menu_draw(self, context):

    self.layout.operator(MyOperator.bl_idname, "Zoom Y") 

def register():
    bpy.utils.register_module(__name__) 
    bpy.types.SEQUENCER_HT_header.append(menu_draw) 

def unregister():
    bpy.types.VIEW3D_MT_object.remove(menu_draw) 
    bpy.utils.unregister_module(__name__)

if __name__ == '__main__': 
    register()

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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