@ajsmonty/adobe-mcp 1.1.2 → 1.5.0
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/CHANGELOG.md +19 -0
- package/README.md +361 -119
- package/SECURITY.md +24 -1
- package/adapters/ae_more.mjs +208 -0
- package/adapters/an.mjs +96 -0
- package/adapters/assets.mjs +194 -0
- package/adapters/blender.mjs +230 -0
- package/adapters/id.mjs +250 -0
- package/adapters/ppro.mjs +4 -3
- package/adapters/ppro_more.mjs +393 -0
- package/adapters/ps_ai_more.mjs +277 -0
- package/adapters/substance.mjs +193 -0
- package/adapters/texlib.mjs +193 -0
- package/bridges/blender/adobe_mcp_bridge.py +132 -0
- package/cep/mcp-bridge/CSXS/manifest.xml +36 -2
- package/cep/mcp-bridge/main.js +48 -20
- package/cli/doctor.mjs +234 -0
- package/cli/index.mjs +67 -0
- package/cli/install.mjs +149 -0
- package/core/barrows.mjs +16 -0
- package/core/blender_pbr.py +148 -0
- package/core/bridge.mjs +166 -77
- package/core/harness.jsx +11 -6
- package/core/harness.py +34 -0
- package/core/helpers.mjs +196 -0
- package/core/platform.mjs +209 -0
- package/core/pybridge.mjs +256 -0
- package/core/telemetry.mjs +80 -0
- package/core/texlib.mjs +279 -0
- package/core/win/run_com.js +33 -0
- package/core/workspace.mjs +1 -1
- package/knowledge/knowledge.mjs +8 -5
- package/knowledge/lessons.jsonl +19 -0
- package/package.json +56 -3
- package/scripts/ae/Cinematic_3D_Composite.jsx +173 -0
- package/scripts/blender/Creature_Walk_Cinematic.py +569 -0
- package/scripts/substance/Creature_Skin_LookDev.py +148 -0
- package/server.mjs +92 -27
- package/workflow/setup.mjs +106 -0
- package/workflow/vfx.mjs +136 -0
- package/workflow/workflow.mjs +66 -21
package/workflow/workflow.mjs
CHANGED
|
@@ -4,10 +4,15 @@ import fs from "node:fs";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { runJSX, WORKSPACE, APPS } from "../core/bridge.mjs";
|
|
7
|
+
import { runBlender, runPainter, blenderSaveSnippet } from "../core/pybridge.mjs";
|
|
7
8
|
|
|
8
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
10
|
const SCRIPTS_ROOT = path.join(__dirname, "..", "scripts");
|
|
10
11
|
const MANIFEST = path.join(WORKSPACE, "assets.json");
|
|
12
|
+
// Python-scripted apps: library scripts are .py, run through the Python bridges.
|
|
13
|
+
const PY_APPS = { blender: runBlender, substance: runPainter };
|
|
14
|
+
const scriptApps = () => [...Object.keys(APPS), ...Object.keys(PY_APPS)];
|
|
15
|
+
const SCRIPT_EXT = (a) => (PY_APPS[a] ? /\.py$/i : /\.(jsx|jsxbin)$/i);
|
|
11
16
|
|
|
12
17
|
function loadManifest() {
|
|
13
18
|
try { return JSON.parse(fs.readFileSync(MANIFEST, "utf8")); } catch { return []; }
|
|
@@ -30,8 +35,8 @@ export function register(server, { text, errText, registerAsset }) {
|
|
|
30
35
|
"The shared cross-app asset registry. Every export/render from any adapter registers here " +
|
|
31
36
|
"with {id, app, kind, path}. Use it to pull one app's output into another.",
|
|
32
37
|
inputSchema: {
|
|
33
|
-
app: z.string().optional().describe("Filter by app (ae/ps/ai/ppro)."),
|
|
34
|
-
kind: z.string().optional().describe("Filter by kind (png/svg/psd/ai/video...)."),
|
|
38
|
+
app: z.string().optional().describe("Filter by app (ae/ps/ai/ppro/blender/substance)."),
|
|
39
|
+
kind: z.string().optional().describe("Filter by kind (png/svg/psd/ai/video/texture/image-sequence/blend...)."),
|
|
35
40
|
},
|
|
36
41
|
},
|
|
37
42
|
async ({ app, kind }) => {
|
|
@@ -55,21 +60,34 @@ export function register(server, { text, errText, registerAsset }) {
|
|
|
55
60
|
description:
|
|
56
61
|
"Import a file into the AE project. Layered .psd (Photoshop) and .ai (Illustrator) files can " +
|
|
57
62
|
"import as a COMP — every source layer becomes an animatable AE layer. This is the design→" +
|
|
58
|
-
"motion handoff."
|
|
63
|
+
"motion handoff. For Blender renders pass the first frame of a sequence (or its folder) with " +
|
|
64
|
+
"sequence=true and the render fps.",
|
|
59
65
|
inputSchema: {
|
|
60
|
-
file_path: z.string().describe("Absolute path (.psd/.ai for layered import, or
|
|
66
|
+
file_path: z.string().describe("Absolute path (.psd/.ai for layered import, any footage, or a sequence folder/first frame)."),
|
|
61
67
|
import_as: z.enum(["comp", "footage"]).optional().describe("Default comp for .psd/.ai, else footage."),
|
|
68
|
+
sequence: z.boolean().optional().describe("Import as a numbered image sequence (default: true when file_path is a folder)."),
|
|
69
|
+
fps: z.number().optional().describe("Conform the sequence frame rate (e.g. 24)."),
|
|
62
70
|
},
|
|
63
71
|
},
|
|
64
|
-
async ({ file_path, import_as }) => {
|
|
72
|
+
async ({ file_path, import_as, sequence, fps }) => {
|
|
65
73
|
try {
|
|
66
|
-
|
|
74
|
+
let target = file_path;
|
|
75
|
+
let isSeq = sequence ?? false;
|
|
76
|
+
if (fs.existsSync(file_path) && fs.statSync(file_path).isDirectory()) {
|
|
77
|
+
const first = fs.readdirSync(file_path).filter((f) => /\.(png|exr|tif|tiff|jpg|dpx)$/i.test(f)).sort()[0];
|
|
78
|
+
if (!first) throw new Error(`No image frames in ${file_path}`);
|
|
79
|
+
target = path.join(file_path, first);
|
|
80
|
+
isSeq = sequence ?? true;
|
|
81
|
+
}
|
|
82
|
+
const ext = path.extname(target).toLowerCase();
|
|
67
83
|
const asComp = import_as ? import_as === "comp" : ext === ".psd" || ext === ".ai";
|
|
68
84
|
const jsx = `
|
|
69
|
-
var io = new ImportOptions(new File(${JSON.stringify(
|
|
70
|
-
if (!io.file.exists) throw new Error('File not found: ' + ${JSON.stringify(
|
|
85
|
+
var io = new ImportOptions(new File(${JSON.stringify(target)}));
|
|
86
|
+
if (!io.file.exists) throw new Error('File not found: ' + ${JSON.stringify(target)});
|
|
71
87
|
${asComp ? "if (io.canImportAs(ImportAsType.COMP)) io.importAs = ImportAsType.COMP;" : ""}
|
|
88
|
+
${isSeq ? "io.sequence = true;" : ""}
|
|
72
89
|
var item = app.project.importFile(io);
|
|
90
|
+
${fps ? `if (item.mainSource && item.mainSource.conformFrameRate !== undefined) item.mainSource.conformFrameRate = ${Number(fps)};` : ""}
|
|
73
91
|
return { imported: item.name, type: item.typeName,
|
|
74
92
|
isComp: item instanceof CompItem,
|
|
75
93
|
numLayers: (item instanceof CompItem) ? item.numLayers : null };`;
|
|
@@ -113,27 +131,29 @@ return { placed: ${JSON.stringify(path.basename(file_path))}, layer: app.activeD
|
|
|
113
131
|
{
|
|
114
132
|
title: "List installed script tools",
|
|
115
133
|
description:
|
|
116
|
-
"List
|
|
117
|
-
"descriptions from header comments.",
|
|
134
|
+
"List tools in the per-app scripts library (scripts/{ae,ps,ai,ppro}/*.jsx, " +
|
|
135
|
+
"scripts/{blender,substance}/*.py), with descriptions from header comments/docstrings.",
|
|
118
136
|
inputSchema: {
|
|
119
|
-
app: z.string().optional().describe("Filter to one app (ae/ps/ai/ppro)."),
|
|
137
|
+
app: z.string().optional().describe("Filter to one app (ae/ps/ai/ppro/blender/substance)."),
|
|
120
138
|
},
|
|
121
139
|
},
|
|
122
140
|
async ({ app }) => {
|
|
123
141
|
try {
|
|
124
|
-
const apps = app ? [app] :
|
|
142
|
+
const apps = app ? [app] : scriptApps();
|
|
125
143
|
const out = {};
|
|
126
144
|
for (const a of apps) {
|
|
127
145
|
const dir = path.join(SCRIPTS_ROOT, a);
|
|
128
146
|
let entries = [];
|
|
129
|
-
try { entries = fs.readdirSync(dir).filter((f) =>
|
|
147
|
+
try { entries = fs.readdirSync(dir).filter((f) => SCRIPT_EXT(a).test(f)); } catch { /* none */ }
|
|
130
148
|
out[a] = entries.map((f) => {
|
|
131
149
|
let description = "[compiled .jsxbin]";
|
|
132
|
-
if (/\.jsx$/i.test(f)) {
|
|
150
|
+
if (/\.(jsx|py)$/i.test(f)) {
|
|
133
151
|
try {
|
|
134
152
|
const head = fs.readFileSync(path.join(dir, f), "utf8").slice(0, 1500);
|
|
135
|
-
const m =
|
|
136
|
-
|
|
153
|
+
const m = /\.py$/i.test(f)
|
|
154
|
+
? head.match(/^\s*(?:"""|''')([\s\S]*?)(?:"""|''')/) || head.match(/^((?:\s*#[^\n]*\n)+)/)
|
|
155
|
+
: head.match(/\/\*+([\s\S]*?)\*\//) || head.match(/^((?:\s*\/\/[^\n]*\n)+)/);
|
|
156
|
+
description = m ? m[1].replace(/^\s*(\/\/|\*|#)?\s?/gm, "").replace(/\s+/g, " ").trim().slice(0, 250) : "(no header)";
|
|
137
157
|
} catch { description = "(unreadable)"; }
|
|
138
158
|
}
|
|
139
159
|
return { name: f, description };
|
|
@@ -153,24 +173,44 @@ return { placed: ${JSON.stringify(path.basename(file_path))}, layer: app.activeD
|
|
|
153
173
|
description:
|
|
154
174
|
"Execute a script from the library in its app (like File → Scripts → Run Script File). Action " +
|
|
155
175
|
"scripts run immediately; ScriptUI panels open for the user. Set up selections first via the " +
|
|
156
|
-
"app's run_extendscript."
|
|
176
|
+
"app's run_extendscript. `params` is exposed to the script as PARAMS (JSX: $.global.PARAMS; " +
|
|
177
|
+
"Python: a PARAMS dict) — each script's header lists its keys. Scripts that report back " +
|
|
178
|
+
"(JSX: $.global.MCP_RESULT, Python: result) return that value.",
|
|
157
179
|
inputSchema: {
|
|
158
|
-
app: z.string().describe("Which app: ae/ps/ai/ppro."),
|
|
180
|
+
app: z.string().describe("Which app: ae/ps/ai/ppro/blender/substance."),
|
|
159
181
|
name: z.string().describe("Script filename from list_scripts (case-insensitive)."),
|
|
160
|
-
|
|
182
|
+
params: z.record(z.any()).optional().describe("Parameters passed to the script as PARAMS."),
|
|
183
|
+
mode: z.enum(["auto", "live", "background"]).optional().describe("Blender only: bridge mode."),
|
|
184
|
+
blend_file: z.string().optional().describe("Blender only: .blend to open in background mode."),
|
|
185
|
+
save_as: z.string().optional().describe("Blender only: save the .blend here after the script runs."),
|
|
186
|
+
timeout_seconds: z.number().optional().describe("Max seconds (default 120; 600 for Blender)."),
|
|
161
187
|
},
|
|
162
188
|
},
|
|
163
|
-
async ({ app, name, timeout_seconds }) => {
|
|
189
|
+
async ({ app, name, params, mode, blend_file, save_as, timeout_seconds }) => {
|
|
164
190
|
try {
|
|
165
191
|
const dir = path.join(SCRIPTS_ROOT, app);
|
|
166
192
|
const match = fs.readdirSync(dir).find((f) => f.toLowerCase() === name.toLowerCase());
|
|
167
193
|
if (!match) throw new Error(`No script "${name}" in scripts/${app}/.`);
|
|
168
194
|
const full = path.join(dir, match);
|
|
195
|
+
if (PY_APPS[app]) {
|
|
196
|
+
let py = `PARAMS = ${JSON.stringify(JSON.stringify(params ?? {}))}\nimport json as __json\nPARAMS = __json.loads(PARAMS)\n`;
|
|
197
|
+
py += fs.readFileSync(full, "utf8");
|
|
198
|
+
if (app === "blender" && save_as)
|
|
199
|
+
py += blenderSaveSnippet(save_as);
|
|
200
|
+
const timeoutMs = (timeout_seconds ?? (app === "blender" ? 600 : 120)) * 1000;
|
|
201
|
+
const r = await PY_APPS[app](py, { mode, blendFile: blend_file, timeoutMs });
|
|
202
|
+
if (app === "blender" && save_as) registerAsset({ app: "blender", kind: "blend", path: save_as, meta: { script: match } });
|
|
203
|
+
return text({ ran: match, ...r });
|
|
204
|
+
}
|
|
169
205
|
const jsx = `
|
|
170
206
|
var __sf = new File(${JSON.stringify(full)});
|
|
171
207
|
if (!__sf.exists) throw new Error('Script not found: ' + __sf.fsName);
|
|
208
|
+
$.global.PARAMS = ${params ? toES3Literal(params) : "undefined"};
|
|
209
|
+
$.global.MCP_RESULT = undefined;
|
|
172
210
|
$.evalFile(__sf);
|
|
173
|
-
|
|
211
|
+
var __r = $.global.MCP_RESULT;
|
|
212
|
+
$.global.PARAMS = undefined; $.global.MCP_RESULT = undefined;
|
|
213
|
+
return __r === undefined ? 'Ran ' + ${JSON.stringify(match)} : __r;`;
|
|
174
214
|
return text(await runJSX(app, jsx, (timeout_seconds ?? 120) * 1000));
|
|
175
215
|
} catch (e) {
|
|
176
216
|
return errText(e);
|
|
@@ -178,3 +218,8 @@ return 'Ran ' + ${JSON.stringify(match)};`;
|
|
|
178
218
|
}
|
|
179
219
|
);
|
|
180
220
|
}
|
|
221
|
+
|
|
222
|
+
// JSON is a valid ES3 object literal as long as it has no U+2028/2029 line separators.
|
|
223
|
+
function toES3Literal(v) {
|
|
224
|
+
return JSON.stringify(v).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
225
|
+
}
|