VEGASPython for Developers

Introduction

VEGAS Pro allows the control of the application via scripting. Scripting provides access to the internal data structures in VEGAS projects that allows you to automate things that you might normally do via the GUI. VEGAS uses the .NET framework to provide its scripting interface. VEGAS can execute C#, JScript, and Visual Basic script files directly.

PYTHON is an easy to learn powerful programming language that is more and more used for scripting of applications. In the 3D and video editing area some application use already PYTHON for scripting.

Goal of this VEGAS extension is to provide an easy access to VEGAS scripting using PYTHON.

The extension provides two options:

  • an interactive dockable VEGASPython Window
  • executing Scripts located in a specific folder and integrate them into the VEGAS User Interface like other C# Scripts

Download and Installation

Usage

Usage description Page

How can you use VEGASPython and start writing VEGASPython scripts

Python Scripts

VEGASPython Tutorial

Vegas Python Tutorial

With this tutorial I would like to provide for beginners the know-how to write scripts using VEGASPython. This includes an introduction to Python progamming and to the main concepts of the VEGAS interface.

VEGASPython Scripting FAQ: (adaption of VEGAS scripting FAQ for VEGASPython) VEGASPython FAQ

VEGAS Scripting FAQ: direct link vegas_scripting_faq.zip

The FAQ describes the usage of VEGAS scriting for C#. The examples can be easily transfered to VEGASPython. An updated FAQ for VEGASPython will follow soon.

VEGAS Scripting API: direct link vegas_scripting_api.zip

The API describes the C# definition of all VEGAS structures and items that can be accessed. All these items can be accessed in the same way in VEGASPython.

Sony VEGAS SDK: direct link to Sony VEGAS Pro SDK

VEGAS Pro Tools for developers: VEGAS Tools for Developers

PYTHON documentation: PYTHON 2.7 documentation

PYTHON Tutorials: PYTHON 2.7 tutorial

PythonNet Website: Pythonnet

VEGASPython Interactive Window

VEGASPython includes an interactive window. VEGASPython interactive window is activated via the 'View' / 'Extensions' tab.

A VEGAS dockable window opens. The window can float over VEGAS or can be integrated into the VEGAS layout as any other VEGAS window.

The VEGASPython window shows two textboxes:

  • Input PYTHON Commands
  • Output

and a menu with two items „File“ and „Execute VEGASPython Script“.

Python comands are entered in the textbox „Input“. Several lines can be entered one after each other. It is possible to copy a complete PYTHON Script from another editor via CTRL+C and CTRL+V. The PYTHON commands will be executed by clicking on the menu „Execute VEGASPython Script“.

All output from PYTHON print statements and all error messages will be shown in the „Output“ textbox.

VEGASPython is based on Python 3.7.3 and PythonNet.

The VEGAS API can be accessed directly by using the build-in variable „pyVEGAS“. All VEGAS API items are available.

Examples

Example for a simple script that can be used in the interactive window:

  import clr
  clr.AddReference('ScriptPortal.Vegas')
  import ScriptPortal.Vegas
  from ScriptPortal.Vegas import *
  # adapt this value to your needs
  maxLength = Timecode.FromString("00:00:04:00")
  # Go through the list of Tracks
  for track in pyVEGAS.Project.Tracks:
      for evnt in track.Events:
          if (evnt.Selected):
              dLength = evnt.Length
              if dLength > maxLength:
                  dLength = maxLength
              dStart = evnt.Start
              evnt.AdjustStartLength(dStart, dLength, True)

A script that is used as an extension needs to be included in a function FromVegas. See example below.

  import clr
  clr.AddReference('ScriptPortal.Vegas')
  import ScriptPortal.Vegas
  from ScriptPortal.Vegas import *
  def FromVegas(pyVEGAS):
      # adapt this value to your needs
      maxLength = Timecode.FromString("00:00:04:00")
      # Go through the list of Tracks
      for track in pyVEGAS.Project.Tracks:
          for evnt in track.Events:
              if (evnt.Selected):
                  dLength = evnt.Length
                  if dLength > maxLength:
                      dLength = maxLength
                  dStart = evnt.Start
                  evnt.AdjustStartLength(dStart, dLength, True)

Debugging Support

VEGASPython support the debugging of the Python scrips. See following page: VEGAS Python Debugging

VEGASPython Source Code

VEGASPython is open source with the BSD-3-clause license.

You can find the source code on gitbub:

https://github.com/haroldlinke/VEGASPython


QR-Code
QR-Code en:vegas_python_dev (erstellt für aktuelle Seite)