mirror of
https://github.com/iluvcapra/pycmx.git
synced 2025-12-31 17:00:53 +00:00
Expose TC and transitions on class
This commit is contained in:
@@ -54,10 +54,36 @@ class Edit:
|
||||
self.clip_name_statement = clip_name_statement
|
||||
self.source_file_statement = source_file_statement
|
||||
|
||||
@property
|
||||
def transition(self):
|
||||
return Transition(self.edit_statement.trans, self.edit_statement.trans_op)
|
||||
|
||||
@property
|
||||
def source_in(self):
|
||||
return self.edit_statement.source_in
|
||||
|
||||
@property
|
||||
def source_out(self):
|
||||
return self.edit_statement.source_out
|
||||
|
||||
@property
|
||||
def record_in(self):
|
||||
return self.edit_statement.record_in
|
||||
|
||||
@property
|
||||
def record_out(self):
|
||||
return self.edit_statement.record_out
|
||||
|
||||
@property
|
||||
def source(self):
|
||||
return self.edit_statement.source
|
||||
|
||||
|
||||
@property
|
||||
def source_file(self):
|
||||
return self.source_file_statement.filename
|
||||
|
||||
|
||||
@property
|
||||
def clip_name(self):
|
||||
if self.clip_name_statement != None:
|
||||
@@ -129,5 +155,85 @@ class Event:
|
||||
|
||||
|
||||
|
||||
|
||||
class Transition:
|
||||
"""Represents a CMX transition, a wipe, dissolve or cut."""
|
||||
|
||||
Cut = "C"
|
||||
Dissolve = "D"
|
||||
Wipe = "W"
|
||||
KeyBackground = "KB"
|
||||
Key = "K"
|
||||
KeyOut = "KO"
|
||||
|
||||
def __init__(self, transition, operand):
|
||||
self.transition = transition
|
||||
self.operand = operand
|
||||
self.name = ''
|
||||
|
||||
|
||||
@property
|
||||
def kind(self):
|
||||
if self.cut:
|
||||
return Transition.Cut
|
||||
elif self.dissolve:
|
||||
return Transition.Dissolve
|
||||
elif self.wipe:
|
||||
return Transition.Wipe
|
||||
elif self.key_background:
|
||||
return Transition.KeyBackground
|
||||
elif self.key_foreground:
|
||||
return Transition.Key
|
||||
elif self.key_out:
|
||||
return Transition.KeyOut
|
||||
|
||||
@property
|
||||
def cut(self):
|
||||
"`True` if this transition is a cut."
|
||||
return self.transition == 'C'
|
||||
|
||||
@property
|
||||
def dissolve(self):
|
||||
"`True` if this traansition is a dissolve."
|
||||
return self.transition == 'D'
|
||||
|
||||
|
||||
@property
|
||||
def wipe(self):
|
||||
"`True` if this transition is a wipe."
|
||||
return self.transition.startswith('W')
|
||||
|
||||
|
||||
@property
|
||||
def effect_duration(self):
|
||||
""""`The duration of this transition, in frames of the record target.
|
||||
|
||||
In the event of a key event, this is the duration of the fade in.
|
||||
"""
|
||||
return int(self.operand)
|
||||
|
||||
@property
|
||||
def wipe_number(self):
|
||||
"Wipes are identified by a particular number."
|
||||
if self.wipe:
|
||||
return int(self.transition[1:])
|
||||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def key_background(self):
|
||||
"`True` if this is a key background event."
|
||||
return self.transition == KeyBackground
|
||||
|
||||
@property
|
||||
def key_foreground(self):
|
||||
"`True` if this is a key foreground event."
|
||||
return self.transition == Key
|
||||
|
||||
@property
|
||||
def key_out(self):
|
||||
"`True` if this is a key out event."
|
||||
return self.transition == KeyOut
|
||||
|
||||
def __repr__(self):
|
||||
return f"""CmxTransition(transition={self.transition.__repr__()},operand={self.operand.__repr__()})"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user