2.5. Clip

2.5.1. Synopsis

2.5.1.1. Functions

  • def __eq__ (rhs)
  • def __ne__ (rhs)
  • def add_stream (first_clip_file, view, start_frame, stop_frame[, validate=false])
  • def apply (stream_info[, view=View()])
  • def assign_project_view (view, proj_view)
  • def base_parameter_set ([name_components=list()])
  • def delete_stream (view)
  • def export (revertToClip, directory, extension, prefix, suffix, index_start, index_finish[, index_width=1[, views=list()[, separate_streams=false[, offset=0[, step=1]]]]])
  • def get_info (view)
  • def image (frame[, view=View()[, allocate=false]])
  • def parameter (name_components)
  • def parameter_set ([name_components=list()])
  • def relink ([path=”“[, prefix=”“[, suffix=”“[, start_frame=UINT_MAX[, end_frame=UINT_MAX[, view=View()]]]]]])
  • def relink (stream_info[, view=View()])

2.5.1.2. Properties

2.5.2. Detailed Description

Clip class which provides primary manipulations on clip.
class mocha.project.Clip(clip_path[, clip_name="NewClip"[, validate=false[, width=0[, height=0[, length=0[, parent=NULL]]]]]])
Parameters:
  • clip_path (unicode) – Absolute path to first clip file.
  • validate (PySide2.QtCore.bool) – Validate creating clip if set to True
  • width (PySide2.QtCore.uint) – Clip width in pixels.
  • height (PySide2.QtCore.uint) – Clip height in pixels.
  • length (PySide2.QtCore.uint) – Clip length.
  • parent (PySide2.QtCore.QObject) – Parent object.

Creates detached clip instance.

Clip.add_stream(first_clip_file, view, start_frame, stop_frame[, validate=false])
Parameters:
  • first_clip_file (unicode) – Absolute path to first clip file.
  • view (mocha.project.View) – Project view which is not used in this clip.
  • start_frame (PySide2.QtCore.uint) – Start frame index for new stream.
  • stop_frame (PySide2.QtCore.uint) – Stop frame index for new stream.
  • validate (PySide2.QtCore.bool) – Validate adding stream if it is set to True.
Raises:
  • IndexError – If project does not have given view, or clip already has such view, or current frame range is invalid.
  • IOError – If given first_clip_file is inaccessible.

Adds a new clip stream on unoccupied view.

Clip.apply(stream_info[, view=View()])
Parameters:

Relinks clip without any checking.

Clip.assign_project_view(view, proj_view)
Parameters:
Raises:

IndexError - If project does not contain the given proj_view or the clip does not.

Assigns given clip view to given project view.

See also:
Clip.base_parameter_set([name_components=list()])
Return type:mocha.project.ParameterSet
Parameters:name_components (list of strings) – Relative name for a requested parameter set.
Return type:ParameterSet

Returns ParameterSet instance bound with given name path. Pass an empty list [] to get access to the base clip parameters set.

Clip.delete_stream(view)
Parameters:view (mocha.project.View) – Clip view.
Raises:IndexError - If the clip does not have the given view.

Deletes the stream for given view.

Clip.export(revertToClip, directory, extension, prefix, suffix, index_start, index_finish[, index_width=1[, views=list()[, separate_streams=false[, offset=0[, step=1]]]]])
Parameters:
  • revert_to_clip – Revert to clip option.
  • directory (unicode) – Output clip directory.
  • extension (unicode) – File format extension.
  • prefix (unicode) – Prefix to add to exported clip.
  • suffix (unicode) – Suffix to append to exported clip.
  • index_start (PySide2.QtCore.uint) – The starting index.
  • index_stop – The ending index.
  • index_width (PySide2.QtCore.uint) – Width of the sequence number, padded by zeroes.
  • views (list of View) – Views to export.
  • offset (PySide2.QtCore.uint) – Frame offset for the exported image sequence.
  • step (PySide2.QtCore.uint) – Step value.

Exports current clip to filesystem directory. Same options provides mocha main menu item File - Export Rendered Clip...

Clip.get_info(view)
Return type:mocha.project.StreamInfo
Parameters:view (mocha.project.View) – Clip view.

Returns stream info for given view.

Clip.image(frame[, view=View()[, allocate=false]])
Return type:

mocha.project.ImageData

Parameters:
  • frame (PySide2.QtCore.uint) – Index of frame to query the source image from.
  • view (mocha.project.View) – View.
  • allocate (PySide2.QtCore.bool) – If True and the clip has no image on given frame, the frame image will be allocated.
Return type:

ImageData

Returns ImageData instance bearing the pixel data and metainformation of the querying clip source image. Any changes made on the pixel data will immediately invalidate the image cache.

Clip.__ne__(rhs)
Return type:PySide2.QtCore.bool
Clip.__eq__(rhs)
Return type:PySide2.QtCore.bool
Clip.parameter(name_components)
Return type:mocha.project.Parameter
Parameters:name_components (list of strings) – Relative name for a requested parameter.
Return type:Parameter

Returns Parameter instance bound with given name path.

Clip.parameter_set([name_components=list()])
Return type:mocha.project.ParameterSet
Parameters:name_components (list of strings) – Relative name for a requested parameter set.
Return type:ParameterSet

Returns ParameterSet instance bound with given name path. Pass an empty list [] to get access to the Clip parameters set.

Parameters:
  • path (unicode) – Absolute path to first clip file.
  • prefix (unicode) – Clip prefix.
  • suffix (unicode) – Clip suffix.
  • start_frame (PySide2.QtCore.uint) – Start frame number.
  • end_frame (PySide2.QtCore.uint) – Stop frame number.
  • view (mocha.project.View) – View.

Relinks current clip with given parameters.

Clip.relink(stream_info[, view=View()])
Parameters:

Relinks current clip with given `stream_info` parameters.

Clip.name
Type:str
Access:read-only

Provides access to clip name.

Clip.views
Type:list of View
Access:read-only

Provides access to clip views.

Clip.frame_size
Type:float
Access:read-write

Provides access to clip frame size in pixels.

Clip.frame_rate
Type:float
Access:read-write

Provides access to clip frame rate.

Clip.first_frame_offset
Type:int
Access:read-write

Provides access to first frame offset.

Clip.color_parameters
Type:mocha.project.ColorParameters
Access:read-write

Provides access to clip color parameters object.

Clip.view_mapping
Type:dict of { View: View }
Access:read-only

Provides access to view mapping as dict instance where keys are project views and values are clip views.

See also:
Clip.progress_watcher
Type:mocha.project.ProgressWatcher
Access:read-only

Provides access to the current progress watcher object of render operation.

Clip.id
Type:long
Access:read-only

Provides access to the current clip ID.

Clip.discrete_frames
Type:tuple
Access:read-only

Provides access to discrete frames of the clip instance.