conformtools 0.6.5 → 0.6.6
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.
- package/README.md +3 -3
- package/dist/account-HDXVTS5T.js +3 -0
- package/dist/arriraw-YIJ3BYNN.js +525 -0
- package/dist/avid-panel/MANIFEST.json +11 -0
- package/dist/avid-panel/avid-manifest.json +46 -0
- package/dist/avid-panel/icon.svg +4 -0
- package/dist/avid-panel/icons/conformtools.svg +4 -0
- package/dist/avid-panel/index.html +26 -0
- package/dist/avid-panel/panel.css +12 -0
- package/dist/avid-panel/panel.js +7 -0
- package/dist/bridge-D5KPIUSY.js +3 -0
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/chunk-3OCQA33E.js +3 -0
- package/dist/chunk-3XD6NC4G.js +10 -0
- package/dist/chunk-5JBUCVRI.js +20 -0
- package/dist/chunk-5RSNFPED.js +8 -0
- package/dist/chunk-5SUGU2YR.js +3 -0
- package/dist/chunk-6ML26TIK.js +3 -0
- package/dist/chunk-7D7H6VFW.js +3 -0
- package/dist/chunk-7MC7M2Y5.js +3 -0
- package/dist/chunk-AACY2V3L.js +3 -0
- package/dist/chunk-AS7IXHYM.js +19 -0
- package/dist/chunk-BL6L5ZBP.js +39 -0
- package/dist/chunk-C2ESM27Z.js +3 -0
- package/dist/chunk-C5IX63YF.js +3 -0
- package/dist/chunk-D6YDLKSA.js +3 -0
- package/dist/chunk-DKGGJM6Z.js +3 -0
- package/dist/chunk-EJGVNQ3E.js +8 -0
- package/dist/chunk-HGDO3OED.js +3 -0
- package/dist/chunk-JV7TZDKJ.js +3 -0
- package/dist/chunk-LFJLRLEP.js +3 -0
- package/dist/chunk-NFJHWZJX.js +3 -0
- package/dist/chunk-NQHQKEP5.js +3 -0
- package/dist/chunk-NU3X7P4N.js +3 -0
- package/dist/chunk-OJWIBQK4.js +376 -0
- package/dist/chunk-OVUCL3YY.js +5 -0
- package/dist/chunk-P7OVDUA5.js +3 -0
- package/dist/chunk-PFISREY4.js +3 -0
- package/dist/chunk-PFZVET7S.js +3 -0
- package/dist/chunk-PLRB2YXJ.js +3 -0
- package/dist/chunk-PSANHDZM.js +3 -0
- package/dist/chunk-RFIPLBQ4.js +5 -0
- package/dist/chunk-SZD4C5MB.js +6 -0
- package/dist/chunk-TK55FA56.js +3 -0
- package/dist/chunk-TXQR2HI2.js +4 -0
- package/dist/chunk-UCMNH6Q6.js +3 -0
- package/dist/chunk-UKKRZ574.js +7 -0
- package/dist/chunk-VS3MKKJ5.js +3 -0
- package/dist/chunk-X53BNWNV.js +3 -0
- package/dist/chunk-XNR7M4VX.js +3 -0
- package/dist/claude-setup-IIWUB4CE.js +5 -0
- package/dist/cli.js +17 -0
- package/dist/clip-state-B6JOX3JE.js +3 -0
- package/dist/conformtools-analyze +0 -0
- package/dist/conformtools-decode +0 -0
- package/dist/cr3-wasm-L2LFY3LM.js +3 -0
- package/dist/dng-wasm-U6NC3MDK.js +3 -0
- package/dist/dpx-wasm-RMKEUKED.js +3 -0
- package/dist/engine-P6H5P6HP.js +5 -0
- package/dist/esm-SFFBP7PS.js +3 -0
- package/dist/exr-wasm-LBAOMOZD.js +3 -0
- package/dist/flame/hook/conformtools_flame/__init__.py +10 -0
- package/dist/flame/hook/conformtools_flame/building.py +191 -0
- package/dist/flame/hook/conformtools_flame/hook.py +177 -0
- package/dist/flame/hook/conformtools_flame/render.py +622 -0
- package/dist/flame/hook/conformtools_flame/util.py +33 -0
- package/dist/flame/hook/conformtools_flame/verbs.py +1037 -0
- package/dist/flame/hook/conformtools_flame_hook.py +42 -0
- package/dist/fonts/gfx/BarlowCondensed-Bold.ttf +0 -0
- package/dist/fonts/gfx/BarlowCondensed-Regular.ttf +0 -0
- package/dist/fonts/gfx/InstrumentSerif-Regular.ttf +0 -0
- package/dist/fonts/gfx/Inter-Bold.ttf +0 -0
- package/dist/fonts/gfx/Inter-Regular.ttf +0 -0
- package/dist/fonts/gfx/JetBrainsMono-Bold.ttf +0 -0
- package/dist/fonts/gfx/JetBrainsMono-Regular.ttf +0 -0
- package/dist/fonts/gfx/OFL.txt +100 -0
- package/dist/framing-SRCJKAYO.js +3 -0
- package/dist/gfx-worker.js +3 -0
- package/dist/h264-3ESGVT6G.js +3 -0
- package/dist/h264-mxf-NPFS7NGH.js +3 -0
- package/dist/host-relink-D6CB2VOQ.js +10 -0
- package/dist/hosts-W4AD2MYH.js +3 -0
- package/dist/http.js +5 -0
- package/dist/i2o-transfer +0 -0
- package/dist/inspect-7ASUPU73.js +68 -0
- package/dist/isobmff-SIOE67WL.js +3 -0
- package/dist/mcp.js +13 -0
- package/dist/media-7AUNRKHF.js +3 -0
- package/dist/media_core-Q2PIEV7D.js +9 -0
- package/dist/media_core_bg-FDL7GJZP.js +3 -0
- package/dist/media_core_bg-XRBVKQZH.js +3 -0
- package/dist/mxf-74TTDICM.js +3 -0
- package/dist/nuke/panel/python/Startup/conformtools_nuke_startup.py +44 -0
- package/dist/nuke/panel/python/conformtools_nuke/__init__.py +10 -0
- package/dist/nuke/panel/python/conformtools_nuke/panel.py +217 -0
- package/dist/nuke/panel/python/conformtools_nuke/verbs.py +837 -0
- package/dist/ops-FSOOBXMV.js +3 -0
- package/dist/peer-kit/ctpeer/__init__.py +21 -0
- package/dist/peer-kit/ctpeer/client.py +247 -0
- package/dist/peer-kit/ctpeer/neutral.py +178 -0
- package/dist/peer-kit/ctpeer/pairing.py +139 -0
- package/dist/peer-kit/ctpeer/protocol.py +209 -0
- package/dist/peer-kit/ctpeer/websocket.py +289 -0
- package/dist/premiere-uxp/icons/panel.png +0 -0
- package/dist/premiere-uxp/icons/panel@2x.png +0 -0
- package/dist/premiere-uxp/icons/plugin.png +0 -0
- package/dist/premiere-uxp/icons/plugin@2x.png +0 -0
- package/dist/premiere-uxp/index.html +38 -0
- package/dist/premiere-uxp/index.js +93 -0
- package/dist/premiere-uxp/lib/clipmeta.js +170 -0
- package/dist/premiere-uxp/lib/ctx.js +68 -0
- package/dist/premiere-uxp/lib/edit.js +516 -0
- package/dist/premiere-uxp/lib/handles.js +57 -0
- package/dist/premiere-uxp/lib/markers.js +198 -0
- package/dist/premiere-uxp/lib/pairing.js +67 -0
- package/dist/premiere-uxp/lib/premiere.js +91 -0
- package/dist/premiere-uxp/lib/probe.js +241 -0
- package/dist/premiere-uxp/lib/protocol.js +165 -0
- package/dist/premiere-uxp/lib/render.js +45 -0
- package/dist/premiere-uxp/lib/session.js +85 -0
- package/dist/premiere-uxp/lib/sizing.js +325 -0
- package/dist/premiere-uxp/lib/time.js +88 -0
- package/dist/premiere-uxp/lib/timeline.js +336 -0
- package/dist/premiere-uxp/lib/verbs.js +21 -0
- package/dist/premiere-uxp/lib/write.js +97 -0
- package/dist/premiere-uxp/manifest.json +102 -0
- package/dist/probe-F7WQHMIA.js +3 -0
- package/dist/prores-RIG37OIH.js +526 -0
- package/dist/r3d-YTLOMC7C.js +3 -0
- package/dist/r3d-ZDJ3WURS.js +1025 -0
- package/dist/resolve-bridge.py +2286 -0
- package/dist/resolve-presets/conform.tools.xml +127 -0
- package/dist/source-BDJAUQVR.js +3 -0
- package/dist/statusline-GMMCFMOA.js +4 -0
- package/dist/statusline.js +3 -0
- package/dist/still-ZG2RUQAL.js +3 -0
- package/dist/store-ZHXLQCGN.js +3 -0
- package/dist/tiff-wasm-D2FJ3L56.js +3 -0
- package/dist/timeline-6DYFDVEH.js +3 -0
- package/dist/timeline_core-IOENXK4Z.js +3 -0
- package/dist/timeline_core_bg-JW42YM3G.js +3 -0
- package/dist/udf_bg-B37GKRIH.js +3 -0
- package/dist/wasm/media_core_bg.wasm +0 -0
- package/dist/wasm/udf_bg.wasm +0 -0
- package/dist/wasm-threads/media_core_bg.wasm +0 -0
- package/dist/wav-OWMUGQMM.js +3 -0
- package/package.json +6 -4
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
// `markers`: sequence markers, and clip markers (which Premiere keeps on the
|
|
2
|
+
// PROJECT ITEM, not the track item - a track-item handle maps to its project
|
|
3
|
+
// item's markers, in source frames). Colours are Premiere's eight indexed
|
|
4
|
+
// marker colours; the neutral names below are what the app's Marker Utility
|
|
5
|
+
// shows, mapped both ways.
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
const { handles, h, g, transact, activeProject, PeerError, P } = require("./ctx");
|
|
9
|
+
const T = require("./time");
|
|
10
|
+
const TL = require("./timeline");
|
|
11
|
+
|
|
12
|
+
// Premiere marker colour index -> the app's colour name (Resolve's palette
|
|
13
|
+
// is the neutral vocabulary; the nearest name is used).
|
|
14
|
+
const COLOR_NAMES = ["Green", "Red", "Purple", "Yellow", "Blue", "Cyan", "Sky", "Fuchsia"];
|
|
15
|
+
const COLOR_INDEX = new Map(COLOR_NAMES.map((n, i) => [n.toLowerCase(), i]));
|
|
16
|
+
const COLOR_ALIASES = { orange: 1, pink: 7, lavender: 2, mint: 0, lemon: 3, sand: 3, cocoa: 1, cream: 3, rose: 7, teal: 5, sky: 6, cyan: 5 };
|
|
17
|
+
|
|
18
|
+
function colorName(index) { const i = Number(index); return COLOR_NAMES[i] || (Number.isFinite(i) ? String(i) : ""); }
|
|
19
|
+
function colorIndex(name) {
|
|
20
|
+
const k = String(name || "").trim().toLowerCase();
|
|
21
|
+
if (COLOR_INDEX.has(k)) return COLOR_INDEX.get(k);
|
|
22
|
+
if (k in COLOR_ALIASES) return COLOR_ALIASES[k];
|
|
23
|
+
const n = Number(k);
|
|
24
|
+
return Number.isFinite(n) && n >= 0 && n < 8 ? n : 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The Markers object of a project item. `Markers.getMarkers` wants the
|
|
28
|
+
* ClipProjectItem cast (a bare ProjectItem hands back nothing, measured 26.2). */
|
|
29
|
+
async function clipMarkersHolder(ppro, projectItem) {
|
|
30
|
+
let clip = projectItem;
|
|
31
|
+
try { if (ppro.ClipProjectItem && P.has(ppro.ClipProjectItem, "cast")) clip = ppro.ClipProjectItem.cast(projectItem) || projectItem; } catch (_) { /* not a clip */ }
|
|
32
|
+
let holder = null;
|
|
33
|
+
try { holder = await P.callAny(ppro.Markers, ["getMarkers"], clip); } catch (_) { holder = null; }
|
|
34
|
+
if (!holder && clip !== projectItem) { try { holder = await P.callAny(ppro.Markers, ["getMarkers"], projectItem); } catch (_) { holder = null; } }
|
|
35
|
+
if (!holder) throw new PeerError("no_markers", "Premiere has no marker list for this clip");
|
|
36
|
+
return holder;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function markersObjectFor(target) {
|
|
40
|
+
const ppro = P.api();
|
|
41
|
+
const kind = handles.kindOf(target);
|
|
42
|
+
const obj = g(target);
|
|
43
|
+
if (kind === "seq") {
|
|
44
|
+
const seq = obj;
|
|
45
|
+
const timebase = await TL.timebaseOf(seq);
|
|
46
|
+
return { holder: await P.callAny(ppro.Markers, ["getMarkers"], seq), timebase, scope: "timeline", seq };
|
|
47
|
+
}
|
|
48
|
+
if (kind === "item") {
|
|
49
|
+
let pi = null;
|
|
50
|
+
try { pi = await P.callAny(obj, ["getProjectItem"]); } catch (_) { /* none */ }
|
|
51
|
+
if (!pi) throw new PeerError("no_media", "this clip has no project item to carry markers");
|
|
52
|
+
const seq = await currentSeqOrNull();
|
|
53
|
+
const seqFps = seq ? T.fpsFromTimebase(await TL.timebaseOf(seq)) : 25;
|
|
54
|
+
const fps = await sourceFpsOf(pi, seqFps);
|
|
55
|
+
return { holder: await clipMarkersHolder(ppro, pi), timebase: T.timebaseFromFps(fps), scope: "clip", projectItem: pi };
|
|
56
|
+
}
|
|
57
|
+
if (kind === "clip") {
|
|
58
|
+
const seq = await currentSeqOrNull();
|
|
59
|
+
const seqFps = seq ? T.fpsFromTimebase(await TL.timebaseOf(seq)) : 25;
|
|
60
|
+
const fps = await sourceFpsOf(obj, seqFps);
|
|
61
|
+
return { holder: await clipMarkersHolder(ppro, obj), timebase: T.timebaseFromFps(fps), scope: "clip", projectItem: obj };
|
|
62
|
+
}
|
|
63
|
+
throw new PeerError("bad_handle", `markers live on a sequence or a clip, not a ${kind}`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function currentSeqOrNull() {
|
|
67
|
+
const p = await activeProject();
|
|
68
|
+
if (!p) return null;
|
|
69
|
+
try { return await P.callAny(p, ["getActiveSequence"]); } catch (_) { return null; }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function sourceFpsOf(pi, fallback) {
|
|
73
|
+
try {
|
|
74
|
+
if (P.has(pi, "getFootageInterpretation")) {
|
|
75
|
+
const fi = await pi.getFootageInterpretation();
|
|
76
|
+
const fr = fi && (P.has(fi, "getFrameRate") ? await fi.getFrameRate() : fi.frameRate);
|
|
77
|
+
if (fr && Number(fr) > 0) return Number(fr);
|
|
78
|
+
}
|
|
79
|
+
} catch (_) { /* fall back */ }
|
|
80
|
+
return fallback;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function markerList(holder) {
|
|
84
|
+
const list = await P.callAny(holder, ["getMarkers"]);
|
|
85
|
+
return Array.isArray(list) ? list : [];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function markerFields(m, timebase) {
|
|
89
|
+
const start = T.toTicks(m.start !== undefined ? m.start : (P.has(m, "getStart") ? await m.getStart() : 0));
|
|
90
|
+
const durT = T.toTicks(m.duration !== undefined ? m.duration : (P.has(m, "getDuration") ? await m.getDuration() : 0));
|
|
91
|
+
let color = "";
|
|
92
|
+
try { color = colorName(P.has(m, "getColorIndex") ? await m.getColorIndex() : (P.has(m, "getColor") ? await m.getColor() : m.colorIndex)); } catch (_) { color = ""; }
|
|
93
|
+
const name = m.name !== undefined ? m.name : (P.has(m, "getName") ? await m.getName() : "");
|
|
94
|
+
const comments = m.comments !== undefined ? m.comments : (P.has(m, "getComments") ? await m.getComments() : "");
|
|
95
|
+
const guid = m.guid !== undefined ? String(m.guid) : "";
|
|
96
|
+
return {
|
|
97
|
+
frame: T.ticksToFrames(start, timebase), color, name: String(name || ""), note: String(comments || ""),
|
|
98
|
+
duration: Math.max(1, T.ticksToFrames(durT, timebase) || 1), custom_data: guid, guid, type: m.type !== undefined ? m.type : (P.has(m, "getType") ? await m.getType() : ""),
|
|
99
|
+
_obj: m,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function findMarker(holder, timebase, frame) {
|
|
104
|
+
for (const m of await markerList(holder)) {
|
|
105
|
+
const f = await markerFields(m, timebase);
|
|
106
|
+
if (f.frame === Number(frame)) return f;
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function tick(ppro, ticks) {
|
|
112
|
+
if (ppro.TickTime && P.has(ppro.TickTime, "createWithTicks")) return ppro.TickTime.createWithTicks(String(ticks));
|
|
113
|
+
if (ppro.TickTime && P.has(ppro.TickTime, "createWithSeconds")) return ppro.TickTime.createWithSeconds(ticks / T.TICKS_PER_SECOND);
|
|
114
|
+
return ticks;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const verbs = {
|
|
118
|
+
"markers.list": async ({ target }) => {
|
|
119
|
+
const { holder, timebase, scope } = await markersObjectFor(target);
|
|
120
|
+
const out = [];
|
|
121
|
+
for (const m of await markerList(holder)) {
|
|
122
|
+
const f = await markerFields(m, timebase);
|
|
123
|
+
out.push({ frame: f.frame, color: f.color, name: f.name, note: f.note, duration: f.duration, custom_data: f.custom_data, scope, keywords: "" });
|
|
124
|
+
}
|
|
125
|
+
out.sort((a, b) => a.frame - b.frame);
|
|
126
|
+
return out;
|
|
127
|
+
},
|
|
128
|
+
"markers.add": async ({ target, frame, color, name, note, duration, custom_data }) => {
|
|
129
|
+
const ppro = P.api();
|
|
130
|
+
const project = await activeProject();
|
|
131
|
+
if (!project) throw new PeerError("no_project", "No project open");
|
|
132
|
+
const { holder, timebase } = await markersObjectFor(target);
|
|
133
|
+
const startTicks = T.framesToTicks(Number(frame), timebase);
|
|
134
|
+
const durTicks = T.framesToTicks(Math.max(1, Number(duration) || 1), timebase);
|
|
135
|
+
// MEASURED 26.2: the marker types are statics on `Marker`
|
|
136
|
+
// (MARKER_TYPE_COMMENT = "Comment"); `Constants.MarkerType` does not exist.
|
|
137
|
+
const type = (ppro.Marker && ppro.Marker.MARKER_TYPE_COMMENT) || (ppro.Constants && ppro.Constants.MarkerType && (ppro.Constants.MarkerType.COMMENT || ppro.Constants.MarkerType.MARKER)) || "Comment";
|
|
138
|
+
const n = await transact(project, `Add marker "${name || ""}"`, async (add) => {
|
|
139
|
+
add(() => P.callAnySync(holder, ["createAddMarkerAction"], String(name || ""), type, tick(ppro, startTicks), tick(ppro, durTicks), String(note || "")));
|
|
140
|
+
});
|
|
141
|
+
if (!n) return false;
|
|
142
|
+
// Colour is a second action on the created marker (there is no colour
|
|
143
|
+
// argument on add); the marker is the one now at that frame.
|
|
144
|
+
if (color) {
|
|
145
|
+
const created = await findMarker(holder, timebase, Number(frame));
|
|
146
|
+
if (created && (P.has(created._obj, "createSetColorByIndexAction") || P.has(created._obj, "createSetColorAction"))) {
|
|
147
|
+
await transact(project, "Marker colour", async (add) => { add(() => P.callAnySync(created._obj, ["createSetColorByIndexAction", "createSetColorAction"], colorIndex(color))); });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return true;
|
|
151
|
+
},
|
|
152
|
+
"markers.delete_at": async ({ target, frame }) => {
|
|
153
|
+
const project = await activeProject();
|
|
154
|
+
if (!project) throw new PeerError("no_project", "No project open");
|
|
155
|
+
const { holder, timebase } = await markersObjectFor(target);
|
|
156
|
+
const found = await findMarker(holder, timebase, Number(frame));
|
|
157
|
+
if (!found) return false;
|
|
158
|
+
const n = await transact(project, "Delete marker", async (add) => { add(() => P.callAnySync(holder, ["createRemoveMarkerAction"], found._obj)); });
|
|
159
|
+
return n > 0;
|
|
160
|
+
},
|
|
161
|
+
"markers.move": async ({ target, frame, to_frame }) => {
|
|
162
|
+
const ppro = P.api();
|
|
163
|
+
const project = await activeProject();
|
|
164
|
+
const { holder, timebase } = await markersObjectFor(target);
|
|
165
|
+
const found = await findMarker(holder, timebase, Number(frame));
|
|
166
|
+
if (!found) return false;
|
|
167
|
+
const n = await transact(project, "Move marker", async (add) => {
|
|
168
|
+
add(() => P.callAnySync(holder, ["createMoveMarkerAction"], found._obj, tick(ppro, T.framesToTicks(Number(to_frame), timebase))));
|
|
169
|
+
});
|
|
170
|
+
return n > 0;
|
|
171
|
+
},
|
|
172
|
+
"markers.set_color": async ({ target, frame, color }) => {
|
|
173
|
+
const project = await activeProject();
|
|
174
|
+
const { holder, timebase } = await markersObjectFor(target);
|
|
175
|
+
const found = await findMarker(holder, timebase, Number(frame));
|
|
176
|
+
if (!found) return false;
|
|
177
|
+
const n = await transact(project, "Marker colour", async (add) => { add(() => P.callAnySync(found._obj, ["createSetColorByIndexAction", "createSetColorAction"], colorIndex(color))); });
|
|
178
|
+
return n > 0;
|
|
179
|
+
},
|
|
180
|
+
"markers.set_text": async ({ target, frame, name, note }) => {
|
|
181
|
+
const project = await activeProject();
|
|
182
|
+
const { holder, timebase } = await markersObjectFor(target);
|
|
183
|
+
const found = await findMarker(holder, timebase, Number(frame));
|
|
184
|
+
if (!found) return false;
|
|
185
|
+
// MEASURED 26.2: the name and the comment must be SEPARATE transactions -
|
|
186
|
+
// both in one compound fails with "Script action failed to execute".
|
|
187
|
+
let n = 0;
|
|
188
|
+
if (name !== undefined && P.has(found._obj, "createSetNameAction")) {
|
|
189
|
+
n += await transact(project, "Marker name", async (add) => { add(await found._obj.createSetNameAction(String(name))); });
|
|
190
|
+
}
|
|
191
|
+
if (note !== undefined && P.has(found._obj, "createSetCommentsAction")) {
|
|
192
|
+
n += await transact(project, "Marker note", async (add) => { add(await found._obj.createSetCommentsAction(String(note))); });
|
|
193
|
+
}
|
|
194
|
+
return n > 0;
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
module.exports = { verbs, COLOR_NAMES, colorName, colorIndex, markerFields, h };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Pairing: where the bridge is and the token to reach it. The conform.tools
|
|
2
|
+
// engine (~/.conform-mcp) and the live desktop app (app.conform.tools) each write
|
|
3
|
+
// `<home>/host-bridge/pairing.json` (0600, new port and token on every start,
|
|
4
|
+
// deleted on stop). This panel READS it; the token never leaves the machine and
|
|
5
|
+
// is never shown in full. Both apps may run: the NEWEST valid file wins (a tie
|
|
6
|
+
// goes to the engine), so the panel follows whichever bridge started last - the
|
|
7
|
+
// same rule as the Python peers (mcp/hosts/peer-kit/ctpeer/pairing.py, which also
|
|
8
|
+
// honours CONFORM_MCP_HOME / CONFORM_TOOLS_DATA_ROOT; UXP has no environment).
|
|
9
|
+
//
|
|
10
|
+
// Three ways, in order: the files in the apps' data folders (needs the
|
|
11
|
+
// manifest's localFileSystem "fullAccess"); a folder the user picked once
|
|
12
|
+
// (persistent token); a pasted JSON (local only, kept in localStorage).
|
|
13
|
+
"use strict";
|
|
14
|
+
|
|
15
|
+
function dataDirs(home, platform) {
|
|
16
|
+
// The conform.tools engine (the conformtools MCP / CLI) first, then the desktop app.
|
|
17
|
+
if (platform === "win32") {
|
|
18
|
+
const appdata = (typeof process !== "undefined" && process.env && process.env.APPDATA) || `${home}\\AppData\\Roaming`;
|
|
19
|
+
return [`${home}\\.conform-mcp\\host-bridge\\pairing.json`, `${appdata}\\app.conform.tools\\host-bridge\\pairing.json`];
|
|
20
|
+
}
|
|
21
|
+
return [`${home}/.conform-mcp/host-bridge/pairing.json`, `${home}/Library/Application Support/app.conform.tools/host-bridge/pairing.json`];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function parsePairing(text) {
|
|
25
|
+
const p = JSON.parse(String(text));
|
|
26
|
+
if (!p || typeof p !== "object") throw new Error("pairing is not an object");
|
|
27
|
+
if (p.protocol !== 1) throw new Error(`pairing protocol ${p.protocol}, this plugin speaks 1`);
|
|
28
|
+
if (typeof p.url !== "string" || !/^ws:\/\/(127\.0\.0\.1|localhost):\d+\/host-bridge$/.test(p.url)) throw new Error("pairing url is not the loopback bridge");
|
|
29
|
+
if (typeof p.token !== "string" || !/^[0-9a-f]{64}$/.test(p.token)) throw new Error("pairing token is malformed");
|
|
30
|
+
return { url: p.url, token: p.token, port: Number(p.port) || Number(p.url.split(":")[2]) };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function maskToken(token) { return token ? `${token.slice(0, 6)}…${token.slice(-4)}` : ""; }
|
|
34
|
+
|
|
35
|
+
/** Build the reader for UXP; `deps` are injected so node tests run it. */
|
|
36
|
+
function makeReader(deps) {
|
|
37
|
+
const { readFileAt, pickedFolderRead, storage } = deps;
|
|
38
|
+
return async function readPairing() {
|
|
39
|
+
const errors = [];
|
|
40
|
+
let best = null;
|
|
41
|
+
for (const path of deps.candidates()) {
|
|
42
|
+
try {
|
|
43
|
+
const text = await readFileAt(path);
|
|
44
|
+
if (!text) continue;
|
|
45
|
+
const p = { ...parsePairing(text), source: path };
|
|
46
|
+
const mtime = deps.mtimeAt ? await deps.mtimeAt(path).catch(() => 0) : 0; // unknown age: oldest, never dropped
|
|
47
|
+
if (!best || mtime > best.mtime) best = { p, mtime };
|
|
48
|
+
} catch (e) { errors.push(`${path}: ${e.message || e}`); }
|
|
49
|
+
}
|
|
50
|
+
if (best) return best.p;
|
|
51
|
+
if (pickedFolderRead) {
|
|
52
|
+
try {
|
|
53
|
+
const text = await pickedFolderRead();
|
|
54
|
+
if (text) return { ...parsePairing(text), source: "picked folder" };
|
|
55
|
+
} catch (e) { errors.push(`picked folder: ${e.message || e}`); }
|
|
56
|
+
}
|
|
57
|
+
const pasted = storage && storage.getItem("conformtools.pairing");
|
|
58
|
+
if (pasted) {
|
|
59
|
+
try { return { ...parsePairing(pasted), source: "pasted" }; } catch (e) { errors.push(`pasted: ${e.message || e}`); }
|
|
60
|
+
}
|
|
61
|
+
const err = new Error(errors.length ? errors.join(" | ") : "no pairing found");
|
|
62
|
+
err.code = "unpaired";
|
|
63
|
+
throw err;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = { dataDirs, parsePairing, maskToken, makeReader };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// The one place the plugin touches the Premiere API module. Everything else
|
|
2
|
+
// goes through `api()` so the node tests can substitute a recorded fake.
|
|
3
|
+
//
|
|
4
|
+
// Premiere's UXP DOM is young (GA in 25.6) and parts of it are undocumented,
|
|
5
|
+
// so every call here is defensive: a missing method is a clear PeerError, not
|
|
6
|
+
// a TypeError deep inside a tool. `probe()` reports what THIS Premiere
|
|
7
|
+
// actually exposes; the live pass uses it to learn the real shapes.
|
|
8
|
+
"use strict";
|
|
9
|
+
|
|
10
|
+
const { PeerError } = require("./handles");
|
|
11
|
+
|
|
12
|
+
let _api = null;
|
|
13
|
+
let _uxp = null;
|
|
14
|
+
|
|
15
|
+
function api() {
|
|
16
|
+
if (_api) return _api;
|
|
17
|
+
try {
|
|
18
|
+
_api = require("premierepro");
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw new PeerError("no_premiere", "the premierepro module is not available (not running inside Premiere Pro?)");
|
|
21
|
+
}
|
|
22
|
+
return _api;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function uxp() {
|
|
26
|
+
if (_uxp) return _uxp;
|
|
27
|
+
try { _uxp = require("uxp"); } catch (_) { _uxp = null; }
|
|
28
|
+
return _uxp;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Tests inject a fake DOM. */
|
|
32
|
+
function setApi(fake) { _api = fake; }
|
|
33
|
+
|
|
34
|
+
function hostVersion() {
|
|
35
|
+
try {
|
|
36
|
+
const u = uxp();
|
|
37
|
+
const v = u && u.host && u.host.version;
|
|
38
|
+
return v ? String(v) : "";
|
|
39
|
+
} catch (_) { return ""; }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function platform() {
|
|
43
|
+
try {
|
|
44
|
+
const os = require("os");
|
|
45
|
+
const p = os.platform ? os.platform() : "";
|
|
46
|
+
return p === "darwin" || p === "win32" ? p : (p || "uxp");
|
|
47
|
+
} catch (_) { return "uxp"; }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Call `obj.name(...)` when it exists, else throw a PeerError naming it. */
|
|
51
|
+
async function call(obj, name, ...args) {
|
|
52
|
+
if (!obj || typeof obj[name] !== "function") {
|
|
53
|
+
throw new PeerError("api_missing", `Premiere API has no ${name} here`);
|
|
54
|
+
}
|
|
55
|
+
return await obj[name](...args);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Try several method names in order (the DOM has renamed things between
|
|
59
|
+
* 25.x and 26.x); returns the first that exists. */
|
|
60
|
+
async function callAny(obj, names, ...args) {
|
|
61
|
+
for (const n of names) {
|
|
62
|
+
if (obj && typeof obj[n] === "function") return await obj[n](...args);
|
|
63
|
+
}
|
|
64
|
+
throw new PeerError("api_missing", `Premiere API has none of ${names.join("/")} here`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** callAny, synchronously: the action factories (create*Action) inside project.lockedAccess(), whose callback
|
|
68
|
+
* must not await (26.3+: "Requires locked access" when an action is made outside it). */
|
|
69
|
+
function callAnySync(obj, names, ...args) {
|
|
70
|
+
for (const n of names) {
|
|
71
|
+
if (obj && typeof obj[n] === "function") return obj[n](...args);
|
|
72
|
+
}
|
|
73
|
+
throw new PeerError("api_missing", `Premiere API has none of ${names.join("/")} here`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function has(obj, name) { return !!obj && typeof obj[name] === "function"; }
|
|
77
|
+
|
|
78
|
+
/** Own + prototype member names of an object, for the probe. */
|
|
79
|
+
function members(obj) {
|
|
80
|
+
const out = new Set();
|
|
81
|
+
let o = obj;
|
|
82
|
+
let depth = 0;
|
|
83
|
+
while (o && depth < 4) {
|
|
84
|
+
for (const n of Object.getOwnPropertyNames(o)) if (n !== "constructor") out.add(n);
|
|
85
|
+
o = Object.getPrototypeOf(o);
|
|
86
|
+
depth += 1;
|
|
87
|
+
}
|
|
88
|
+
return Array.from(out).sort();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = { api, uxp, setApi, hostVersion, platform, call, callAny, callAnySync, has, members, PeerError };
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// `debug.probe`: what THIS Premiere exposes. Data only (member names and
|
|
2
|
+
// constant values); nothing is evaluated. The live pass reads this first.
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const { P, g, activeProject } = require("./ctx");
|
|
6
|
+
|
|
7
|
+
const verbs = {
|
|
8
|
+
// Which add / commit / lock arrangement lands a sequence marker on THIS Premiere (26.5.2 answered "Requires
|
|
9
|
+
// locked access" with the action made inside lockedAccess). Each variant adds one marker at its own frame
|
|
10
|
+
// (`frame` + i), reports the step that threw, then every marker it landed is removed again.
|
|
11
|
+
"debug.marker_probe": async ({ timeline, frame }) => {
|
|
12
|
+
const ppro = P.api();
|
|
13
|
+
const project = await activeProject();
|
|
14
|
+
const seq = timeline ? g(timeline, "seq") : await project.getActiveSequence();
|
|
15
|
+
const tb = Number(await seq.getTimebase());
|
|
16
|
+
const t = (f) => ppro.TickTime.createWithTicks(String(Math.round(f * tb)));
|
|
17
|
+
const type = (ppro.Marker && ppro.Marker.MARKER_TYPE_COMMENT) || "Comment";
|
|
18
|
+
const base = Number(frame || 300);
|
|
19
|
+
const out = {};
|
|
20
|
+
const run = (label, fn) => { try { const r = fn(); out[label] = { ok: true, ...(r && typeof r === "object" ? r : {}) }; } catch (e) { out[label] = { ok: false, error: String(e && e.message || e), stack: String(e && e.stack || "").split("\n").slice(0, 3).join(" | ") }; } };
|
|
21
|
+
let holder = await ppro.Markers.getMarkers(seq);
|
|
22
|
+
const mk = (i) => holder.createAddMarkerAction(`ct-probe-${i}`, type, t(base + i), t(1), "conform.tools lock probe");
|
|
23
|
+
// A: made + committed inside lockedAccess
|
|
24
|
+
run("A_inside_lock", () => { let err = null; project.lockedAccess(() => { try { const a = mk(0); project.executeTransaction((c) => c.addAction(a), "probe A"); } catch (e) { err = e; } }); if (err) throw err; });
|
|
25
|
+
// B: made inside the transaction callback, inside the lock
|
|
26
|
+
run("B_inside_transaction", () => { let err = null; project.lockedAccess(() => { try { project.executeTransaction((c) => c.addAction(mk(1)), "probe B"); } catch (e) { err = e; } }); if (err) throw err; });
|
|
27
|
+
// C: no lock at all
|
|
28
|
+
run("C_no_lock", () => { const a = mk(2); project.executeTransaction((c) => c.addAction(a), "probe C"); });
|
|
29
|
+
// D: made outside, committed inside the lock
|
|
30
|
+
run("D_made_outside", () => { const a = mk(3); let err = null; project.lockedAccess(() => { try { project.executeTransaction((c) => c.addAction(a), "probe D"); } catch (e) { err = e; } }); if (err) throw err; });
|
|
31
|
+
// E: no lock, made inside the transaction callback
|
|
32
|
+
run("E_txn_only", () => { project.executeTransaction((c) => c.addAction(mk(4)), "probe E"); });
|
|
33
|
+
// F: a fresh Markers object (fetched now), then A
|
|
34
|
+
holder = await ppro.Markers.getMarkers(seq);
|
|
35
|
+
run("F_fresh_holder", () => { let err = null; project.lockedAccess(() => { try { const a = mk(5); project.executeTransaction((c) => c.addAction(a), "probe F"); } catch (e) { err = e; } }); if (err) throw err; });
|
|
36
|
+
// what landed
|
|
37
|
+
holder = await ppro.Markers.getMarkers(seq);
|
|
38
|
+
let landed = [];
|
|
39
|
+
try { landed = holder.getMarkers().filter((m) => String(m.name || "").startsWith("ct-probe-")); } catch (e) { out.list_error = String(e.message || e); }
|
|
40
|
+
out.landed = landed.map((m) => m.name);
|
|
41
|
+
// clean up with whichever arrangement works for a remove
|
|
42
|
+
const removed = {};
|
|
43
|
+
for (const m of landed) {
|
|
44
|
+
for (const [label, fn] of [["inside_lock", () => { let err = null; project.lockedAccess(() => { try { const a = holder.createRemoveMarkerAction(m); project.executeTransaction((c) => c.addAction(a), "probe cleanup"); } catch (e) { err = e; } }); if (err) throw err; }],
|
|
45
|
+
["no_lock", () => { const a = holder.createRemoveMarkerAction(m); project.executeTransaction((c) => c.addAction(a), "probe cleanup"); }]]) {
|
|
46
|
+
try { fn(); removed[m.name] = label; break; } catch (e) { removed[m.name] = `failed: ${e.message || e}`; }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
out.removed = removed;
|
|
50
|
+
return out;
|
|
51
|
+
},
|
|
52
|
+
// Which createInsertProjectItemAction / createOverwriteItemAction argument shapes THIS Premiere accepts: each is
|
|
53
|
+
// only CREATED under the lock (never committed), so nothing in the sequence changes. {timeline, clip, frame}
|
|
54
|
+
"debug.place_probe": async ({ timeline, clip, frame }) => {
|
|
55
|
+
const ppro = P.api();
|
|
56
|
+
const project = await activeProject();
|
|
57
|
+
const seq = g(timeline, "seq");
|
|
58
|
+
const raw = g(clip);
|
|
59
|
+
let cast = raw;
|
|
60
|
+
try { cast = ppro.ClipProjectItem.cast(raw) || raw; } catch (_) { /* raw */ }
|
|
61
|
+
const editor = await ppro.SequenceEditor.getEditor(seq);
|
|
62
|
+
const tb = Number(await seq.getTimebase());
|
|
63
|
+
const vCount = await seq.getVideoTrackCount();
|
|
64
|
+
const aCount = await seq.getAudioTrackCount();
|
|
65
|
+
const times = { ticktime: ppro.TickTime.createWithTicks(String(Math.round(Number(frame || 0) * tb))), seconds_tt: ppro.TickTime.createWithSeconds(Number(frame || 0) * tb / 254016000000) };
|
|
66
|
+
const out = { vCount, aCount, raw_type: String(raw && raw.type), insert: {}, overwrite: {} };
|
|
67
|
+
project.lockedAccess(() => {
|
|
68
|
+
for (const [iname, item] of [["raw", raw], ["cast", cast]]) {
|
|
69
|
+
for (const [tname, t] of Object.entries(times)) {
|
|
70
|
+
for (const v of [0, vCount - 1, vCount]) {
|
|
71
|
+
for (const a of [-1, 0, aCount - 1, aCount]) {
|
|
72
|
+
for (const lim of [true, false]) {
|
|
73
|
+
const key = `${iname}/${tname}/v${v}/a${a}/lim${lim}`;
|
|
74
|
+
try { const act = editor.createInsertProjectItemAction(item, t, v, a, lim); out.insert[key] = act ? "ok" : "null"; } catch (e) { out.insert[key] = String(e.message || e); }
|
|
75
|
+
}
|
|
76
|
+
const key = `${iname}/${tname}/v${v}/a${a}`;
|
|
77
|
+
try { const act = editor.createOverwriteItemAction(item, t, v, a); out.overwrite[key] = act ? "ok" : "null"; } catch (e) { out.overwrite[key] = String(e.message || e); }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return out;
|
|
84
|
+
},
|
|
85
|
+
// What a sequence's settings object holds and offers (for an in-place resize): members and current values of
|
|
86
|
+
// getSettings(), the frame size, and whether createSetSettingsAction exists. Read-only.
|
|
87
|
+
"debug.settings_probe": async ({ timeline }) => {
|
|
88
|
+
const seq = g(timeline, "seq");
|
|
89
|
+
const st = await seq.getSettings();
|
|
90
|
+
const out = { members: P.members(st), values: {}, frame: null, has_set: P.has(seq, "createSetSettingsAction") };
|
|
91
|
+
for (const m of out.members) {
|
|
92
|
+
if (!/^get/.test(m)) continue;
|
|
93
|
+
try { const v = await st[m](); out.values[m] = v && typeof v === "object" ? { str: String(v), members: P.members(v).filter((x) => !/^__|^(constructor|hasOwnProperty|isPrototypeOf|propertyIsEnumerable|toLocaleString|toString|valueOf)$/.test(x)).slice(0, 20), w: v.width, h: v.height, value: v.value } : v; } catch (e) { out.values[m] = `error: ${e.message || e}`; }
|
|
94
|
+
}
|
|
95
|
+
try { out.frame = await seq.getFrameSize(); out.frame = { w: out.frame.width, h: out.frame.height }; } catch (_) { /* none */ }
|
|
96
|
+
return out;
|
|
97
|
+
},
|
|
98
|
+
// ProjectConverter's OTIO export, signature probed like the XML one: does it write without a modal report?
|
|
99
|
+
"timeline_write.export_otio": async ({ project, timeline, path }) => {
|
|
100
|
+
const ppro = P.api();
|
|
101
|
+
const p = project ? g(project, "project") : await activeProject();
|
|
102
|
+
const seq = timeline ? g(timeline, "seq") : await p.getActiveSequence();
|
|
103
|
+
const conv = ppro.ProjectConverter;
|
|
104
|
+
const errors = [];
|
|
105
|
+
for (const [label, fn] of [["sequence,path", () => conv.exportAsOpenTimelineIO(seq, String(path))], ["project,path,sequence", () => conv.exportAsOpenTimelineIO(p, String(path), seq)], ["project,sequence,path", () => conv.exportAsOpenTimelineIO(p, seq, String(path))]]) {
|
|
106
|
+
try { const ok = await fn(); if (ok !== false && ok !== undefined) return { ok: true, how: label, errors, path: String(path) }; errors.push(`${label}: returned ${ok}`); } catch (e) { errors.push(`${label}: ${e.message || e}`); }
|
|
107
|
+
}
|
|
108
|
+
return { ok: false, how: "", errors, path: String(path) };
|
|
109
|
+
},
|
|
110
|
+
// Try every plausible createKeyframe / createSetValueAction shape on ONE
|
|
111
|
+
// Motion param of `item` (Scale), inside a real transaction, and report
|
|
112
|
+
// which builds and which raises - so the write path uses the form Premiere
|
|
113
|
+
// actually wants. Data only; it writes Scale to itself (no net change).
|
|
114
|
+
"debug.sizing_probe": async ({ item }) => {
|
|
115
|
+
const PP = P;
|
|
116
|
+
const ppro = PP.api();
|
|
117
|
+
const it = g(item, "item");
|
|
118
|
+
const chain = await it.getComponentChain();
|
|
119
|
+
let motion = null;
|
|
120
|
+
for (let i = 0, n = await chain.getComponentCount(); i < n; i += 1) {
|
|
121
|
+
const c = await chain.getComponentAtIndex(i);
|
|
122
|
+
if (String(await c.getMatchName()).indexOf("Motion") >= 0) { motion = c; break; }
|
|
123
|
+
}
|
|
124
|
+
if (!motion) return { error: "no motion" };
|
|
125
|
+
let scale = null; let pos = null;
|
|
126
|
+
for (let j = 0, pn = await motion.getParamCount(); j < pn; j += 1) {
|
|
127
|
+
const prm = await motion.getParam(j);
|
|
128
|
+
if (String(prm.displayName) === "Scale") scale = prm;
|
|
129
|
+
if (String(prm.displayName) === "Position") pos = prm;
|
|
130
|
+
}
|
|
131
|
+
const out = { keyframe_forms: {}, setvalue_forms: {} };
|
|
132
|
+
const val = 130;
|
|
133
|
+
// createKeyframe variants
|
|
134
|
+
const tick0 = ppro.TickTime && ppro.TickTime.TIME_ZERO;
|
|
135
|
+
const kfTries = {
|
|
136
|
+
"num": () => scale.createKeyframe(val),
|
|
137
|
+
"num,tick": () => scale.createKeyframe(val, tick0),
|
|
138
|
+
"noarg": () => scale.createKeyframe(),
|
|
139
|
+
"obj_value": () => scale.createKeyframe({ value: val }),
|
|
140
|
+
};
|
|
141
|
+
let goodKf = null; let goodKfName = null;
|
|
142
|
+
for (const [name, fn] of Object.entries(kfTries)) {
|
|
143
|
+
try { const k = await fn(); out.keyframe_forms[name] = k === undefined ? "undefined" : (k && typeof k === "object" ? Object.keys(k).slice(0, 8) : String(k)); if (goodKf === null && k) { goodKf = k; goodKfName = name; } }
|
|
144
|
+
catch (e) { out.keyframe_forms[name] = "ERR " + (e.message || e); }
|
|
145
|
+
}
|
|
146
|
+
out.good_keyframe = goodKfName;
|
|
147
|
+
// createSetValueAction variants, each committed in its own transaction
|
|
148
|
+
const svTries = {
|
|
149
|
+
"value,ui": () => scale.createSetValueAction(val, true),
|
|
150
|
+
"value": () => scale.createSetValueAction(val),
|
|
151
|
+
"keyframe,ui": () => goodKf && scale.createSetValueAction(goodKf, true),
|
|
152
|
+
"keyframe": () => goodKf && scale.createSetValueAction(goodKf),
|
|
153
|
+
};
|
|
154
|
+
for (const [name, fn] of Object.entries(svTries)) {
|
|
155
|
+
try {
|
|
156
|
+
const action = await fn();
|
|
157
|
+
if (!action) { out.setvalue_forms[name] = "no-keyframe"; continue; }
|
|
158
|
+
await it.getProjectItem(); // touch, no-op
|
|
159
|
+
const proj = await PP.callAny(ppro.Project, ["getActiveProject"]);
|
|
160
|
+
let committed = false;
|
|
161
|
+
const run = () => { proj.executeTransaction((c) => c.addAction(action), "probe"); committed = true; };
|
|
162
|
+
if (PP.has(proj, "lockedAccess")) proj.lockedAccess(run); else run();
|
|
163
|
+
out.setvalue_forms[name] = committed ? "OK" : "built-not-committed";
|
|
164
|
+
} catch (e) { out.setvalue_forms[name] = "ERR " + (e.message || e); }
|
|
165
|
+
}
|
|
166
|
+
// Also whether the param itself has a direct setter
|
|
167
|
+
out.scale_members = PP.members(scale).filter((m) => /[Ss]et|[Kk]ey|[Vv]alue/.test(m));
|
|
168
|
+
return out;
|
|
169
|
+
},
|
|
170
|
+
"debug.probe": async () => {
|
|
171
|
+
const ppro = P.api();
|
|
172
|
+
const out = { host_version: P.hostVersion(), platform: P.platform(), top: Object.keys(ppro).sort(), classes: {}, constants: {} };
|
|
173
|
+
for (const k of ["Project", "Sequence", "VideoTrack", "VideoClipTrackItem", "TrackItem", "Markers", "Marker", "Metadata", "ClipProjectItem", "FolderItem", "ProjectItem", "ComponentChain", "Component", "ComponentParam", "Keyframe", "TickTime", "SequenceEditor", "EncoderManager", "ProjectConverter", "VideoFilterFactory", "PointF", "Media"]) {
|
|
174
|
+
if (ppro[k]) out.classes[k] = { static: P.members(ppro[k]).filter((n) => !["length", "name", "prototype"].includes(n)), proto: ppro[k].prototype ? P.members(ppro[k].prototype) : [] };
|
|
175
|
+
}
|
|
176
|
+
if (ppro.Constants) for (const k of Object.keys(ppro.Constants)) { try { out.constants[k] = ppro.Constants[k]; } catch (_) { /* skip */ } }
|
|
177
|
+
try {
|
|
178
|
+
const p = await activeProject();
|
|
179
|
+
if (p) {
|
|
180
|
+
out.project = { members: P.members(p), name: p.name, path: p.path };
|
|
181
|
+
const seq = P.has(p, "getActiveSequence") ? await p.getActiveSequence() : null;
|
|
182
|
+
if (seq) {
|
|
183
|
+
out.sequence = { members: P.members(seq), name: seq.name, timebase: String(await seq.getTimebase()) };
|
|
184
|
+
const track = P.has(seq, "getVideoTrack") ? await seq.getVideoTrack(0) : null;
|
|
185
|
+
if (track) {
|
|
186
|
+
out.track = { members: P.members(track) };
|
|
187
|
+
const items = await track.getTrackItems(ppro.Constants && ppro.Constants.TrackItemType ? ppro.Constants.TrackItemType.CLIP : 1, false);
|
|
188
|
+
// Every clip's raw numbers, as Premiere hands them out (ticks and
|
|
189
|
+
// seconds): what the model's frame maths is built on.
|
|
190
|
+
const tickOf = (v) => (v && typeof v === "object" ? { ticks: String(v.ticks !== undefined ? v.ticks : ""), seconds: Number(v.seconds !== undefined ? v.seconds : NaN) } : v);
|
|
191
|
+
out.items_raw = [];
|
|
192
|
+
for (const it of items || []) {
|
|
193
|
+
const row = {};
|
|
194
|
+
for (const m of ["getStartTime", "getEndTime", "getInPoint", "getOutPoint", "getDuration", "getSpeed", "isSpeedReversed", "isDisabled", "getName"]) {
|
|
195
|
+
try { row[m] = P.has(it, m) ? tickOf(await it[m]()) : "n/a"; } catch (e) { row[m] = `error: ${e.message || e}`; }
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
const chain = P.has(it, "getComponentChain") ? await it.getComponentChain() : null;
|
|
199
|
+
const n = chain ? await chain.getComponentCount() : 0;
|
|
200
|
+
row.params = [];
|
|
201
|
+
for (let i = 0; i < n; i += 1) {
|
|
202
|
+
const c = await chain.getComponentAtIndex(i);
|
|
203
|
+
const pn = P.has(c, "getParamCount") ? await c.getParamCount() : 0;
|
|
204
|
+
for (let j = 0; j < pn; j += 1) {
|
|
205
|
+
const prm = await c.getParam(j);
|
|
206
|
+
let v = null;
|
|
207
|
+
try { v = P.has(prm, "getStartValue") ? await prm.getStartValue() : null; } catch (e) { v = `error: ${e.message || e}`; }
|
|
208
|
+
const val = v && typeof v === "object" ? { keys: Object.keys(v), value: v.value !== undefined ? (v.value && typeof v.value === "object" ? { x: v.value.x, y: v.value.y, keys: Object.keys(v.value) } : v.value) : undefined, x: v.x, y: v.y } : v;
|
|
209
|
+
let varying = null;
|
|
210
|
+
try { varying = P.has(prm, "isTimeVarying") ? await prm.isTimeVarying() : null; } catch (_) { varying = null; }
|
|
211
|
+
row.params.push({ component: P.has(c, "getDisplayName") ? await c.getDisplayName() : "", index: j, name: prm.displayName, start_value: val, time_varying: varying });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
} catch (e) { row.params_error = String(e.message || e); }
|
|
215
|
+
out.items_raw.push(row);
|
|
216
|
+
}
|
|
217
|
+
if (items && items[0]) {
|
|
218
|
+
const it = items[0];
|
|
219
|
+
out.item = { members: P.members(it) };
|
|
220
|
+
const chain = P.has(it, "getComponentChain") ? await it.getComponentChain() : null;
|
|
221
|
+
if (chain) {
|
|
222
|
+
const n = await chain.getComponentCount();
|
|
223
|
+
out.components = [];
|
|
224
|
+
for (let i = 0; i < n; i += 1) {
|
|
225
|
+
const c = await chain.getComponentAtIndex(i);
|
|
226
|
+
const pn = P.has(c, "getParamCount") ? await c.getParamCount() : 0;
|
|
227
|
+
const params = [];
|
|
228
|
+
for (let j = 0; j < pn; j += 1) { const prm = await c.getParam(j); params.push({ index: j, displayName: prm.displayName, members: P.members(prm).slice(0, 40) }); }
|
|
229
|
+
out.components.push({ match: P.has(c, "getMatchName") ? await c.getMatchName() : "", display: P.has(c, "getDisplayName") ? await c.getDisplayName() : "", params });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
} catch (e) { out.probe_error = String(e && e.message || e); }
|
|
237
|
+
return out;
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
module.exports = { verbs };
|