Provides access to the current filter's properties, keyframes, and presets. More...
| Import Statement: | import org.shotcut.qml |
Filter is the primary scripting interface for filter UI panels and VUI overlays. Each filter's QML file receives a filter context property of this type. Use it to read and write MLT service properties, manage keyframes, load/save presets, and trigger analysis jobs.
// Inside a filter's QML panel: filter.set("level", slider.value) var current = filter.getDouble("level") filter.startUndoParameterCommand("Change Level") filter.set("level", newValue) filter.endUndoCommand()
animateIn : int |
Number of frames over which the "animate in" simple keyframe ramp runs. Set to 0 to disable. Writing this triggers the animateInChanged signal.
animateOut : int |
Number of frames over which the "animate out" simple keyframe ramp runs. Set to 0 to disable. Writing this triggers the animateOutChanged signal.
blockSignals : bool |
When true, suppresses all QML signals from this object. Set while performing bulk property updates to avoid redundant UI refreshes.
duration : int |
Total duration of the filter in frames (out - in + 1).
in : int |
The filter's in-point in frames, relative to the clip start.
isNew : bool |
Whether this filter was just added or its UI is simply being reloaded. Use this to set sensible initial property values on first load.
out : int |
The filter's out-point in frames, relative to the clip start.
path : string |
Absolute path to the directory containing this filter's QML files. Use to load auxiliary QML files relative to the filter.
presets : list<string> |
The list of saved preset names for this filter. Notifies presetsChanged when the list changes.
analyzeFinished(bool isSuccess) |
Emitted when an analysis job completes. isSuccess is true on success.
Note: The corresponding handler is onAnalyzeFinished.
animateInChanged() |
Emitted when animateIn changes.
Note: The corresponding handler is onAnimateInChanged.
animateInOutChanged() |
Emitted when either animateIn or animateOut changes.
Note: The corresponding handler is onAnimateInOutChanged.
animateOutChanged() |
Emitted when animateOut changes.
Note: The corresponding handler is onAnimateOutChanged.
changed(string name) |
Emitted when any filter property changes. name is the property name, or empty if multiple properties changed.
Note: The corresponding handler is onChanged.
durationChanged() |
Emitted when the filter's duration changes.
Note: The corresponding handler is onDurationChanged.
inChanged(int delta) |
Emitted when the filter's in-point changes. delta is the frame offset.
Note: The corresponding handler is onInChanged.
outChanged(int delta) |
Emitted when the filter's out-point changes. delta is the frame offset.
Note: The corresponding handler is onOutChanged.
presetsChanged() |
Emitted when the list of saved presets changes.
Note: The corresponding handler is onPresetsChanged.
propertyChanged(string name) |
Emitted when a specific named property name changes. Use in bindings that need to react to individual property updates.
Note: The corresponding handler is onPropertyChanged.
analyze(bool isAudio = false, bool deferJob = true) |
Starts an analysis job for this filter. Set isAudio to true for audio filters. When deferJob is true the job is queued rather than run immediately. Emits analyzeFinished when done.
clearSimpleAnimation(string name) |
Clears the "animate in/out" simple keyframe mode for property name, leaving only the static value at the current time position.
copyParameters() |
Copies this filter's current parameters to the clipboard.
crop(rect r) |
Applies a crop rectangle r to the filter's producer source.
deletePreset(string name) |
Deletes the saved preset named name.
deselect() |
Deselects the current filter in the Filters panel.
endUndoCommand() |
Ends the undo/redo command group started by startUndoParameterCommand().
int framesFromTime(string time) |
Converts a timecode time string (HH:MM:SS.ms or MLT time format) to a frame number.
string get(string name, int position = -1) |
Returns the value of MLT property name as a string. If time position is -1 (default), returns the current value; otherwise returns the interpolated value at that frame position. To get an integer value, convert the result using parseInt(), e.g. parseInt(filter.get("someProperty")).
color getColor(string name, int position = -1) |
Returns the value of MLT property name as a color. position defaults to -1 (current value).
real getDouble(string name, int position = -1) |
Returns the value of MLT property name as a floating-point number. position defaults to -1 (current value).
list<string> getGradient(string name) |
Returns the gradient stop colors for property name as a list of color strings.
getHash() |
Computes a hash of the filter's input producer and stores it as the shotcut:hash property. Used internally by analysis jobs.
int getKeyFrameType(string name, int keyIndex) |
Returns the interpolation type (mlt_keyframe_type) of keyframe keyIndex for property name.
int getNextKeyframePosition(string name, int position) |
Returns the position of the next keyframe for property name after time position, or -1 if none.
int getPrevKeyframePosition(string name, int position) |
Returns the position of the previous keyframe for property name before time position, or -1 if none.
rect getRect(string name, int position = -1) |
Returns the value of MLT property name as a rect. The rectangle values are in the project coordinate space. position defaults to -1 (current value).
bool isAtLeastVersion(string version) |
Returns true if Shotcut's version is greater than or equal to version. Use to guard features introduced in specific releases.
int keyframeCount(string name) |
Returns the number of keyframes set on property name.
loadPresets() |
Reloads the list of saved presets from disk and emits presetsChanged.
pasteParameters(list<string> propertyNames) |
Pastes parameters from the clipboard into this filter, restricted to the properties listed in propertyNames.
removeRectPercents(string name) |
Converts a rect property stored as percentages to absolute pixel values. name is the MLT property to convert in-place.
resetProperty(string name) |
Removes all keyframes for property name and resets it to its default value.
int savePreset(list<string> propertyNames, string name = "") |
Saves the current values of propertyNames as a preset named name. Returns the index of the new preset in presets.
set(string name, string value, int position = -1) |
Sets MLT property name to the string value. If time position is given, sets a keyframe at that position.
set(string name, bool value, int position = -1, int keyframeType = -1) |
Sets MLT property name to the boolean value, optionally at time position.
set(string name, color value, int position = -1, int keyframeType = -1) |
Sets MLT property name to the color value, optionally at time position. keyframeType is one of the mlt_keyframe_type enum values; use -1 for the default.
set(string name, int value, int position = -1, int keyframeType = -1) |
Sets MLT property name to the integer value, optionally at time position.
set(string name, real value, int position = -1, int keyframeType = -1) |
Sets MLT property name to the floating-point value, optionally at time position.
set(string name, rect value, int position = -1, int keyframeType = -1) |
Sets MLT property name to the value rect, optionally at time position.
set(string name, real x, real y, real width, real height, real opacity = 1.0, int position = -1, int keyframeType = -1) |
Sets MLT property name to a rect specified by components, optionally at time position. opacity is clamped to [0.0, 1.0].
setGradient(string name, list<string> colors) |
Sets the gradient stops for property name from a list of colors strings.
setKeyFrameType(string name, int keyIndex, int type) |
Sets the interpolation type of keyframe keyIndex for property name.
startUndoParameterCommand(string description = "") |
Begins an undo/redo command group for parameter changes. All set() calls until endUndoCommand() are grouped as one undoable step. description appears in the Edit > Undo menu.