Difference between revisions of "API"

From Light Forge Wiki
Jump to: navigation, search
(Functions)
(getBPM)
 
(9 intermediate revisions by one user not shown)
Line 22: Line 22:
 
[[api.output]]
 
[[api.output]]
  
=Functions=
+
=Methods=
  
 
==getTime==
 
==getTime==
Line 44: Line 44:
 
print(api.getTime())
 
print(api.getTime())
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
==getBPM==
 +
'''getBPM() As Double'''
 +
 +
Gets the BPM of the current cuelist
 +
 +
Usage:
 +
<syntaxhighlight lang=python>
 +
print(api.getBPM())
 +
</syntaxhighlight>
 +
 
==wait==
 
==wait==
 
'''wait(seconds As Double)'''
 
'''wait(seconds As Double)'''
Line 54: Line 65:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=Events=
+
==isPlaying==
 +
'''isPlaying() As Boolean'''
 +
 
 +
Checks to see if the timeline is currently playing back.
 +
 
 +
Usage:
 +
<syntaxhighlight lang=python>
 +
if(api.isPlaying()):
 +
api.stopPlayback()
 +
</syntaxhighlight>
 +
 
 +
==startPlayback==
 +
'''startPlayback()'''
 +
 
 +
Starts timeline playback.
 +
 
 +
Usage:
 +
<syntaxhighlight lang=python>
 +
if(api.isPlaying() == False):
 +
api.startPlayback()
 +
</syntaxhighlight>
 +
 
 +
==stopPlayback==
 +
'''stopPlayback()'''
 +
 
 +
Stops timeline playback.
 +
 
 +
Usage:
 +
<syntaxhighlight lang=python>
 +
if(api.isPlaying()):
 +
api.stopPlayback()
 +
</syntaxhighlight>
 +
 
 +
==NextCue==
 +
'''nextCue()'''
 +
 
 +
Advances timeline to the next cue.
 +
 
 +
Usage:
 +
<syntaxhighlight lang=python>
 +
api.nextCue()
 +
</syntaxhighlight>
 +
 
 +
==PreviousCue==
 +
'''previousCue()'''
 +
 
 +
Moves timeline to the previous cue.
 +
 
 +
Usage:
 +
<syntaxhighlight lang=python>
 +
api.previousCue()
 +
</syntaxhighlight>
 +
 
 +
=Event Handling=
  
 
==onInitialize==
 
==onInitialize==
Line 60: Line 124:
  
 
Usage:
 
Usage:
  def onInitialize():
+
<syntaxhighlight lang=python>
      print("Script Loaded")
+
def onInitialize():
 +
print("Script Loaded")
 +
</syntaxhighlight>
 +
 
 +
==onDispose==
 +
Called when the script is being disposed by either it being disabled, or by Lightforge closing.
 +
 
 +
Usage:
 +
<syntaxhighlight lang=python>
 +
def onDispose():
 +
print("Addon Disposing")
 +
</syntaxhighlight>
  
 
==onEdit==
 
==onEdit==
Line 67: Line 142:
  
 
Usage:
 
Usage:
  def onEdit():
+
<syntaxhighlight lang=python>
      print("Settings Edit")
+
def onEdit():
 +
print("Settings Edit")
 +
</syntaxhighlight>
  
 
==onExecute==
 
==onExecute==
Line 74: Line 151:
  
 
Usage:
 
Usage:
  def onExecute():
+
<syntaxhighlight lang=python>
      print("Script Executed")
+
def onExecute():
 +
print("Script Executed")
 +
</syntaxhighlight>
  
 
==onExecuteAsync==
 
==onExecuteAsync==
Line 81: Line 160:
  
 
Usage:
 
Usage:
  def onExecuteAsync():
+
<syntaxhighlight lang=python>
      print("Script Executed Asynchronously")
+
def onExecuteAsync():
 +
print("Script Executed Asynchronously")
 +
</syntaxhighlight>
  
 
==onStartup==
 
==onStartup==
Line 88: Line 169:
  
 
Usage:
 
Usage:
  def onStartup():
+
<syntaxhighlight lang=python>
      print("Lightforge Started")
+
def onStartup():
 +
print("Lightforge Started")
 +
</syntaxhighlight>
  
 
==onStartupAsync==
 
==onStartupAsync==
Line 95: Line 178:
  
 
Usage:
 
Usage:
  def onStartupAsync():
+
<syntaxhighlight lang=python>
      print("Lightforge Started (Async)")
+
def onStartupAsync():
 +
print("Lightforge Started (Async)")
 +
</syntaxhighlight>
  
 
==onPlaybackStart==
 
==onPlaybackStart==
Line 102: Line 187:
  
 
Usage:
 
Usage:
  def onPlaybackStart():
+
<syntaxhighlight lang=python>
      print("Playback Started")
+
def onPlaybackStart():
 +
print("Playback Started")
 +
</syntaxhighlight>
  
 
==onPlaybackStop==
 
==onPlaybackStop==
 
Called when timeline playback has stopped
 
Called when timeline playback has stopped
  
Usage:  
+
Usage:
  def onPlaybackStop():
+
<syntaxhighlight lang=python>
      print("Playback Stopped")
+
def onPlaybackStop():
 +
print("Playback Stopped")
 +
</syntaxhighlight>
  
 
==onFrameChange==
 
==onFrameChange==
 
Called on every frame change during playback, scrubbing, and time changes.
 
Called on every frame change during playback, scrubbing, and time changes.
  
Usage:
+
Usage:
  def onFrameChange(seconds As Double):
+
<syntaxhighlight lang=python>
      print("Frame Changed " + seconds)
+
def onFrameChange(seconds As Double):
 +
print("Frame Changed " + seconds)
 +
</syntaxhighlight>
  
 
==onShutdown==
 
==onShutdown==
 
Called when Lightforge is shutting down.
 
Called when Lightforge is shutting down.
  
Usage:
+
Usage:
  def onShutdown():
+
<syntaxhighlight lang=python>
      print("Lightforge Shutdown")
+
def onShutdown():
 +
print("Lightforge Shutdown")
 +
</syntaxhighlight>
  
==onCuelistChanged==
+
==onCuelistChange==
 
Called when the current cuelist has been changed.
 
Called when the current cuelist has been changed.
  
 
Usage:
 
Usage:
  def onCuelistChanged():
+
<syntaxhighlight lang=python>
      print("Cue List Changed")
+
def onCuelistChange():
 +
print("Cue List Changed")
 +
</syntaxhighlight>
  
 
==onShowLoaded==
 
==onShowLoaded==
Line 137: Line 232:
  
 
Usage:
 
Usage:
  def onShowLoaded():
+
<syntaxhighlight lang=python>
      print("Show Loaded")
+
def onShowLoaded():
 +
print("Show Loaded")
 +
</syntaxhighlight>

Latest revision as of 14:45, 15 June 2013

Contents

[edit] Types

[edit] api.attributeTypes

api.attributeTypes


[edit] Classes

[edit] api.cues

Used for working with cues.

api.cues

[edit] api.groups

Used for working with groups.

api.groups

[edit] api.output

Used for getting information about DMX output.

api.output

[edit] Methods

[edit] getTime

getTime() As Double

Gets the current playback position.

Usage:

print(api.getTime())

[edit] setTime

setTime(time As Double)

Sets the current playback position to the specified time.

Usage:

api.setTime(36.5)
print(api.getTime())

[edit] getBPM

getBPM() As Double

Gets the BPM of the current cuelist

Usage:

print(api.getBPM())

[edit] wait

wait(seconds As Double)

Causes execution to wait for the specified number of seconds.

Usage:

api.wait(3.5)

[edit] isPlaying

isPlaying() As Boolean

Checks to see if the timeline is currently playing back.

Usage:

if(api.isPlaying()):
	api.stopPlayback()

[edit] startPlayback

startPlayback()

Starts timeline playback.

Usage:

if(api.isPlaying() == False):
	api.startPlayback()

[edit] stopPlayback

stopPlayback()

Stops timeline playback.

Usage:

if(api.isPlaying()):
	api.stopPlayback()

[edit] NextCue

nextCue()

Advances timeline to the next cue.

Usage:

api.nextCue()

[edit] PreviousCue

previousCue()

Moves timeline to the previous cue.

Usage:

api.previousCue()

[edit] Event Handling

[edit] onInitialize

Called when the script is loaded.

Usage:

def onInitialize():
	print("Script Loaded")

[edit] onDispose

Called when the script is being disposed by either it being disabled, or by Lightforge closing.

Usage:

def onDispose():
	print("Addon Disposing")

[edit] onEdit

Called when the script settings are being edited. Editing a script's settings from the Script Settings Dialog is only possible if this function is implemented in your code.

Usage:

def onEdit():
	print("Settings Edit")

[edit] onExecute

Called when this script is specifically executed.

Usage:

def onExecute():
	print("Script Executed")

[edit] onExecuteAsync

Called when this script is specifically executed. Code run from this function is executed asynchronously.

Usage:

def onExecuteAsync():
	print("Script Executed Asynchronously")

[edit] onStartup

Called when Lightforge starts up.

Usage:

def onStartup():
	print("Lightforge Started")

[edit] onStartupAsync

Called when Lightforge starts up. Code run from this function is executed asynchronously.

Usage:

def onStartupAsync():
	print("Lightforge Started (Async)")

[edit] onPlaybackStart

Called when timeline playback has started.

Usage:

def onPlaybackStart():
	print("Playback Started")

[edit] onPlaybackStop

Called when timeline playback has stopped

Usage:

def onPlaybackStop():
	print("Playback Stopped")

[edit] onFrameChange

Called on every frame change during playback, scrubbing, and time changes.

Usage:

def onFrameChange(seconds As Double):
	print("Frame Changed " + seconds)

[edit] onShutdown

Called when Lightforge is shutting down.

Usage:

 
def onShutdown():
	print("Lightforge Shutdown")

[edit] onCuelistChange

Called when the current cuelist has been changed.

Usage:

def onCuelistChange():
	print("Cue List Changed")

[edit] onShowLoaded

Called when a new show has been loaded.

Usage:

def onShowLoaded():
	print("Show Loaded")
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox