Difference between revisions of "Silhouette Module Reference"
Jump to navigation
Jump to search
(38 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== The fx Module == | == The fx Module == | ||
− | All of Silhouette's built-in functions are defined in the <tt>fx</tt> module. The easiest way to make use of the module is to use the Python statement <tt>from fx import *</tt>. | + | All of Silhouette's built-in functions are defined in the <tt>fx</tt> module. The easiest way to make use of the module is to use the Python statement <tt>from fx import *</tt>. When using the interactive console, the <tt>fx</tt> module is imported automatically. |
− | === | + | === Attributes === |
+ | ''These attributes are read-only.'' | ||
{| class="wikitable" | {| class="wikitable" | ||
! scope="col" | Name | ! scope="col" | Name | ||
! scope="col" class="unsortable" | Description | ! scope="col" class="unsortable" | Description | ||
+ | ! scope="col" | Added | ||
|- | |- | ||
− | |action(name) | + | |actions |
+ | |The List of [[Action|Actions]] | ||
+ | |- | ||
+ | |globals | ||
+ | |A Dictionary to place runtime-only global values | ||
+ | |5.2 | ||
+ | |- | ||
+ | |gui | ||
+ | |True if running in the GUI, False from the command-line | ||
+ | |- | ||
+ | |hooks | ||
+ | |The List of [[Scripting Guide#Hooks|Hooks]] | ||
+ | |- | ||
+ | |io_modules | ||
+ | |The List of [[IOHandler|IO Handlers]] | ||
+ | |- | ||
+ | |paint | ||
+ | |The global [[Paint]] object | ||
+ | |- | ||
+ | |player | ||
+ | |The global [[Player]] object | ||
+ | |- | ||
+ | |prefs | ||
+ | |The [[Preferences]] map | ||
+ | |- | ||
+ | |sfxcmd | ||
+ | |The path to the command-line rendering utility | ||
+ | |5.1 | ||
+ | |- | ||
+ | |version | ||
+ | |The Silhouette version as a float (major.minor) | ||
+ | |- | ||
+ | |viewer | ||
+ | |The global [[Viewer]] object. | ||
+ | |- | ||
+ | |contentResolvers | ||
+ | |the list of registered [[Content Resolvers]] | ||
+ | |7.0 | ||
+ | |- | ||
+ | |ui | ||
+ | |UI binding object for [[PySide]] | ||
+ | |7.0 | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | === Functions === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! scope="col" | Name | ||
+ | ! scope="col" class="unsortable" | Description | ||
+ | | scope="col" | Added | ||
+ | |- | ||
+ | |action(name) | ||
+ | |Returns the [[Action]] with the given name | ||
|- | |- | ||
|activeLayer()||Return the active [[Layer]], or None | |activeLayer()||Return the active [[Layer]], or None | ||
Line 20: | Line 75: | ||
|- | |- | ||
|addAction(action)||Add a new [[Action]] to the action list | |addAction(action)||Add a new [[Action]] to the action list | ||
+ | |- | ||
+ | |askQuestion(text, title=None, okText='OK', cancelText='Cancel')||Display a Question Dialog and return True if the 'ok' button is pressed. | ||
+ | |- | ||
+ | |beginUndo(label)||Begin an undo block. Must be followed up with endUndo(). | ||
+ | |- | ||
+ | |bind(key, function)||Bind the key to a function. | ||
+ | |- | ||
+ | |buildPath(path)||Parse and return a path with automatic variable expansion | ||
+ | |- | ||
+ | |cut(objects)||Cut the objects into the Clipboard (same as Edit->Cut) | ||
+ | |- | ||
+ | |copy(objects)||Copy the objects into the Clipboard (same as Edit->Copy) | ||
+ | |- | ||
+ | |delete(objects)||Delete the objects (same as Edit->Delete) | ||
+ | |- | ||
+ | |displayError(msg, title=None)||Display an Error Dialog | ||
+ | |- | ||
+ | |displayInformation(msg, title=None)||Display an Information Dialog | ||
+ | |- | ||
+ | |displayWarning(msg, title=None)||Display a Warning Dialog | ||
+ | |- | ||
+ | |endUndo()||End an undo block. | ||
+ | |- | ||
+ | |getBind(key)||Return the function or control name the key is bound to, or None. | ||
+ | |- | ||
+ | |getInput(...)||Open an input dialog with support for various input widgets (see [[InputDialog]]) | ||
+ | |- | ||
+ | |getLog()||Return the complete text of the log. | ||
+ | |- | ||
+ | |log(text)||Add text to the log. | ||
+ | |- | ||
+ | |mediaFormats()||Return the List of installed [[MediaFormat|Media Format]] names. | ||
+ | |- | ||
+ | |select(objects)||Select the object List. | ||
+ | |- | ||
+ | |selection()||Return the selection List. | ||
+ | |- | ||
+ | |setActiveLayer(layer)||Sets the active [[Layer]], or None. | ||
+ | |- | ||
+ | |showView(view, visible=True)||Shows (or hides) the view by name | ||
+ | |- | ||
+ | |status(text)||Display the text in the status bar. | ||
+ | |- | ||
+ | |unbind(key)||Unbind the key from its function. | ||
+ | |- | ||
+ | |uniqueLabel(label)||Returns a project-wide unique version of the label, appending a number if necessary. | ||
+ | |- | ||
+ | |viewVisible(view)||Returns True if view is visible. | ||
+ | |- | ||
+ | |setWorkspace(name)||sets the current workspace with the one identified by name.||6.0 | ||
+ | |- | ||
+ | |activate(object)||activates the specified object, which can be a [[Node]], [[Session]], [[Source]], or [[Project]]||7.0 | ||
+ | |- | ||
+ | |addContentResolver(resolver)||add a new [[Content Resolver]] to the list of resolvers||7.0 | ||
+ | |- | ||
+ | |resolvePath(path, args=None)||uses the [[Content Resolvers|Content Resolver System]] to resolve the path||7.0 | ||
+ | |} | ||
+ | |||
+ | === Constants === | ||
+ | |||
+ | ==== Blend Mode ==== | ||
+ | {| class="wikitable" | ||
+ | ! scope="col" | Name | ||
+ | ! scope="col" class="unsortable" | Description | ||
+ | |- | ||
+ | |Blend_Add | ||
+ | |'''Add''' blend mode | ||
+ | |- | ||
+ | |Blend_Subtract | ||
+ | |'''Subtract''' blend mode | ||
+ | |- | ||
+ | |Blend_Multiply | ||
+ | |'''Multiply''' blend mode | ||
+ | |- | ||
+ | |Blend_XOR | ||
+ | |'''XOR''' blend mode | ||
+ | |} | ||
+ | |||
+ | ==== Blur Mode ==== | ||
+ | {| class="wikitable" | ||
+ | ! scope="col" | Name | ||
+ | ! scope="col" class="unsortable" | Description | ||
+ | |- | ||
+ | |Blur_Centered | ||
+ | |Normal blur centered on the edge | ||
+ | |- | ||
+ | |Blur_Inner | ||
+ | |Blur on the inside of the edge | ||
+ | |- | ||
+ | |Blur_Outer | ||
+ | |Blur on the outside of the edge | ||
+ | |} | ||
+ | |||
+ | ==== Depth ==== | ||
+ | {| class="wikitable" | ||
+ | ! scope="col" | Name | ||
+ | ! scope="col" class="unsortable" | Description | ||
+ | |- | ||
+ | |Depth_Default | ||
+ | |The preferred depth (based on the [[Session]] depth) | ||
+ | |- | ||
+ | |Depth_8 | ||
+ | |8 bits per component | ||
+ | |- | ||
+ | |Depth_Float16 | ||
+ | |16 bit half-float per component | ||
+ | |- | ||
+ | |Depth_Float32 | ||
+ | |32 bit float per component | ||
|} | |} | ||
− | === | + | ==== Modifier ==== |
+ | {| class="wikitable" | ||
+ | ! scope="col" | Name | ||
+ | ! scope="col" class="unsortable" | Description | ||
+ | |- | ||
+ | |ShiftModifier | ||
+ | |Modifier flag for the '''Shift''' key | ||
+ | |- | ||
+ | |ControlModifier | ||
+ | |Modifier flag for the '''Control''' key | ||
+ | |- | ||
+ | |AltModifier | ||
+ | |Modifier flag for the '''Alt''' key | ||
+ | |} | ||
+ | |||
+ | ==== Stream ==== | ||
+ | {| class="wikitable" | ||
+ | ! scope="col" | Name | ||
+ | ! scope="col" class="unsortable" | Description | ||
+ | |- | ||
+ | |Stream_Left | ||
+ | |Stream index for the '''Left''' view | ||
+ | |- | ||
+ | |Stream_Right | ||
+ | |Stream index for the '''Right''' view | ||
+ | |- | ||
+ | |Stream_Depth | ||
+ | |Stream index for the '''Depth''' view | ||
+ | |} | ||
+ | |||
+ | ==== Stream Mask ==== | ||
+ | {| class="wikitable" | ||
+ | ! scope="col" | Name | ||
+ | ! scope="col" class="unsortable" | Description | ||
+ | |- | ||
+ | |StreamMask_Left | ||
+ | |Stream mask for the '''Left''' view | ||
+ | |- | ||
+ | |StreamMask_Right | ||
+ | |Stream mask for the '''Right''' view | ||
+ | |- | ||
+ | |StreamMask_Depth | ||
+ | |Stream mask for the '''Depth''' view | ||
+ | |} | ||
== fx Objects == | == fx Objects == | ||
Line 28: | Line 235: | ||
! scope="col" | Name | ! scope="col" | Name | ||
! scope="col" class="unsortable" | Description | ! scope="col" class="unsortable" | Description | ||
+ | ! scope="col" | Added | ||
+ | |- | ||
+ | |[[Action]] | ||
+ | |Base class for Actions | ||
+ | |- | ||
+ | |[[Color]] | ||
+ | |An RGBA color | ||
+ | |- | ||
+ | |[[Content Resolvers|Content Resolver]] | ||
+ | |A content resolver | ||
+ | |7.0 | ||
+ | |- | ||
+ | |[[Item]] | ||
+ | |A project item | ||
+ | |- | ||
+ | |[[IOHandler]] | ||
+ | |A data I/O handler | ||
+ | |- | ||
+ | |[[Layer]] | ||
+ | |A layer | ||
+ | |- | ||
+ | |[[Matrix]] | ||
+ | |A 4x4 Matrix | ||
+ | |- | ||
+ | |[[MediaFormat]] | ||
+ | |Information about a media I/O module | ||
+ | |- | ||
+ | |[[MultiViewObject]] | ||
+ | |Base class of objects that can exist on specific [[#Stream Type Constants|streams]] | ||
+ | |- | ||
+ | |[[Node]] | ||
+ | |A node | ||
+ | |- | ||
+ | |[[Object]] | ||
+ | |Base class for all object-model objects | ||
+ | |- | ||
+ | |[[Pipe]] | ||
+ | |A pipe, used to connect [[Node|Nodes]] together | ||
+ | |- | ||
+ | |[[Point3D]] | ||
+ | |A 3D point | ||
+ | |- | ||
+ | |[[Port]] | ||
+ | |A port, used to bind [[Pipe|Pipes]] to [[Property|Properties]] | ||
+ | |- | ||
+ | |[[Preferences]] | ||
+ | |The preferences object | ||
+ | |- | ||
+ | |[[Project]] | ||
+ | |A project, a container of [[Item|Items]] | ||
+ | |- | ||
+ | |[[Property]] | ||
+ | |A property/parameter | ||
+ | |- | ||
+ | |[[Raster]] | ||
+ | |A image buffer | ||
+ | |6.0 | ||
+ | |- | ||
+ | |[[Rect]] | ||
+ | |A 2D floating-point rectangle | ||
+ | |- | ||
+ | |[[Recti]] | ||
+ | |A 2D integer rectangle | ||
+ | |5.2 | ||
+ | |- | ||
+ | |[[RenderDialog]] | ||
+ | |A rendering dialog | ||
+ | |- | ||
+ | |[[Session]] | ||
+ | |A session, containing [[Node|Nodes]] | ||
+ | |- | ||
+ | |[[Shape]] | ||
+ | |A shape | ||
+ | |- | ||
+ | |[[ShapeEditor]] | ||
+ | |A shape editor | ||
+ | |7.0 | ||
+ | |- | ||
+ | |[[ShapePath]] | ||
+ | |A shape path (one key of shape data) | ||
+ | |- | ||
+ | |[[Source]] | ||
+ | |A file source | ||
|- | |- | ||
− | |[[ | + | |[[StereoscopicObject]] |
+ | |Base class of objects that can have ''stereoscopic links'' between the left and right streams of a stereoscopic sequence | ||
|- | |- | ||
− | |[[ | + | |[[Tracker]] |
+ | |A point tracker | ||
|} | |} |
Latest revision as of 15:21, 26 July 2018
Contents
The fx Module
All of Silhouette's built-in functions are defined in the fx module. The easiest way to make use of the module is to use the Python statement from fx import *. When using the interactive console, the fx module is imported automatically.
Attributes
These attributes are read-only.
Name | Description | Added |
---|---|---|
actions | The List of Actions | |
globals | A Dictionary to place runtime-only global values | 5.2 |
gui | True if running in the GUI, False from the command-line | |
hooks | The List of Hooks | |
io_modules | The List of IO Handlers | |
paint | The global Paint object | |
player | The global Player object | |
prefs | The Preferences map | |
sfxcmd | The path to the command-line rendering utility | 5.1 |
version | The Silhouette version as a float (major.minor) | |
viewer | The global Viewer object. | |
contentResolvers | the list of registered Content Resolvers | 7.0 |
ui | UI binding object for PySide | 7.0 |
Functions
Name | Description | Added |
---|---|---|
action(name) | Returns the Action with the given name | |
activeLayer() | Return the active Layer, or None | |
activeNode() | Return the active Node, or None | |
activeProject() | Return the active Project, or None | |
activeSession() | Return the active Session, or None | |
addAction(action) | Add a new Action to the action list | |
askQuestion(text, title=None, okText='OK', cancelText='Cancel') | Display a Question Dialog and return True if the 'ok' button is pressed. | |
beginUndo(label) | Begin an undo block. Must be followed up with endUndo(). | |
bind(key, function) | Bind the key to a function. | |
buildPath(path) | Parse and return a path with automatic variable expansion | |
cut(objects) | Cut the objects into the Clipboard (same as Edit->Cut) | |
copy(objects) | Copy the objects into the Clipboard (same as Edit->Copy) | |
delete(objects) | Delete the objects (same as Edit->Delete) | |
displayError(msg, title=None) | Display an Error Dialog | |
displayInformation(msg, title=None) | Display an Information Dialog | |
displayWarning(msg, title=None) | Display a Warning Dialog | |
endUndo() | End an undo block. | |
getBind(key) | Return the function or control name the key is bound to, or None. | |
getInput(...) | Open an input dialog with support for various input widgets (see InputDialog) | |
getLog() | Return the complete text of the log. | |
log(text) | Add text to the log. | |
mediaFormats() | Return the List of installed Media Format names. | |
select(objects) | Select the object List. | |
selection() | Return the selection List. | |
setActiveLayer(layer) | Sets the active Layer, or None. | |
showView(view, visible=True) | Shows (or hides) the view by name | |
status(text) | Display the text in the status bar. | |
unbind(key) | Unbind the key from its function. | |
uniqueLabel(label) | Returns a project-wide unique version of the label, appending a number if necessary. | |
viewVisible(view) | Returns True if view is visible. | |
setWorkspace(name) | sets the current workspace with the one identified by name. | 6.0 |
activate(object) | activates the specified object, which can be a Node, Session, Source, or Project | 7.0 |
addContentResolver(resolver) | add a new Content Resolver to the list of resolvers | 7.0 |
resolvePath(path, args=None) | uses the Content Resolver System to resolve the path | 7.0 |
Constants
Blend Mode
Name | Description |
---|---|
Blend_Add | Add blend mode |
Blend_Subtract | Subtract blend mode |
Blend_Multiply | Multiply blend mode |
Blend_XOR | XOR blend mode |
Blur Mode
Name | Description |
---|---|
Blur_Centered | Normal blur centered on the edge |
Blur_Inner | Blur on the inside of the edge |
Blur_Outer | Blur on the outside of the edge |
Depth
Name | Description |
---|---|
Depth_Default | The preferred depth (based on the Session depth) |
Depth_8 | 8 bits per component |
Depth_Float16 | 16 bit half-float per component |
Depth_Float32 | 32 bit float per component |
Modifier
Name | Description |
---|---|
ShiftModifier | Modifier flag for the Shift key |
ControlModifier | Modifier flag for the Control key |
AltModifier | Modifier flag for the Alt key |
Stream
Name | Description |
---|---|
Stream_Left | Stream index for the Left view |
Stream_Right | Stream index for the Right view |
Stream_Depth | Stream index for the Depth view |
Stream Mask
Name | Description |
---|---|
StreamMask_Left | Stream mask for the Left view |
StreamMask_Right | Stream mask for the Right view |
StreamMask_Depth | Stream mask for the Depth view |
fx Objects
Name | Description | Added |
---|---|---|
Action | Base class for Actions | |
Color | An RGBA color | |
Content Resolver | A content resolver | 7.0 |
Item | A project item | |
IOHandler | A data I/O handler | |
Layer | A layer | |
Matrix | A 4x4 Matrix | |
MediaFormat | Information about a media I/O module | |
MultiViewObject | Base class of objects that can exist on specific streams | |
Node | A node | |
Object | Base class for all object-model objects | |
Pipe | A pipe, used to connect Nodes together | |
Point3D | A 3D point | |
Port | A port, used to bind Pipes to Properties | |
Preferences | The preferences object | |
Project | A project, a container of Items | |
Property | A property/parameter | |
Raster | A image buffer | 6.0 |
Rect | A 2D floating-point rectangle | |
Recti | A 2D integer rectangle | 5.2 |
RenderDialog | A rendering dialog | |
Session | A session, containing Nodes | |
Shape | A shape | |
ShapeEditor | A shape editor | 7.0 |
ShapePath | A shape path (one key of shape data) | |
Source | A file source | |
StereoscopicObject | Base class of objects that can have stereoscopic links between the left and right streams of a stereoscopic sequence | |
Tracker | A point tracker |