premiere-cli 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- premiere_cli/__init__.py +11 -0
- premiere_cli/cli.py +3664 -0
- premiere_cli/log.py +66 -0
- premiere_cli/panel/.debug +8 -0
- premiere_cli/panel/CSXS/manifest.xml +52 -0
- premiere_cli/panel/css/style.css +53 -0
- premiere_cli/panel/host/commands/add-adjustment-layer.jsx +190 -0
- premiere_cli/panel/host/commands/add-audio-keyframes.jsx +176 -0
- premiere_cli/panel/host/commands/add-custom-metadata-field.jsx +63 -0
- premiere_cli/panel/host/commands/add-keyframe.jsx +181 -0
- premiere_cli/panel/host/commands/add-marker-to-project-item.jsx +194 -0
- premiere_cli/panel/host/commands/add-marker.jsx +129 -0
- premiere_cli/panel/host/commands/add-text-overlay.jsx +101 -0
- premiere_cli/panel/host/commands/add-to-render-queue.jsx +120 -0
- premiere_cli/panel/host/commands/add-to-timeline.jsx +300 -0
- premiere_cli/panel/host/commands/add-track.jsx +188 -0
- premiere_cli/panel/host/commands/add-transition.jsx +134 -0
- premiere_cli/panel/host/commands/adjust-audio-levels.jsx +132 -0
- premiere_cli/panel/host/commands/apply-audio-effect.jsx +118 -0
- premiere_cli/panel/host/commands/apply-effect.jsx +122 -0
- premiere_cli/panel/host/commands/apply-lut.jsx +107 -0
- premiere_cli/panel/host/commands/attach-custom-property.jsx +66 -0
- premiere_cli/panel/host/commands/auto-reframe-sequence.jsx +124 -0
- premiere_cli/panel/host/commands/batch-add-transitions.jsx +158 -0
- premiere_cli/panel/host/commands/batch-apply-effect.jsx +182 -0
- premiere_cli/panel/host/commands/batch-rename-clips.jsx +170 -0
- premiere_cli/panel/host/commands/batch-set-clips-enabled.jsx +145 -0
- premiere_cli/panel/host/commands/clear-item-in-out.jsx +117 -0
- premiere_cli/panel/host/commands/clear-sequence-in-out.jsx +100 -0
- premiere_cli/panel/host/commands/close-all-source-clips.jsx +32 -0
- premiere_cli/panel/host/commands/close-sequence.jsx +80 -0
- premiere_cli/panel/host/commands/close-source-monitor.jsx +32 -0
- premiere_cli/panel/host/commands/color-correct.jsx +164 -0
- premiere_cli/panel/host/commands/copy-effect-values.jsx +183 -0
- premiere_cli/panel/host/commands/copy-effects-between-clips.jsx +234 -0
- premiere_cli/panel/host/commands/create-bars-and-tone.jsx +152 -0
- premiere_cli/panel/host/commands/create-bin.jsx +76 -0
- premiere_cli/panel/host/commands/create-caption-track.jsx +159 -0
- premiere_cli/panel/host/commands/create-sequence-from-clips.jsx +170 -0
- premiere_cli/panel/host/commands/create-sequence-from-preset.jsx +90 -0
- premiere_cli/panel/host/commands/create-sequence.jsx +166 -0
- premiere_cli/panel/host/commands/create-smart-bin.jsx +80 -0
- premiere_cli/panel/host/commands/create-subclip.jsx +248 -0
- premiere_cli/panel/host/commands/create-subsequence.jsx +136 -0
- premiere_cli/panel/host/commands/debug-qe-inspect.jsx +248 -0
- premiere_cli/panel/host/commands/debug-qe-try-mutate.jsx +305 -0
- premiere_cli/panel/host/commands/delete-marker.jsx +178 -0
- premiere_cli/panel/host/commands/deselect-all-clips.jsx +98 -0
- premiere_cli/panel/host/commands/detach-proxy.jsx +116 -0
- premiere_cli/panel/host/commands/duplicate-clip.jsx +140 -0
- premiere_cli/panel/host/commands/duplicate-sequence.jsx +150 -0
- premiere_cli/panel/host/commands/encode-file.jsx +86 -0
- premiere_cli/panel/host/commands/encode-project-item.jsx +145 -0
- premiere_cli/panel/host/commands/export-aaf.jsx +77 -0
- premiere_cli/panel/host/commands/export-fcp-xml.jsx +65 -0
- premiere_cli/panel/host/commands/export-frame.jsx +381 -0
- premiere_cli/panel/host/commands/export-omf.jsx +95 -0
- premiere_cli/panel/host/commands/export-sequence-as-project.jsx +65 -0
- premiere_cli/panel/host/commands/export-sequence.jsx +100 -0
- premiere_cli/panel/host/commands/extract-audio-track.jsx +181 -0
- premiere_cli/panel/host/commands/extract-selection.jsx +113 -0
- premiere_cli/panel/host/commands/find-items-by-media-path.jsx +112 -0
- premiere_cli/panel/host/commands/freeze-frame.jsx +215 -0
- premiere_cli/panel/host/commands/get-active-sequence.jsx +103 -0
- premiere_cli/panel/host/commands/get-all-project-paths.jsx +72 -0
- premiere_cli/panel/host/commands/get-bin-contents.jsx +176 -0
- premiere_cli/panel/host/commands/get-clip-adjustment-layer.jsx +83 -0
- premiere_cli/panel/host/commands/get-clip-at-playhead.jsx +99 -0
- premiere_cli/panel/host/commands/get-clip-at-position.jsx +120 -0
- premiere_cli/panel/host/commands/get-clip-links.jsx +135 -0
- premiere_cli/panel/host/commands/get-clip-markers.jsx +144 -0
- premiere_cli/panel/host/commands/get-clip-speed.jsx +69 -0
- premiere_cli/panel/host/commands/get-color-label.jsx +89 -0
- premiere_cli/panel/host/commands/get-color-space.jsx +99 -0
- premiere_cli/panel/host/commands/get-duplicate-media.jsx +78 -0
- premiere_cli/panel/host/commands/get-effect-properties.jsx +129 -0
- premiere_cli/panel/host/commands/get-encoder-presets.jsx +131 -0
- premiere_cli/panel/host/commands/get-export-file-extension.jsx +56 -0
- premiere_cli/panel/host/commands/get-footage-interpretation.jsx +113 -0
- premiere_cli/panel/host/commands/get-full-clip-info.jsx +162 -0
- premiere_cli/panel/host/commands/get-full-project-overview.jsx +193 -0
- premiere_cli/panel/host/commands/get-full-sequence-info.jsx +184 -0
- premiere_cli/panel/host/commands/get-graphics-white-luminance.jsx +31 -0
- premiere_cli/panel/host/commands/get-insertion-bin.jsx +35 -0
- premiere_cli/panel/host/commands/get-item-metadata.jsx +94 -0
- premiere_cli/panel/host/commands/get-keyframes.jsx +158 -0
- premiere_cli/panel/host/commands/get-mogrt-component.jsx +111 -0
- premiere_cli/panel/host/commands/get-next-edit-point.jsx +131 -0
- premiere_cli/panel/host/commands/get-offline-media.jsx +67 -0
- premiere_cli/panel/host/commands/get-open-projects.jsx +50 -0
- premiere_cli/panel/host/commands/get-premiere-state.jsx +164 -0
- premiere_cli/panel/host/commands/get-project-info.jsx +63 -0
- premiere_cli/panel/host/commands/get-project-item-info.jsx +247 -0
- premiere_cli/panel/host/commands/get-project-panel-metadata.jsx +30 -0
- premiere_cli/panel/host/commands/get-qe-clip-info.jsx +198 -0
- premiere_cli/panel/host/commands/get-render-queue-status.jsx +35 -0
- premiere_cli/panel/host/commands/get-sequence-count.jsx +24 -0
- premiere_cli/panel/host/commands/get-sequence-in-out.jsx +76 -0
- premiere_cli/panel/host/commands/get-sequence-markers-by-type.jsx +89 -0
- premiere_cli/panel/host/commands/get-source-monitor-info.jsx +34 -0
- premiere_cli/panel/host/commands/get-source-monitor-position.jsx +30 -0
- premiere_cli/panel/host/commands/get-target-tracks.jsx +76 -0
- premiere_cli/panel/host/commands/get-timeline-gaps.jsx +124 -0
- premiere_cli/panel/host/commands/get-timeline-summary.jsx +154 -0
- premiere_cli/panel/host/commands/get-total-clip-count.jsx +67 -0
- premiere_cli/panel/host/commands/get-track-info.jsx +117 -0
- premiere_cli/panel/host/commands/get-unused-media.jsx +99 -0
- premiere_cli/panel/host/commands/get-used-media-report.jsx +125 -0
- premiere_cli/panel/host/commands/get-value-at-time.jsx +135 -0
- premiere_cli/panel/host/commands/get-version-info.jsx +33 -0
- premiere_cli/panel/host/commands/get-work-area.jsx +52 -0
- premiere_cli/panel/host/commands/get-workspaces.jsx +29 -0
- premiere_cli/panel/host/commands/get-xmp-metadata.jsx +107 -0
- premiere_cli/panel/host/commands/import-ae-comps.jsx +129 -0
- premiere_cli/panel/host/commands/import-fcp-xml.jsx +103 -0
- premiere_cli/panel/host/commands/import-folder.jsx +193 -0
- premiere_cli/panel/host/commands/import-image-sequence.jsx +171 -0
- premiere_cli/panel/host/commands/import-media.jsx +217 -0
- premiere_cli/panel/host/commands/import-mogrt-from-library.jsx +105 -0
- premiere_cli/panel/host/commands/import-mogrt.jsx +111 -0
- premiere_cli/panel/host/commands/import-sequences-from-project.jsx +80 -0
- premiere_cli/panel/host/commands/insert-from-source.jsx +162 -0
- premiere_cli/panel/host/commands/inspect-dom-object.jsx +162 -0
- premiere_cli/panel/host/commands/invert-selection.jsx +114 -0
- premiere_cli/panel/host/commands/is-work-area-enabled.jsx +88 -0
- premiere_cli/panel/host/commands/lift-selection.jsx +106 -0
- premiere_cli/panel/host/commands/link-selection.jsx +111 -0
- premiere_cli/panel/host/commands/list-available-audio-effects.jsx +33 -0
- premiere_cli/panel/host/commands/list-available-audio-transitions.jsx +35 -0
- premiere_cli/panel/host/commands/list-available-effects.jsx +33 -0
- premiere_cli/panel/host/commands/list-available-transitions.jsx +74 -0
- premiere_cli/panel/host/commands/list-markers.jsx +69 -0
- premiere_cli/panel/host/commands/list-project-items.jsx +105 -0
- premiere_cli/panel/host/commands/lock-track.jsx +114 -0
- premiere_cli/panel/host/commands/manage-proxies.jsx +176 -0
- premiere_cli/panel/host/commands/match-frame.jsx +141 -0
- premiere_cli/panel/host/commands/move-clip-to-track.jsx +220 -0
- premiere_cli/panel/host/commands/move-clip.jsx +97 -0
- premiere_cli/panel/host/commands/move-items-to-bin.jsx +194 -0
- premiere_cli/panel/host/commands/move-playhead-to-edit.jsx +174 -0
- premiere_cli/panel/host/commands/move-playhead.jsx +137 -0
- premiere_cli/panel/host/commands/nest-clips.jsx +179 -0
- premiere_cli/panel/host/commands/open-in-source.jsx +117 -0
- premiere_cli/panel/host/commands/open-project.jsx +61 -0
- premiere_cli/panel/host/commands/overwrite-clip-at.jsx +350 -0
- premiere_cli/panel/host/commands/overwrite-from-source.jsx +150 -0
- premiere_cli/panel/host/commands/play-source-monitor.jsx +36 -0
- premiere_cli/panel/host/commands/play-timeline.jsx +24 -0
- premiere_cli/panel/host/commands/razor-all-tracks.jsx +171 -0
- premiere_cli/panel/host/commands/redo.jsx +69 -0
- premiere_cli/panel/host/commands/refresh-media.jsx +101 -0
- premiere_cli/panel/host/commands/relink-media.jsx +132 -0
- premiere_cli/panel/host/commands/remove-all-effects.jsx +114 -0
- premiere_cli/panel/host/commands/remove-effect-by-name.jsx +143 -0
- premiere_cli/panel/host/commands/remove-effect.jsx +122 -0
- premiere_cli/panel/host/commands/remove-from-timeline.jsx +93 -0
- premiere_cli/panel/host/commands/remove-keyframe-range.jsx +173 -0
- premiere_cli/panel/host/commands/remove-keyframe.jsx +192 -0
- premiere_cli/panel/host/commands/remove-selected-clips.jsx +126 -0
- premiere_cli/panel/host/commands/remove-track-intervals.jsx +254 -0
- premiere_cli/panel/host/commands/remove-transition.jsx +164 -0
- premiere_cli/panel/host/commands/rename-bin.jsx +88 -0
- premiere_cli/panel/host/commands/rename-clip.jsx +127 -0
- premiere_cli/panel/host/commands/rename-project-item.jsx +111 -0
- premiere_cli/panel/host/commands/rename-track.jsx +84 -0
- premiere_cli/panel/host/commands/replace-clip-media.jsx +140 -0
- premiere_cli/panel/host/commands/replace-clip.jsx +188 -0
- premiere_cli/panel/host/commands/reverse-clip.jsx +187 -0
- premiere_cli/panel/host/commands/ripple-delete-clip.jsx +156 -0
- premiere_cli/panel/host/commands/roll-edit.jsx +162 -0
- premiere_cli/panel/host/commands/save-project-as.jsx +55 -0
- premiere_cli/panel/host/commands/save-project.jsx +57 -0
- premiere_cli/panel/host/commands/scene-edit-detection.jsx +128 -0
- premiere_cli/panel/host/commands/search-project-items.jsx +180 -0
- premiere_cli/panel/host/commands/select-all-clips.jsx +107 -0
- premiere_cli/panel/host/commands/select-clips-by-color.jsx +142 -0
- premiere_cli/panel/host/commands/select-clips-by-name.jsx +133 -0
- premiere_cli/panel/host/commands/select-clips-in-range.jsx +133 -0
- premiere_cli/panel/host/commands/select-disabled-clips.jsx +127 -0
- premiere_cli/panel/host/commands/select-project-item.jsx +115 -0
- premiere_cli/panel/host/commands/set-active-project.jsx +184 -0
- premiere_cli/panel/host/commands/set-active-sequence.jsx +87 -0
- premiere_cli/panel/host/commands/set-all-tracks-targeted.jsx +112 -0
- premiere_cli/panel/host/commands/set-anti-alias-quality.jsx +125 -0
- premiere_cli/panel/host/commands/set-blend-mode.jsx +111 -0
- premiere_cli/panel/host/commands/set-clip-anchor-point.jsx +102 -0
- premiere_cli/panel/host/commands/set-clip-enabled.jsx +127 -0
- premiere_cli/panel/host/commands/set-clip-opacity.jsx +102 -0
- premiere_cli/panel/host/commands/set-clip-pan.jsx +107 -0
- premiere_cli/panel/host/commands/set-clip-position.jsx +103 -0
- premiere_cli/panel/host/commands/set-clip-properties.jsx +221 -0
- premiere_cli/panel/host/commands/set-clip-rotation.jsx +102 -0
- premiere_cli/panel/host/commands/set-clip-scale.jsx +102 -0
- premiere_cli/panel/host/commands/set-clip-selection.jsx +144 -0
- premiere_cli/panel/host/commands/set-clip-speed.jsx +160 -0
- premiere_cli/panel/host/commands/set-clip-volume.jsx +128 -0
- premiere_cli/panel/host/commands/set-color-label.jsx +123 -0
- premiere_cli/panel/host/commands/set-color-value.jsx +155 -0
- premiere_cli/panel/host/commands/set-effect-property.jsx +124 -0
- premiere_cli/panel/host/commands/set-footage-interpretation.jsx +173 -0
- premiere_cli/panel/host/commands/set-frame-blend.jsx +145 -0
- premiere_cli/panel/host/commands/set-graphics-white-luminance.jsx +73 -0
- premiere_cli/panel/host/commands/set-item-in-out.jsx +180 -0
- premiere_cli/panel/host/commands/set-item-metadata.jsx +134 -0
- premiere_cli/panel/host/commands/set-item-offline.jsx +109 -0
- premiere_cli/panel/host/commands/set-item-start-time.jsx +139 -0
- premiere_cli/panel/host/commands/set-keyframe-interpolation.jsx +186 -0
- premiere_cli/panel/host/commands/set-override-frame-rate.jsx +123 -0
- premiere_cli/panel/host/commands/set-override-pixel-aspect-ratio.jsx +129 -0
- premiere_cli/panel/host/commands/set-poster-frame.jsx +192 -0
- premiere_cli/panel/host/commands/set-project-panel-metadata.jsx +69 -0
- premiere_cli/panel/host/commands/set-scale-to-frame-size.jsx +101 -0
- premiere_cli/panel/host/commands/set-scale-width-height.jsx +140 -0
- premiere_cli/panel/host/commands/set-sequence-in-out.jsx +65 -0
- premiere_cli/panel/host/commands/set-sequence-settings.jsx +184 -0
- premiere_cli/panel/host/commands/set-source-in-out.jsx +98 -0
- premiere_cli/panel/host/commands/set-target-track.jsx +91 -0
- premiere_cli/panel/host/commands/set-time-interpolation.jsx +141 -0
- premiere_cli/panel/host/commands/set-track-mute.jsx +91 -0
- premiere_cli/panel/host/commands/set-track-visibility.jsx +94 -0
- premiere_cli/panel/host/commands/set-transcode-on-ingest.jsx +78 -0
- premiere_cli/panel/host/commands/set-uniform-scale.jsx +104 -0
- premiere_cli/panel/host/commands/set-work-area.jsx +76 -0
- premiere_cli/panel/host/commands/set-workspace.jsx +35 -0
- premiere_cli/panel/host/commands/set-xmp-metadata.jsx +157 -0
- premiere_cli/panel/host/commands/slide-edit.jsx +162 -0
- premiere_cli/panel/host/commands/slip-edit.jsx +167 -0
- premiere_cli/panel/host/commands/split-clip.jsx +144 -0
- premiere_cli/panel/host/commands/stabilize-clip.jsx +139 -0
- premiere_cli/panel/host/commands/stop-playback.jsx +23 -0
- premiere_cli/panel/host/commands/trim-clip.jsx +111 -0
- premiere_cli/panel/host/commands/undo.jsx +114 -0
- premiere_cli/panel/host/commands/unlink-selection.jsx +106 -0
- premiere_cli/panel/host/commands/unnest-sequence.jsx +207 -0
- premiere_cli/panel/host/commands/update-marker.jsx +120 -0
- premiere_cli/panel/host/index.jsx +1227 -0
- premiere_cli/panel/host/presets/default-4k-25fps.sqpreset +63 -0
- premiere_cli/panel/index.html +16 -0
- premiere_cli/panel/js/cs-interface.js +11 -0
- premiere_cli/panel/js/main.js +409 -0
- premiere_cli/panel_install.py +220 -0
- premiere_cli-0.2.0.dist-info/METADATA +127 -0
- premiere_cli-0.2.0.dist-info/RECORD +247 -0
- premiere_cli-0.2.0.dist-info/WHEEL +5 -0
- premiere_cli-0.2.0.dist-info/entry_points.txt +3 -0
- premiere_cli-0.2.0.dist-info/licenses/LICENSE +428 -0
- premiere_cli-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Command: set-clip-anchor-point → ppb_setClipAnchorPoint
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (findSequenceByName,
|
|
4
|
+
// findClipComponent, setComponentProperty, ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Standard-DOM only — no QE needed. Ported from leancoderkavy's
|
|
7
|
+
// premiere-pro-mcp `set_clip_anchor_point` tool (track-targeting.ts),
|
|
8
|
+
// addressed here by trackType/trackIndex/clipIndex (same convention as
|
|
9
|
+
// get-full-clip-info) instead of node_id. Sets the Motion component's
|
|
10
|
+
// Anchor Point property ([x, y] in pixels). Mutating — undo is
|
|
11
|
+
// non-functional on this build, so previousValue in the result is the
|
|
12
|
+
// caller's only restoration path.
|
|
13
|
+
|
|
14
|
+
function ppb_setClipAnchorPoint(argsJson) {
|
|
15
|
+
try {
|
|
16
|
+
var args;
|
|
17
|
+
try {
|
|
18
|
+
args = JSON.parse(argsJson);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
24
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
25
|
+
}
|
|
26
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
27
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
28
|
+
}
|
|
29
|
+
if (typeof args.clipIndex !== "number" || args.clipIndex < 0 || Math.floor(args.clipIndex) !== args.clipIndex) {
|
|
30
|
+
return JSON.stringify({ ok: false, error: "clipIndex must be a non-negative integer" });
|
|
31
|
+
}
|
|
32
|
+
if (typeof args.x !== "number" || typeof args.y !== "number") {
|
|
33
|
+
return JSON.stringify({ ok: false, error: "x and y must both be numbers (pixels)" });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!app.project) {
|
|
37
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var seq = null;
|
|
41
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
42
|
+
seq = findSequenceByName(args.sequenceName);
|
|
43
|
+
if (!seq) {
|
|
44
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
seq = app.project.activeSequence;
|
|
48
|
+
if (!seq) {
|
|
49
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
54
|
+
var numTracks = trackCollection.numTracks;
|
|
55
|
+
if (args.trackIndex >= numTracks) {
|
|
56
|
+
return JSON.stringify({
|
|
57
|
+
ok: false,
|
|
58
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var track = trackCollection[args.trackIndex];
|
|
63
|
+
var numClips = track.clips.numItems;
|
|
64
|
+
if (args.clipIndex >= numClips) {
|
|
65
|
+
return JSON.stringify({
|
|
66
|
+
ok: false,
|
|
67
|
+
error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var clip = track.clips[args.clipIndex];
|
|
72
|
+
var clipName = null;
|
|
73
|
+
try { clipName = clip.name; } catch (e) { clipName = null; }
|
|
74
|
+
|
|
75
|
+
var motion = findClipComponent(clip, ["AE.ADBE Motion"], ["Motion"]);
|
|
76
|
+
if (!motion) {
|
|
77
|
+
return JSON.stringify({ ok: false, error: "Motion component not found on clip" });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
var setResult = setComponentProperty(motion, ["Anchor Point"], [args.x, args.y]);
|
|
81
|
+
if (!setResult.found) {
|
|
82
|
+
return JSON.stringify({ ok: false, error: "Anchor Point property not found on the Motion component" });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return JSON.stringify({
|
|
86
|
+
ok: true,
|
|
87
|
+
result: {
|
|
88
|
+
sequenceName: seq.name,
|
|
89
|
+
trackType: args.trackType,
|
|
90
|
+
trackIndex: args.trackIndex,
|
|
91
|
+
clipIndex: args.clipIndex,
|
|
92
|
+
clipName: clipName,
|
|
93
|
+
previousValue: setResult.previousValue,
|
|
94
|
+
requestedValue: setResult.requestedValue,
|
|
95
|
+
newValue: setResult.newValue,
|
|
96
|
+
verified: setResult.verified
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
} catch (e) {
|
|
100
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Command: set-clip-enabled → ppb_setClipEnabled
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (findSequenceByName,
|
|
4
|
+
// ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Standard-DOM mutation. Ported from leancoderkavy's premiere-pro-mcp
|
|
7
|
+
// `enable_disable_clip` tool (timeline.ts) — renamed here to
|
|
8
|
+
// `set-clip-enabled` for explicitness (the reference name reads as a
|
|
9
|
+
// verb pair, this one states the positive-sense boolean it takes). Args
|
|
10
|
+
// use `enabled` (true = clip plays, false = clip disabled) — the
|
|
11
|
+
// underlying Premiere property is the INVERTED `clip.disabled` /
|
|
12
|
+
// `clip.setDisabled()`, so this command negates at the boundary. Per
|
|
13
|
+
// PREMIERE_API_NOTES.md, `clip.disabled = bool` [hetpatel] and
|
|
14
|
+
// `clip.setDisabled(bool)` [leancoderkavy] are both cited as existing —
|
|
15
|
+
// probed in that order, whichever sticks (verified via a clip.disabled
|
|
16
|
+
// read-back) determines `method`.
|
|
17
|
+
function ppb_setClipEnabled(argsJson) {
|
|
18
|
+
try {
|
|
19
|
+
var args;
|
|
20
|
+
try {
|
|
21
|
+
args = JSON.parse(argsJson);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
27
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
28
|
+
}
|
|
29
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
30
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
31
|
+
}
|
|
32
|
+
if (typeof args.clipIndex !== "number" || args.clipIndex < 0 || Math.floor(args.clipIndex) !== args.clipIndex) {
|
|
33
|
+
return JSON.stringify({ ok: false, error: "clipIndex must be a non-negative integer" });
|
|
34
|
+
}
|
|
35
|
+
if (typeof args.enabled !== "boolean") {
|
|
36
|
+
return JSON.stringify({ ok: false, error: "enabled must be a boolean" });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!app.project) {
|
|
40
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var seq = null;
|
|
44
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
45
|
+
seq = findSequenceByName(args.sequenceName);
|
|
46
|
+
if (!seq) {
|
|
47
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
seq = app.project.activeSequence;
|
|
51
|
+
if (!seq) {
|
|
52
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
57
|
+
var numTracks = trackCollection.numTracks;
|
|
58
|
+
if (args.trackIndex >= numTracks) {
|
|
59
|
+
return JSON.stringify({
|
|
60
|
+
ok: false,
|
|
61
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var track = trackCollection[args.trackIndex];
|
|
66
|
+
var numClips = track.clips.numItems;
|
|
67
|
+
if (args.clipIndex >= numClips) {
|
|
68
|
+
return JSON.stringify({
|
|
69
|
+
ok: false,
|
|
70
|
+
error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
var clip = track.clips[args.clipIndex];
|
|
75
|
+
var clipName = null;
|
|
76
|
+
try { clipName = clip.name; } catch (e) { clipName = null; }
|
|
77
|
+
|
|
78
|
+
var previousValue = null;
|
|
79
|
+
try { previousValue = clip.disabled; } catch (e) { previousValue = null; }
|
|
80
|
+
|
|
81
|
+
var requestedDisabled = !args.enabled;
|
|
82
|
+
var method = null;
|
|
83
|
+
var assignError = null;
|
|
84
|
+
var setDisabledError = null;
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
clip.disabled = requestedDisabled;
|
|
88
|
+
method = "disabledAssignment";
|
|
89
|
+
} catch (e) {
|
|
90
|
+
assignError = e.toString();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
var newValue = null;
|
|
94
|
+
try { newValue = clip.disabled; } catch (e) { newValue = null; }
|
|
95
|
+
|
|
96
|
+
if (newValue !== requestedDisabled) {
|
|
97
|
+
try {
|
|
98
|
+
clip.setDisabled(requestedDisabled);
|
|
99
|
+
method = "setDisabled";
|
|
100
|
+
} catch (e) {
|
|
101
|
+
setDisabledError = e.toString();
|
|
102
|
+
}
|
|
103
|
+
try { newValue = clip.disabled; } catch (e) { newValue = newValue; }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
var verified = newValue === requestedDisabled;
|
|
107
|
+
|
|
108
|
+
var result = {
|
|
109
|
+
sequenceName: seq.name,
|
|
110
|
+
trackType: args.trackType,
|
|
111
|
+
trackIndex: args.trackIndex,
|
|
112
|
+
clipIndex: args.clipIndex,
|
|
113
|
+
clipName: clipName,
|
|
114
|
+
requestedValue: args.enabled,
|
|
115
|
+
previousValue: previousValue === null ? null : !previousValue,
|
|
116
|
+
newValue: newValue === null ? null : !newValue,
|
|
117
|
+
verified: verified,
|
|
118
|
+
method: method,
|
|
119
|
+
assignError: assignError,
|
|
120
|
+
setDisabledError: setDisabledError
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return JSON.stringify({ ok: true, result: result });
|
|
124
|
+
} catch (e) {
|
|
125
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Command: set-clip-opacity → ppb_setClipOpacity
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (findSequenceByName,
|
|
4
|
+
// findClipComponent, setComponentProperty, ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Standard-DOM only — no QE needed. Ported from leancoderkavy's
|
|
7
|
+
// premiere-pro-mcp `set_clip_opacity` tool (track-targeting.ts), addressed
|
|
8
|
+
// here by trackType/trackIndex/clipIndex (same convention as
|
|
9
|
+
// get-full-clip-info) instead of node_id. Sets the Opacity component's
|
|
10
|
+
// Opacity property (0-100). Mutating — undo is non-functional on this
|
|
11
|
+
// build, so previousValue in the result is the caller's only restoration
|
|
12
|
+
// path.
|
|
13
|
+
|
|
14
|
+
function ppb_setClipOpacity(argsJson) {
|
|
15
|
+
try {
|
|
16
|
+
var args;
|
|
17
|
+
try {
|
|
18
|
+
args = JSON.parse(argsJson);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
24
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
25
|
+
}
|
|
26
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
27
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
28
|
+
}
|
|
29
|
+
if (typeof args.clipIndex !== "number" || args.clipIndex < 0 || Math.floor(args.clipIndex) !== args.clipIndex) {
|
|
30
|
+
return JSON.stringify({ ok: false, error: "clipIndex must be a non-negative integer" });
|
|
31
|
+
}
|
|
32
|
+
if (typeof args.opacity !== "number" || args.opacity < 0 || args.opacity > 100) {
|
|
33
|
+
return JSON.stringify({ ok: false, error: "opacity must be a number between 0 and 100" });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!app.project) {
|
|
37
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var seq = null;
|
|
41
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
42
|
+
seq = findSequenceByName(args.sequenceName);
|
|
43
|
+
if (!seq) {
|
|
44
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
seq = app.project.activeSequence;
|
|
48
|
+
if (!seq) {
|
|
49
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
54
|
+
var numTracks = trackCollection.numTracks;
|
|
55
|
+
if (args.trackIndex >= numTracks) {
|
|
56
|
+
return JSON.stringify({
|
|
57
|
+
ok: false,
|
|
58
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var track = trackCollection[args.trackIndex];
|
|
63
|
+
var numClips = track.clips.numItems;
|
|
64
|
+
if (args.clipIndex >= numClips) {
|
|
65
|
+
return JSON.stringify({
|
|
66
|
+
ok: false,
|
|
67
|
+
error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var clip = track.clips[args.clipIndex];
|
|
72
|
+
var clipName = null;
|
|
73
|
+
try { clipName = clip.name; } catch (e) { clipName = null; }
|
|
74
|
+
|
|
75
|
+
var opacityComp = findClipComponent(clip, ["AE.ADBE Opacity"], ["Opacity"]);
|
|
76
|
+
if (!opacityComp) {
|
|
77
|
+
return JSON.stringify({ ok: false, error: "Opacity component not found on clip" });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
var setResult = setComponentProperty(opacityComp, ["Opacity"], args.opacity);
|
|
81
|
+
if (!setResult.found) {
|
|
82
|
+
return JSON.stringify({ ok: false, error: "Opacity property not found on the Opacity component" });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return JSON.stringify({
|
|
86
|
+
ok: true,
|
|
87
|
+
result: {
|
|
88
|
+
sequenceName: seq.name,
|
|
89
|
+
trackType: args.trackType,
|
|
90
|
+
trackIndex: args.trackIndex,
|
|
91
|
+
clipIndex: args.clipIndex,
|
|
92
|
+
clipName: clipName,
|
|
93
|
+
previousValue: setResult.previousValue,
|
|
94
|
+
requestedValue: setResult.requestedValue,
|
|
95
|
+
newValue: setResult.newValue,
|
|
96
|
+
verified: setResult.verified
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
} catch (e) {
|
|
100
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Command: set-clip-pan → ppb_setClipPan
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (findSequenceByName,
|
|
4
|
+
// findPannerProperty, ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Standard-DOM mutation. Ported from leancoderkavy's premiere-pro-mcp
|
|
7
|
+
// `set_clip_pan` tool (track-targeting.ts) — Panner component's
|
|
8
|
+
// Balance/Pan property, -100 (full left) .. 100 (full right), 0 = center,
|
|
9
|
+
// same range as the reference. No dB-style conversion involved, unlike
|
|
10
|
+
// set-clip-volume.
|
|
11
|
+
function ppb_setClipPan(argsJson) {
|
|
12
|
+
try {
|
|
13
|
+
var args;
|
|
14
|
+
try {
|
|
15
|
+
args = JSON.parse(argsJson);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
21
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
22
|
+
}
|
|
23
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
24
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
25
|
+
}
|
|
26
|
+
if (typeof args.clipIndex !== "number" || args.clipIndex < 0 || Math.floor(args.clipIndex) !== args.clipIndex) {
|
|
27
|
+
return JSON.stringify({ ok: false, error: "clipIndex must be a non-negative integer" });
|
|
28
|
+
}
|
|
29
|
+
if (typeof args.pan !== "number" || isNaN(args.pan) || args.pan < -100 || args.pan > 100) {
|
|
30
|
+
return JSON.stringify({ ok: false, error: "pan must be a number between -100 and 100" });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!app.project) {
|
|
34
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var seq = null;
|
|
38
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
39
|
+
seq = findSequenceByName(args.sequenceName);
|
|
40
|
+
if (!seq) {
|
|
41
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
seq = app.project.activeSequence;
|
|
45
|
+
if (!seq) {
|
|
46
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
51
|
+
var numTracks = trackCollection.numTracks;
|
|
52
|
+
if (args.trackIndex >= numTracks) {
|
|
53
|
+
return JSON.stringify({
|
|
54
|
+
ok: false,
|
|
55
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var track = trackCollection[args.trackIndex];
|
|
60
|
+
var numClips = track.clips.numItems;
|
|
61
|
+
if (args.clipIndex >= numClips) {
|
|
62
|
+
return JSON.stringify({
|
|
63
|
+
ok: false,
|
|
64
|
+
error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var clip = track.clips[args.clipIndex];
|
|
69
|
+
var clipName = null;
|
|
70
|
+
try { clipName = clip.name; } catch (e) { clipName = null; }
|
|
71
|
+
|
|
72
|
+
var panProp = findPannerProperty(clip);
|
|
73
|
+
if (!panProp) {
|
|
74
|
+
return JSON.stringify({ ok: false, error: "could not find Panner Balance/Pan property on clip — is this an audio clip?" });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var previousValue = null;
|
|
78
|
+
try { previousValue = panProp.getValue(); } catch (e) { previousValue = null; }
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
panProp.setValue(args.pan, true);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
return JSON.stringify({ ok: false, error: "panProp.setValue() failed: " + e.toString() });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
var newValue = null;
|
|
87
|
+
try { newValue = panProp.getValue(); } catch (e) { newValue = null; }
|
|
88
|
+
|
|
89
|
+
var verified = newValue !== null && Math.abs(newValue - args.pan) < 0.001;
|
|
90
|
+
|
|
91
|
+
var result = {
|
|
92
|
+
sequenceName: seq.name,
|
|
93
|
+
trackType: args.trackType,
|
|
94
|
+
trackIndex: args.trackIndex,
|
|
95
|
+
clipIndex: args.clipIndex,
|
|
96
|
+
clipName: clipName,
|
|
97
|
+
requestedValue: args.pan,
|
|
98
|
+
previousValue: previousValue,
|
|
99
|
+
newValue: newValue,
|
|
100
|
+
verified: verified
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return JSON.stringify({ ok: true, result: result });
|
|
104
|
+
} catch (e) {
|
|
105
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Command: set-clip-position → ppb_setClipPosition
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (findSequenceByName,
|
|
4
|
+
// findClipComponent, setComponentProperty, ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Standard-DOM only — no QE needed. Ported from leancoderkavy's
|
|
7
|
+
// premiere-pro-mcp `set_clip_position` tool (track-targeting.ts), which
|
|
8
|
+
// addresses the clip by node_id via that repo's __findClip() helper; this
|
|
9
|
+
// bridge instead uses the same trackType/trackIndex/clipIndex addressing as
|
|
10
|
+
// get-full-clip-info (no node-id lookup helper exists here). Sets the
|
|
11
|
+
// Motion component's Position property ([x, y] in pixels). Mutating —
|
|
12
|
+
// undo is non-functional on this build, so previousValue in the result is
|
|
13
|
+
// the caller's only restoration path.
|
|
14
|
+
|
|
15
|
+
function ppb_setClipPosition(argsJson) {
|
|
16
|
+
try {
|
|
17
|
+
var args;
|
|
18
|
+
try {
|
|
19
|
+
args = JSON.parse(argsJson);
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
25
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
26
|
+
}
|
|
27
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
28
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
29
|
+
}
|
|
30
|
+
if (typeof args.clipIndex !== "number" || args.clipIndex < 0 || Math.floor(args.clipIndex) !== args.clipIndex) {
|
|
31
|
+
return JSON.stringify({ ok: false, error: "clipIndex must be a non-negative integer" });
|
|
32
|
+
}
|
|
33
|
+
if (typeof args.x !== "number" || typeof args.y !== "number") {
|
|
34
|
+
return JSON.stringify({ ok: false, error: "x and y must both be numbers (pixels)" });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!app.project) {
|
|
38
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var seq = null;
|
|
42
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
43
|
+
seq = findSequenceByName(args.sequenceName);
|
|
44
|
+
if (!seq) {
|
|
45
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
seq = app.project.activeSequence;
|
|
49
|
+
if (!seq) {
|
|
50
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
55
|
+
var numTracks = trackCollection.numTracks;
|
|
56
|
+
if (args.trackIndex >= numTracks) {
|
|
57
|
+
return JSON.stringify({
|
|
58
|
+
ok: false,
|
|
59
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var track = trackCollection[args.trackIndex];
|
|
64
|
+
var numClips = track.clips.numItems;
|
|
65
|
+
if (args.clipIndex >= numClips) {
|
|
66
|
+
return JSON.stringify({
|
|
67
|
+
ok: false,
|
|
68
|
+
error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
var clip = track.clips[args.clipIndex];
|
|
73
|
+
var clipName = null;
|
|
74
|
+
try { clipName = clip.name; } catch (e) { clipName = null; }
|
|
75
|
+
|
|
76
|
+
var motion = findClipComponent(clip, ["AE.ADBE Motion"], ["Motion"]);
|
|
77
|
+
if (!motion) {
|
|
78
|
+
return JSON.stringify({ ok: false, error: "Motion component not found on clip" });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var setResult = setComponentProperty(motion, ["Position"], [args.x, args.y]);
|
|
82
|
+
if (!setResult.found) {
|
|
83
|
+
return JSON.stringify({ ok: false, error: "Position property not found on the Motion component" });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return JSON.stringify({
|
|
87
|
+
ok: true,
|
|
88
|
+
result: {
|
|
89
|
+
sequenceName: seq.name,
|
|
90
|
+
trackType: args.trackType,
|
|
91
|
+
trackIndex: args.trackIndex,
|
|
92
|
+
clipIndex: args.clipIndex,
|
|
93
|
+
clipName: clipName,
|
|
94
|
+
previousValue: setResult.previousValue,
|
|
95
|
+
requestedValue: setResult.requestedValue,
|
|
96
|
+
newValue: setResult.newValue,
|
|
97
|
+
verified: setResult.verified
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
} catch (e) {
|
|
101
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
102
|
+
}
|
|
103
|
+
}
|