2.5. Clip

2.5.1. Synopsis

2.5.1.1. Functions

  • def __eq__ (rhs)

  • def __ne__ (rhs)

  • def __str__ ()

  • 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_discrete_frames ()

  • 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 (str) – Absolute path to first clip file.

  • validate (bool) – Validate creating clip if set to True

  • width (uint) – Clip width in pixels.

  • height (uint) – Clip height in pixels.

  • length (uint) – Clip length.

  • parent (QObject) – Parent object.

Creates detached clip instance.

Clip.__str__()
Return type

object

Clip.add_stream(first_clip_file, view, start_frame, stop_frame[, validate=false])
Parameters
  • first_clip_file (str) – Absolute path to first clip file.

  • view (View) – Project view which is not used in this clip.

  • start_frame (uint) – Start frame index for new stream.

  • stop_frame (uint) – Stop frame index for new stream.

  • validate (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
  • stream_info (StreamInfo) – Stream data which will be applied immediately.

  • view (View) – Clip view.

Relinks clip without any checking.

Clip.assign_project_view(view, proj_view)
Parameters
  • view (View) – Clip view.

  • proj_view (View) – Project view.

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

ParameterSet

Parameters

name_components (list of strings) – Relative name for a requested parameter set.

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 (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 (str) – Output clip directory.

  • extension (str) – File format extension.

  • prefix (str) – Prefix to add to exported clip.

  • suffix (str) – Suffix to append to exported clip.

  • index_start (uint) – The starting index.

  • index_stop – The ending index.

  • index_width (uint) – Width of the sequence number, padded by zeroes.

  • views (list of View) – Views to export.

  • offset (uint) – Frame offset for the exported image sequence.

  • step (uint) – Step value.

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

Clip.get_discrete_frames()
Clip.get_info(view)
Return type

StreamInfo

Parameters

view (View) – Clip view.

Returns stream info for given view.

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

ImageData

Parameters
  • frame (uint) – Index of frame to query the source image from.

  • view (View) – View.

  • allocate (bool) – If True and the clip has no image on given frame, the frame image will be allocated.

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

bool

Clip.__eq__(rhs)
Return type

bool

Clip.parameter(name_components)
Return type

Parameter

Parameters

name_components (list of strings) – Relative name for a requested parameter.

Returns Parameter instance bound with given name path.

Clip.parameter_set([name_components=list()])
Return type

ParameterSet

Parameters

name_components (list of strings) – Relative name for a requested parameter set.

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

Parameters
  • path (str) – Absolute path to first clip file.

  • prefix (str) – Clip prefix.

  • suffix (str) – Clip suffix.

  • start_frame (uint) – Start frame number.

  • end_frame (uint) – Stop frame number.

  • view (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

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

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.

Clip.psets
Type

ParameterSet

Access

read-only Provides access to the parameter set.

Mimics parameter_set() call.