2.15. Project¶
2.15.1. Synopsis¶
2.15.1.1. Functions¶
def
__eq__(rhs)def
__ne__(rhs)def
add_clip(detached_clip, clip_name)def
add_group([name=Project.tr( “New group” )[, layers=list()]])def
add_layer(clip[, name=Project.tr( “New layer” )[, frame_number=0[, view=0]]])def
export_rendered_shapes(layers, colorizeOutput, directory, extension, prefix, suffix, index_start, index_finish[, index_width=1[, views=list()[, separate_streams=false[, offset=0]]]])def
find_groups(name)def
find_layers(name)def
get_output_dir()def
layer(layer_index)def
new_output_clip(input_clip, clip_name)def
parameter(name_components)def
parameter_set([name_components=list()])def
render(operation, start_index, stop_index[, layers=list()[, view=View(0)[, step=0]]])def
save()def
save_as(file)def
set_output_dir(path[, validate=false])def
track_layers([start_index=0[, stop_index=UINT_MAX[, layers=list()[, views=list()]]]])def
undo_group()
2.15.1.2. Properties¶
property
default_hero_view[read-write] of Viewproperty
default_trackable_clip[read-only] of Clipproperty
first_frame_offset[read-write] of intproperty
frame_rate[read-write] of floatproperty
groups[read-only] of list ofLayerGroup’sproperty
in_out_range[read-write] of 2-values tuple of longproperty
interlace_mode[read-only] of InterlaceModeproperty
length[read-write] of intproperty
notes[read-write] of unicodeproperty
playback_in_point[read-write] of uintproperty
playback_out_point[read-write] of uintproperty
progress_watcher[read-only] of ProgressWatcherproperty
project_file[read-only] of unicodeproperty
psets[read-only] of ParameterSet
2.15.2. Detailed Description¶
Main project class. Provides methods and properties for general project management of layers, groups, rendering and output directories.
-
class
mocha.project.Project(detached_clip[, interlace_mode=NotInterlaced[, parent=NULL]])¶ - Parameters
detached_clip (
mocha.project.Clip) – Detached clip instance.interlace_mode (
mocha.project.InterlaceMode) – Interlace mode for creating clip.parent (
PySide2.QtCore.QObject) – Parent QObject or None.
Creates a new mocha project from existing clip.
-
class
mocha.project.Project(project_file[, parent=NULL])¶ - Parameters
project_file (unicode) – Path to mocha project file.
parent (
PySide2.QtCore.QObject) – Parent QObject or None.
Opens existing mocha project.
-
Project.add_clip(detached_clip, clip_name)¶ - Return type
- Parameters
detached_clip (
mocha.project.Clip) – Detached clip instance.clip_name (unicode) – New clip name to register.
Creates a copy of
detached_clipand add this to the project. Returns the copy.
-
Project.add_group([name=Project.tr( "New group" )[, layers=list()]])¶ - Return type
- Parameters
name (unicode) – Name for creating group.
layers (list of Layer) – Layers which will be added to new group.
Creates and adds a new group of given
layers. New group will get the newname.Example:
>>> proj.add_group('new_group', (layer1, layer2)) <project.LayerGroup object at 0x25263b0>
-
Project.add_layer(clip[, name=Project.tr( "New layer" )[, frame_number=0[, view=0]]])¶ - Return type
- Parameters
clip (
mocha.project.Clip) – Clip instance which will contain new layer.name (unicode) – Name for creating layer.
frame_number (uint) – Number of frame where new layer is going to be added.
view_index – View index.
- Returns
New Layer
Creates a new layer with
nameand attaches it toclipstarting fromframe_number.Example:
>>> proj.add_layer(clip, 'new_layer') <project.Layer object at 0x25263b0>
-
Project.export_rendered_shapes(layers, colorizeOutput, directory, extension, prefix, suffix, index_start, index_finish[, index_width=1[, views=list()[, separate_streams=false[, offset=0]]]])¶ - Return type
- Parameters
layers (list of Layer) – Layers which will be exported.
colorize_output – Colorize output option.
directory (unicode) – Output directory for rendered clip.
extension (unicode) – File extension for rendered clip.
prefix (unicode) – File prefix for rendered clip.
suffix (unicode) – File suffix for rendered clip.
index_start (uint) – Start frame number.
index_finish (uint) – Stop frame number.
index_width (uint) – Digits count in clip index.
views (list of View) – Views to export.
offset (uint) – Frame offset for the exported image sequence.
Exports matte clip to file system
directory. This method represents mocha File - Export Rendered Shapes… dialog.
-
Project.find_groups(name)¶ - Return type
list of LayerGroup
- Parameters
name (unicode) – Group name for searching.
Returns all groups with the given name.
-
Project.find_layers(name)¶ - Return type
list of Layer
- Parameters
name (unicode) – Layer name for searching.
Returns all layers with the given name.
-
Project.get_output_dir()¶ - Return type
unicode
Returns path to the current output directory.
-
Project.layer(layer_index)¶ - Return type
- Parameters
layer_index (uint) – Layer index.
Access a
Layerbylayer_index. Layers are indexed by their position in a flattened depth sorted list. Iflayer_indexis out of range,layer()should returnNone.Example:
>>> print len(proj.layers) 4 >>> print proj.layer(0) <project.Layer object at 0x2514d40> >>> print proj.layer(4) None
See also:
-
Project.new_output_clip(input_clip, clip_name)¶ - Return type
- Parameters
input_clip (
mocha.project.Clip) – Input clip instance.clip_name (unicode) – New clip name to register.
Creates a new output clip.
-
Project.__ne__(rhs)¶ - Return type
bool
-
Project.__eq__(rhs)¶ - Return type
bool
-
Project.parameter(name_components)¶ - Return type
- Parameters
name_components (list of strings) – Fully qualified name for a requested parameter.
Returns
Parameterinstance bound with given name path. The project instance is a root of the parameter system.
-
Project.parameter_set([name_components=list()])¶ - Return type
- Parameters
name_components (list of strings) – Fully qualified name for a requested parameter set.
Returns
ParameterSetinstance bound with given name path. The project instance is a root of the parameter system. Pass an empty list[]to get access to the root.
-
Project.render(operation, start_index, stop_index[, layers=list()[, view=View(0)[, step=0]]])¶ - Return type
- Parameters
render_operation – instance of some render operation.
start_index (int) – Start frame number.
stop_index (int) – Stop frame number.
layers (list of Layer) – Layers to render.
views – Views to render.
step (int) – Step value.
Renders given render operation, e.g.
RenderRemoveOperation.
-
Project.save()¶ Saves the project to a file with the name specified in the
project_fileproperty.
-
Project.save_as(file)¶ - Parameters
file_name – Path to new project file.
- Raise
RuntimeError - on failure.
Saves the project to a file with the given
file_name. On success, changes theproject_fileproperty value tofile_namevalue.
-
Project.set_output_dir(path[, validate=false])¶ - Parameters
path (unicode) – Path to new output directory.
validate (bool) – validate given path.
- Raise
AssertionError - if validate was set as True and path does not exist or is not writable.
Changes this project output directory.
-
Project.track_layers([start_index=0[, stop_index=UINT_MAX[, layers=list()[, views=list()]]]])¶ - Parameters
start_index (uint) – Index of the first frame to track. If not passed, tracking starts from the beginning.
stop_index (uint) – Index of the last frame to track. If not passed, tracking processed till the end.
layers (list of Layer) – List of layers to track. If not passed, cogged and not locked layers are processed.
views (list of View) – List of views to track. If not passed, default views is processed.
Performs tracking process for the project.
-
Project.undo_group()¶ - Return type
mocha.project.UndoGroup
-
Project.notes¶ - Type
unicode
- Access
read-write Provides access to project notes which are available via mocha View - Project Notes menu.
Example:
>>> proj.notes = "Foo" >>> print proj.notes Foo
-
Project.project_file¶ - Type
unicode
- Access
read-only Provides access to absolute project file path.
If the project wasn’t saved before, should return an empty string.
Example:
>>> print proj.project_file /home/jc/Imagineer/mocha_projects/test_project.mocha
-
Project.clips¶ - Type
dict of {unicode:
Clip}- Access
read-only Provides access to
dictof clip names and appropriateClip’s.
Example:
>>> print proj.clips {u'Ceremony': <project.Clip object at 0x1a30b90>, u'Logo': <project.Clip object at 0x25211b8>} >>> print proj.clips['Ceremony'] 'Ceremony' clip object
-
Project.in_out_range¶ - Type
2-values tuple of long
- Access
read-write Provides access to project in and out points.
Example:
>>> print proj.in_out_range (0L, 6L) >>> proj.in_out_range = (0, 5) >>> print proj.in_out_range (0L, 5L)
-
Project.frame_rate¶ - Type
float
- Access
read-write Provides access to project frame rate. Reflects mocha File - Project settings… - Frame rate.
Example:
>>> print proj.frame_rate 24.0 >>> proj.frame_rate = 30.0 >>> print proj.frame_rate 30.0
-
Project.interlace_mode¶ - Type
InterlaceMode
- Access
read-only Provides access to project interlace mode.
Example:
>>> print proj.interlace_mode project.InterlaceMode.NotInterlaced
-
Project.layers¶ - Type
list of
Layer’s- Access
read-only Provides access to all project layers ordered from front to rear.
Example:
>>> print proj.layers [<project.Layer object at 0x2522c68>, <project.Layer object at 0x2522cb0>, <project.Layer object at 0x2522d88>, <project.Layer object at 0x2522cf8>] >>> print proj.layers[0].name branch
See also:
-
Project.groups¶ - Type
list of
LayerGroup’s- Access
read-only Provides access to all project layers ordered from front to rear.
Example:
>>> print proj.groups [<project.LayerGroup object at 0x42ab098>] >>> print proj.groups[0].name my group
See also:
-
Project.first_frame_offset¶ - Type
int
- Access
read-write Provides access to project first frame offset. Reflects mocha File - Project settings… - First frame offset.
Example:
>>> print proj.first_frame_offset 1 >>> proj.first_frame_offset = 3 >>> print proj.first_frame_offset 3
-
Project.length¶ - Type
int
- Access
read-write Provides access to project length. Reflects mocha File - Project settings… - Length (frames).
Example:
>>> print proj.length 7 >>> proj.length = 3 >>> print proj.length 3
-
Project.views¶ - Type
list of
ViewInfo’s- Access
read-write :raises RuntimeError: if trying to set stereo/multi-view project without appropriate license feature.
- Raises
AssertionError – if names or abbreviations of given
ViewInfo’s are not unique.
Provides access to project
ViewInfoobjects. It contains a single instance for mono projects and may contain more instances for stereo/multi-view ones. To make the project multi-view (if the active license allows), assign a list of severalViewInfoinstances.Example:
>>> print proj.views [mocha.project.ViewInfo("mono", "M", (1, 0.3, 0.3))] >>> proj.views = [ViewInfo('left', 'L', (0, 0, 0)), ViewInfo('right', 'R', (0, 0, 0))] >>> print proj.views [mocha.project.ViewInfo("left", "L", (0, 0, 0)), mocha.project.ViewInfo("right", "R", (0, 0, 0))]
-
Project.default_hero_view¶ - Type
- Access
read-write :raises: AssertionError ? if the project does not contain a given view.
Provides access to project default hero view.
Example:
>>> print proj.default_hero_view View(0) >>> proj.default_hero_view = 0 >>> print proj.default_hero_view View(0) >>> proj.default_hero_view = 1 >>> print proj.default_hero_view View(1) >>> proj.default_hero_view = View(1) >>> proj.default_hero_view View(1)
See also:
-
Project.playback_in_point¶ - Type
uint
- Access
read-write Provides access to the valid project
in pointvalue.
-
Project.playback_out_point¶ - Type
uint
- Access
read-write Provides access to the valid project
out pointvalue.
-
Project.progress_watcher¶ - Type
- Access
read-only Provides access to the current progress watcher object of exporting operations.
-
Project.default_trackable_clip¶ - Type
- Access
read-only Provides access to default trackable clip of the project.
-
Project.psets¶ - Type
- Access
read-only Provides access to the root parameter set.
Mimics parameter_set() call.