Difference between revisions of "Source"

From Silhouette Wiki
Jump to navigation Jump to search
Line 39: Line 39:
 
|generate the path to the desired frame of media
 
|generate the path to the desired frame of media
 
|}
 
|}
 +
 +
=== Creating Sources ===
 +
<tt>tools.sequenceBuilder</tt> contains the <tt>SequenceBuilder</tt> class which can be used to parse a filename and generate details such as start and end frames. <tt>path</tt> should be a frame from a numbered sequence and <tt>SequenceBuilder</tt> will find the start and end frames and construct a resulting path with the frame range built-in, suitable for constructing Sources from, in the form: <b>/path/to/file.[start-end].ext</b>.
 +
 +
<source lang="python" enclose>
 +
from tools.sequenceBuilder import SequenceBuilder
 +
 +
# the image sequence has frames 1-999
 +
path = "/images/sequence.0001.exr"
 +
 +
builder = SequenceBuilder(path)
 +
for f in range(0, builder.frames):
 +
    print builder.build(f)
 +
 +
# construct Sources using self.path, which has the frame range included
 +
source = Source(builder.path)
 +
 +
print builder.path
 +
 +
</source>
 +
 +
This prints out <b>/images/sequence.[0001-0999].exr</b>.
 +
 +
=== Adding Sources ===
 +
Sources can be added to the Project with the <tt>Project.addItem()</tt> method.

Revision as of 15:31, 25 July 2018

The Source object represents a media file.

Attributes

Attributes are read-only except where noted.

Name Description
audio True if the source has audio
defaultStream the default stream
fieldDominance the field dominance setting
fieldHandling the field handling setting
key the source's image cache key
streamMask the streams the source produces
video True if the source has video

Methods

Name Description
path(frame) generate the path to the desired frame of media

Creating Sources

tools.sequenceBuilder contains the SequenceBuilder class which can be used to parse a filename and generate details such as start and end frames. path should be a frame from a numbered sequence and SequenceBuilder will find the start and end frames and construct a resulting path with the frame range built-in, suitable for constructing Sources from, in the form: /path/to/file.[start-end].ext.

from tools.sequenceBuilder import SequenceBuilder

# the image sequence has frames 1-999
path = "/images/sequence.0001.exr"

builder = SequenceBuilder(path)
for f in range(0, builder.frames):
    print builder.build(f)

# construct Sources using self.path, which has the frame range included
source = Source(builder.path)

print builder.path

This prints out /images/sequence.[0001-0999].exr.

Adding Sources

Sources can be added to the Project with the Project.addItem() method.