2.13. Project¶
2.13.1. Synopsis¶
2.13.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.13.1.2. Properties¶
- property clips [read-only] of dict of {unicode: Clip}
- property default_hero_view [read-write] of View
- property default_trackable_clip [read-only] of Clip
- property first_frame_offset [read-write] of int
- property frame_rate [read-write] of float
- property groups [read-only] of list of LayerGroup‘s
- property in_out_range [read-write] of 2-values tuple of long
- property interlace_mode [read-only] of InterlaceMode
- property layers [read-only] of list of Layer‘s
- property length [read-write] of int
- property notes [read-write] of unicode
- property playback_in_point [read-write] of uint
- property playback_out_point [read-write] of uint
- property progress_watcher [read-only] of ProgressWatcher
- property project_file [read-only] of unicode
- property views [read-write] of list of ViewInfo‘s
2.13.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 (PySide.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 (PySide.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.
Return type: Creates a copy of detached_clip and 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 new name.
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 (PySide.QtCore.uint) – Number of frame where new layer is going to be added.
- view_index – View index.
Creates a new layer with name and attaches it to clip starting from frame_number.
Example:
>>> proj.add_layer('new_group', (layer1, layer2)) <project.LayerGroup 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 (PySide.QtCore.uint) – Start frame number.
- index_finish (PySide.QtCore.uint) – Stop frame number.
- index_width (PySide.QtCore.uint) – Digits count in clip index.
- views (list of View) – Views to export.
- offset (PySide.QtCore.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: mocha.project.Layer Parameters: layer_index (PySide.QtCore.uint) – Layer index. Access a Layer by layer_index. Layers are indexed by their position in a flattened depth sorted list. If layer_index is out of range, layer() should return None.
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.
Return type: Creates a new output clip.
- Project.__ne__(rhs)¶
Return type: PySide.QtCore.bool
- Project.__eq__(rhs)¶
Return type: PySide.QtCore.bool
- Project.parameter(name_components)¶
Return type: mocha.project.Parameter Parameters: name_components (list of strings) – Fully qualified name for a requested parameter. Return type: Parameter Returns Parameter instance bound with given name path. The project instance is a root of the parameter system.
- Project.parameter_set([name_components=list()])¶
Return type: mocha.project.ParameterSet Parameters: name_components (list of strings) – Fully qualified name for a requested parameter set. Return type: ParameterSet Returns ParameterSet instance 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 (PySide.QtCore.int) – Start frame number.
- stop_index (PySide.QtCore.int) – Stop frame number.
- layers (list of Layer) – Layers to render.
- views – Views to render.
- step (PySide.QtCore.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_file property.
- 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 the project_file property value to file_name value.
- Project.set_output_dir(path[, validate=false])¶
Parameters: - path (unicode) – Path to new output directory.
- validate (PySide.QtCore.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 (PySide.QtCore.uint) – Index of the first frame to track. If not passed, tracking starts from the beginning.
- stop_index (PySide.QtCore.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 dict of clip names and appropriate Clip‘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: mocha.project.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.
- AssertionError – if names or abbreviations of given ViewInfo‘s are not unique.
Provides access to project ViewInfo objects. 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 several ViewInfo instances.
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: mocha.project.View 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 point value.
- Project.playback_out_point¶
Type: uint Access: read-write Provides access to the valid project out point value.
- Project.progress_watcher¶
Type: mocha.project.ProgressWatcher Access: read-only Provides access to the current progress watcher object of exporting operations.
- Project.default_trackable_clip¶
Type: mocha.project.Clip Access: read-only Provides access to default trackable clip of the project.