@ajsmonty/adobe-mcp 1.1.2 → 1.3.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.
@@ -126,14 +126,17 @@ export function hintBlock(lessons) {
126
126
  export function instructionsDigest() {
127
127
  const n = loadLessons().length;
128
128
  return [
129
- "adobe-mcp drives AE, Photoshop, Illustrator, Premiere and CH puppet authoring via ExtendScript.",
129
+ "adobe-mcp drives AE, Photoshop, Illustrator, Premiere and CH puppet authoring via ExtendScript, plus Blender (bpy) and Substance 3D Painter (Python) for 3D look-dev and cinematic animation.",
130
130
  "",
131
131
  "WORKING RULES (learned from real sessions):",
132
132
  "1. TARGET DOCUMENTS EXPLICITLY. PS/AI active document can silently change between calls — start every PS/AI script with app.activeDocument = app.documents.getByName(...). Exports always act on the ACTIVE document.",
133
133
  "2. VERIFY VISUALLY AT EVERY STAGE. Use ae_save_frame / ps_save_preview / ai_save_preview after each meaningful change, and verify final renders by extracting frames from the output file. For seamless loops, diff first vs last frame.",
134
134
  "3. A RENDER TIMEOUT IS NOT A FAILED RENDER. If ae_render_comp/exports time out, check the output file (stable size, right duration) before re-running.",
135
135
  "4. ES3 ONLY inside the apps: no JSON, let/const, arrows, Array.map. Collections are 1-indexed in AE.",
136
- `5. CONSULT THE KNOWLEDGE BASE: ${n} lessons loaded. knowledge_search before attempting something unusual; failed scripts auto-surface matching lessons. When you solve a NEW gotcha (an error whose fix wasn't suggested), record it with knowledge_add so the server learns.`,
136
+ "5. PYTHON APPS (blender_*, substance_*): code runs as a module body; assign `result` to return data. Guard every lookup (bpy.data.objects.get, substance_painter.project.is_open). Painter baking is async — never block its main thread waiting.",
137
+ "6. RESPECT PHYSICS IN ANIMATION: work in meters/seconds at the real frame rate; derive gait timing from size (vfx_plan_creature_shot), plant feet with zero slide, lag secondary chains (neck/tail) a few frames per joint, bake a 180° shutter into renders, and match lens, grain and softness to the plate in comp.",
138
+ "7. FREE CC0 LIBRARIES: texture_search / texture_download (Poly Haven, ambientCG) for PBR materials and HDRIs; blender_apply_texture and blender_set_hdri wire them into Blender. Prefer these to inventing procedural textures for photo-real work.",
139
+ `8. CONSULT THE KNOWLEDGE BASE: ${n} lessons loaded. knowledge_search before attempting something unusual; failed scripts auto-surface matching lessons. When you solve a NEW gotcha (an error whose fix wasn't suggested), record it with knowledge_add so the server learns.`,
137
140
  ].join("\n");
138
141
  }
139
142
 
@@ -144,11 +147,11 @@ export function register(server, { text, errText }) {
144
147
  title: "Search the adobe-mcp knowledge base",
145
148
  description:
146
149
  "Search accumulated scripting lessons/gotchas for the Adobe apps (seeded + learned at runtime). " +
147
- "Query by keywords, optionally filtered by app (ae/ps/ai/ppro/ch). Empty query lists everything. " +
150
+ "Query by keywords, optionally filtered by app (ae/ps/ai/ppro/ch/blender/substance). Empty query lists everything. " +
148
151
  "Consult this BEFORE attempting unusual scripting; it is cheaper than rediscovering a gotcha.",
149
152
  inputSchema: {
150
153
  query: z.string().optional().describe("Keywords (empty = list all)."),
151
- app: z.string().optional().describe("Filter: ae, ps, ai, ppro, ch."),
154
+ app: z.string().optional().describe("Filter: ae, ps, ai, ppro, ch, blender, substance."),
152
155
  },
153
156
  },
154
157
  async ({ query, app }) => {
@@ -176,7 +179,7 @@ export function register(server, { text, errText }) {
176
179
  "`match` keywords are matched against future error text to auto-surface the lesson — choose distinctive " +
177
180
  "substrings of the error message (e.g. 'Illegal Parameter type').",
178
181
  inputSchema: {
179
- app: z.string().describe("ae, ps, ai, ppro, ch, or 'any'."),
182
+ app: z.string().describe("ae, ps, ai, ppro, ch, blender, substance, or 'any'."),
180
183
  title: z.string().describe("Short name for the lesson."),
181
184
  lesson: z.string().describe("The gotcha and its fix, 1-3 sentences."),
182
185
  match: z
@@ -27,3 +27,22 @@
27
27
  {"id":"any-es3","app":"any","title":"ExtendScript is ES3","match":["json is undefined","is not a function"],"lesson":"No JSON object, let/const, arrow functions, template literals, Array.map/filter/forEach inside the apps. Use var, string concat, and index loops. AE collections are 1-indexed (comp.layer(1) is the top layer); PS artLayers are 0-indexed. The MCP harness JSON-serializes your return value for you.","added":"2026-07-14","source":"session"}
28
28
  {"id":"ch-puppet-taxonomy","app":"ch","title":"Extra layers ride along in CH puppet groups","match":[],"lesson":"Character Animator auto-rigs from the layer-name taxonomy (+Character root, Head/Body groups, 14 visemes, Blink layers). Extra non-taxonomy layers (logos, badges) placed INSIDE a group (e.g. Body) simply ride with that group — safe way to add art to a rigged puppet. Remove stray empty layers at root before import.","added":"2026-07-14","source":"session"}
29
29
  {"id":"any-host-env-placeholders","app":"any","title":"MCP hosts may pass manifest placeholders unexpanded","match":["no such file or directory, mkdir"],"lesson":"Claude Desktop delivered the .mcpb manifest's ${HOME} user_config default literally as ADOBE_MCP_WORKSPACE='${HOME}/AdobeMCP' with cwd=/, crashing workspace mkdir at module load ('Server disconnected', nothing on stderr). Never trust env-provided paths: expand ${HOME}/~ yourself, reject values still containing ${...} or relative paths, and fall back to a safe default instead of dying (core/workspace.mjs).","added":"2026-07-15","source":"session"}
30
+ {"id": "blender-5-compositor", "app": "blender", "title": "Blender 5.x compositor API moved", "match": ["has no attribute 'node_tree'", "node_tree"], "lesson": "Blender 5.0 removed scene.node_tree/scene.use_nodes for compositing: create a CompositorNodeTree with bpy.data.node_groups.new(name, 'CompositorNodeTree') and assign scene.compositing_node_group. File Output nodes use .directory/.file_name/.file_output_items.new(socket_type, name) instead of base_path/file_slots.", "example": "tree = scene.compositing_node_group or bpy.data.node_groups.new('Comp', 'CompositorNodeTree'); scene.compositing_node_group = tree", "added": "2026-09-24", "source": "verified against bpy 5.0.1"}
31
+ {"id": "blender-5-exr-multilayer", "app": "blender", "title": "Multilayer EXR is a media type in Blender 5.x", "match": ["open_exr_multilayer", "enum \"png\" not found"], "lesson": "In 5.x image_settings.file_format no longer accepts 'OPEN_EXR_MULTILAYER' directly: set image_settings.media_type = 'MULTI_LAYER_IMAGE' (file_format becomes OPEN_EXR_MULTILAYER). New compositor File Output nodes default to multilayer, so set node.format.media_type = 'IMAGE' before choosing 'PNG'.", "example": "im = scene.render.image_settings\nif hasattr(im, 'media_type'): im.media_type = 'MULTI_LAYER_IMAGE'", "added": "2026-09-24", "source": "verified against bpy 5.0.1"}
32
+ {"id": "blender-5-slotted-actions", "app": "blender", "title": "action.fcurves is gone in Blender 5.x (slotted actions)", "match": ["has no attribute 'fcurves'"], "lesson": "Blender 5.0 actions are layered/slotted. Get F-curves through bpy_extras.anim_utils.action_get_channelbag_for_slot(obj.animation_data.action, obj.animation_data.action_slot).fcurves. Keep an action.fcurves fallback for 4.x.", "example": "from bpy_extras import anim_utils\ncb = anim_utils.action_get_channelbag_for_slot(ad.action, ad.action_slot)\nfor fc in cb.fcurves: ...", "added": "2026-09-24", "source": "verified against bpy 5.0.1"}
33
+ {"id": "blender-eevee-id", "app": "blender", "title": "EEVEE engine identifier differs by version", "match": ["blender_eevee_next", "enum \"blender_eevee"], "lesson": "render.engine is 'BLENDER_EEVEE_NEXT' in 4.2-4.5 and 'BLENDER_EEVEE' in 5.x. Pick from bpy.types.RenderSettings.bl_rna.properties['engine'].enum_items rather than hard-coding. Cycles shadow-catcher pass lives on view_layer.cycles.use_pass_shadow_catcher, not the view layer itself.", "added": "2026-09-24", "source": "verified against bpy 5.0.1"}
34
+ {"id": "blender-bridge-modes", "app": "blender", "title": "Live vs background Blender bridge", "match": ["cannot reach the blender live bridge", "blender executable not found"], "lesson": "mode 'live' needs bridges/blender/adobe_mcp_bridge.py installed and enabled as an add-on (port 9877). mode 'background' runs a headless Blender (set BLENDER_PATH if it is not in /Applications, C:\\Program Files\\Blender Foundation, or on PATH) and discards changes unless save_as is given. Use background + blend_file for long renders so the UI stays free.", "added": "2026-09-24", "source": "design"}
35
+ {"id": "blender-planted-feet", "app": "blender", "title": "Planted feet must not slide", "match": [], "lesson": "Solve feet in world space (IK targets not parented to the moving root) and hold them at exactly the same world position for the whole stance phase; derive the plant spot so it sits under the hip at mid-stance. Check by sampling foot.matrix_world over a stance window: the x spread should be 0.", "added": "2026-09-24", "source": "Creature_Walk_Cinematic"}
36
+ {"id": "substance-remote-scripting", "app": "substance", "title": "Painter remote scripting must be enabled at launch", "match": ["cannot reach substance 3d painter", "60041"], "lesson": "Substance 3D Painter only listens on port 60041 when started with --enable-remote-scripting (macOS: open -a 'Adobe Substance 3D Painter' --args --enable-remote-scripting; Windows: run 'Adobe Substance 3D Painter.exe' --enable-remote-scripting from its install folder). The endpoint is POST /run.json with {\"python\": <base64 script>}; set SUBSTANCE_REMOTE_ENCODING=raw if your build expects plain text.", "added": "2026-09-24", "source": "design"}
37
+ {"id": "substance-async-bake", "app": "substance", "title": "Painter baking is asynchronous — no bake_mesh_maps()", "match": ["bake_mesh_maps", "has no attribute 'bake"], "lesson": "substance_painter.baking has no bake_mesh_maps(). Use bake_async(texture_set) (or bake_selected_textures_async() on older builds); it returns immediately. Never sleep/poll on Painter's main thread waiting for it; subscribe to substance_painter.event.BakingProcessEnded or check back in a later call.", "added": "2026-09-24", "source": "handover review"}
38
+ {"id": "substance-scoped-modification", "app": "substance", "title": "Group layer-stack edits into one undo step", "match": [], "lesson": "Wrap scripted layer-stack edits in `with substance_painter.layerstack.ScopedModification('label'):` so one Ctrl+Z reverts the whole look-dev pass. Insert fills with insert_fill(InsertPosition.from_textureset_stack(ts.get_stack())), limit active_channels, then set_source per channel.", "added": "2026-09-24", "source": "design"}
39
+ {"id": "ae-cg-motion-blur", "app": "ae", "title": "Layer motion blur does nothing to a rendered CG sequence", "match": [], "lesson": "AE motion blur only blurs layer transform animation. A static image-sequence layer from Blender gains nothing from layer.motionBlur — bake the 180-degree shutter (render.motion_blur_shutter = 0.5) into the 3D render instead, or use Pixel Motion Blur / a vector pass.", "added": "2026-09-24", "source": "handover review"}
40
+ {"id": "ae-add-grain-viewing-mode", "app": "ae", "title": "Add Grain defaults to a preview box", "match": [], "lesson": "'ADBE Add Grain' starts in Viewing Mode = Preview (grain only in a small box). Set property('Viewing Mode').setValue(3) for Final Output. Add grain to the CG layers only — the plate already carries its own.", "added": "2026-09-24", "source": "handover"}
41
+ {"id": "texlib-normal-gl", "app": "blender", "title": "Library normals: use OpenGL, not DirectX", "match": [], "lesson": "Poly Haven ships nor_gl and nor_dx, ambientCG NormalGL and NormalDX. Blender (and Substance's default) expects OpenGL (+Y up); a DirectX normal map makes bumps look inverted under side light. texture_download keeps only the GL map as <id>_Normal.", "added": "2026-09-24", "source": "design"}
42
+ {"id": "texlib-ao-arm", "app": "blender", "title": "Don't multiply baked AO into a path-traced material", "match": [], "lesson": "Cycles computes occlusion itself; multiplying a library AO map into base colour double-darkens contacts and crevices. Use AO only for realtime/EEVEE looks or as a dirt mask. ARM maps pack AO/Roughness/Metallic in R/G/B — separate them with a Separate Color node when individual maps are missing.", "added": "2026-09-24", "source": "design"}
43
+ {"id": "texlib-scale", "app": "blender", "title": "Set real-world texture scale", "match": [], "lesson": "A library texture tile usually covers roughly 1–4 m of surface. Wrong scale is the fastest way to make CG read as miniature or giant: set blender_apply_texture tile_m to the real size (a rock face tile ~2 m, gravel ~1 m, bark ~1 m). Meshes without UVs get tri-planar BOX projection in object space.", "added": "2026-09-24", "source": "design"}
44
+ {"id": "texlib-hdri-match", "app": "blender", "title": "Match the HDRI to the plate before anything else", "match": [], "lesson": "Pick an HDRI with the plate's sun elevation, colour temperature and cloud cover (texture_search type=hdri), then rotate it (blender_set_hdri rotation_deg) until CG shadows fall the same way as plate shadows. Good lighting match matters more for photo-realism than texture resolution.", "added": "2026-09-24", "source": "design"}
45
+ {"id": "texlib-resolution-missing", "app": "any", "title": "Requested library resolution not available", "match": ["no maps at", "download; available"], "lesson": "Not every Poly Haven / ambientCG asset has every resolution (many stop at 4k; some ambientCG sets are JPG-only or PNG-only). Retry texture_download with one of the resolutions/formats listed in the error.", "added": "2026-09-24", "source": "design"}
46
+ {"id": "win-com-privilege", "app": "any", "title": "Windows: COM needs matching privilege levels", "match": ["80070005", "access denied"], "lesson": "On Windows, Photoshop and Illustrator are driven over COM (DoJavaScriptFile via cscript). If the Adobe app runs elevated ('Run as administrator') and the MCP client does not, or the reverse, COM returns 0x80070005 Access denied. Start both at the same level.", "added": "2026-12-01", "source": "design"}
47
+ {"id": "win-com-not-registered", "app": "any", "title": "Windows: ProgID not registered", "match": ["800401f3", "80040154", "800a01ad"], "lesson": "COM_CREATE_FAILED 0x800401f3/0x80040154 means the ProgID (Photoshop.Application / Illustrator.Application) is not registered. Launch the app once normally so it registers, or pin a version with PS_COM_PROGID / AI_COM_PROGID (e.g. Photoshop.Application.200).", "added": "2026-12-01", "source": "design"}
48
+ {"id": "win-ae-afterfx", "app": "ae", "title": "Windows: After Effects runs scripts via AfterFX.exe -r", "match": ["afterfx", "no result file appeared within"], "lesson": "After Effects has no COM server on Windows; the bridge calls 'AfterFX.exe -r <file.jsx>', which hands the script to the running instance. AE must already be open, and Preferences > Scripting & Expressions > 'Allow Scripts to Write Files and Access Network' must be on or the result file is never written. Set AE_EXE if AE is installed outside Program Files\\Adobe.", "added": "2026-12-01", "source": "design"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ajsmonty/adobe-mcp",
3
- "version": "1.1.2",
4
- "description": "MCP server for Adobe CC apps (AE, PS, AI, Premiere, Character Animator) on macOS",
3
+ "version": "1.3.0",
4
+ "description": "MCP server for After Effects, Photoshop, Illustrator, Premiere Pro, Character Animator, Blender and Substance 3D Painter: 41 tools for AI automation from Claude, Cursor or any MCP client (macOS + Windows)",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "adobe-mcp": "server.mjs"
@@ -19,23 +19,60 @@
19
19
  "type": "git",
20
20
  "url": "git+https://github.com/AJSMonty/adobe-mcp.git"
21
21
  },
22
+ "homepage": "https://github.com/AJSMonty/adobe-mcp#readme",
23
+ "bugs": {
24
+ "url": "https://github.com/AJSMonty/adobe-mcp/issues"
25
+ },
22
26
  "keywords": [
23
27
  "mcp",
28
+ "mcp-server",
24
29
  "model-context-protocol",
25
30
  "adobe",
31
+ "adobe-mcp",
32
+ "creative-cloud",
33
+ "adobe-creative-cloud",
26
34
  "after-effects",
35
+ "adobe-after-effects",
36
+ "after-effects-mcp",
27
37
  "photoshop",
38
+ "adobe-photoshop",
39
+ "photoshop-mcp",
28
40
  "illustrator",
41
+ "adobe-illustrator",
42
+ "illustrator-mcp",
29
43
  "premiere-pro",
30
- "extendscript"
44
+ "premiere",
45
+ "adobe-premiere-pro",
46
+ "premiere-pro-mcp",
47
+ "character-animator",
48
+ "adobe-character-animator",
49
+ "blender",
50
+ "blender-mcp",
51
+ "substance-3d-painter",
52
+ "substance-painter",
53
+ "extendscript",
54
+ "motion-graphics",
55
+ "video-editing",
56
+ "vfx",
57
+ "3d",
58
+ "pbr-textures",
59
+ "claude",
60
+ "claude-code",
61
+ "claude-desktop",
62
+ "cursor",
63
+ "ai-automation",
64
+ "macos",
65
+ "windows"
31
66
  ],
32
67
  "mcpName": "io.github.AJSMonty/adobe-mcp",
33
68
  "files": [
34
69
  "server.mjs",
70
+ "cli/",
35
71
  "adapters/",
36
72
  "core/",
37
73
  "knowledge/",
38
74
  "workflow/",
75
+ "bridges/",
39
76
  "scripts/",
40
77
  "cep/",
41
78
  "README.md",
@@ -44,5 +81,10 @@
44
81
  ],
45
82
  "publishConfig": {
46
83
  "access": "public"
84
+ },
85
+ "scripts": {
86
+ "test": "node --test",
87
+ "doctor": "node server.mjs doctor",
88
+ "build:aliases": "node packages/build.mjs"
47
89
  }
48
90
  }
@@ -0,0 +1,173 @@
1
+ /*
2
+ Cinematic_3D_Composite — lands a Blender CG render on a live-action plate in the active comp.
3
+ Imports the beauty / shadow / mist PNG sequences from PARAMS.render_dir (the folders written by
4
+ scripts/blender/Creature_Walk_Cinematic.py) or uses existing layers named Dino_Render_Beauty,
5
+ Dino_Shadow, Dino_Mist and BG_Plate. Builds: multiplied shadow-catcher pass, a precomped edge
6
+ light wrap (blurred plate inside the CG's inner edge, screened), depth haze from the mist pass,
7
+ an optional depth lens blur, a 0.5 px CG softening, and plate-matched grain on the CG only.
8
+ Motion blur is NOT added here: the 180-degree shutter is already baked into the render.
9
+ PARAMS keys: render_dir, fps (24), wrap_px (18), wrap_opacity (55), shadow_opacity (85),
10
+ haze_color ([0.62,0.68,0.74]), haze_amount (35), lens_blur_radius (0), focus_value (0.1).
11
+ */
12
+ (function () {
13
+ var P = (typeof $.global.PARAMS === "object" && $.global.PARAMS) ? $.global.PARAMS : {};
14
+ function opt(k, d) { return (P[k] === undefined || P[k] === null) ? d : P[k]; }
15
+ var report = { steps: [] };
16
+ function note(s) { report.steps.push(s); }
17
+
18
+ function findProp(group, name) {
19
+ for (var i = 1; i <= group.numProperties; i++) {
20
+ var p = group.property(i);
21
+ if (p.name === name || p.matchName === name) return p;
22
+ if (p.propertyType !== PropertyType.PROPERTY) {
23
+ var hit = findProp(p, name);
24
+ if (hit) return hit;
25
+ }
26
+ }
27
+ return null;
28
+ }
29
+ function setP(effect, name, value) {
30
+ var p = findProp(effect, name);
31
+ if (p) { p.setValue(value); return true; }
32
+ note("param '" + name + "' not found on " + effect.name);
33
+ return false;
34
+ }
35
+ // Layer-reference params store an index; set them only after the stack stops changing.
36
+ var layerRefs = [];
37
+ function setLayerRef(effect, name, layer) { layerRefs.push({ effect: effect, name: name, layer: layer }); }
38
+ function layerNamed(comp, name) {
39
+ for (var i = 1; i <= comp.numLayers; i++) if (comp.layer(i).name === name) return comp.layer(i);
40
+ return null;
41
+ }
42
+ function firstPng(folder) {
43
+ var f = new Folder(folder);
44
+ if (!f.exists) return null;
45
+ var all = f.getFiles("*.png"), files = [];
46
+ for (var i = 0; i < all.length; i++) if (/\d+\.png$/i.test(all[i].name)) files.push(all[i]);
47
+ if (!files.length) return null;
48
+ files.sort(function (a, b) { return a.name < b.name ? -1 : 1; });
49
+ return files[0];
50
+ }
51
+ function importSeq(folder, name, fps) {
52
+ var first = firstPng(folder);
53
+ if (!first) return null;
54
+ var io = new ImportOptions(first);
55
+ io.sequence = true;
56
+ var item = app.project.importFile(io);
57
+ item.mainSource.conformFrameRate = fps;
58
+ item.name = name;
59
+ return item;
60
+ }
61
+ function matteTo(layer, matte, type) {
62
+ if (typeof layer.setTrackMatte === "function") layer.setTrackMatte(matte, type); // AE 23+
63
+ else { matte.moveBefore(layer); layer.trackMatteType = type; }
64
+ }
65
+
66
+ app.beginUndoGroup("Cinematic 3D Composite");
67
+ var fps = opt("fps", 24);
68
+ var comp = app.project.activeItem;
69
+ var dir = opt("render_dir", null);
70
+ var items = {};
71
+ if (dir) {
72
+ items.beauty = importSeq(dir + "/beauty", "Dino_Render_Beauty", fps);
73
+ items.shadow = importSeq(dir + "/shadow", "Dino_Shadow", fps);
74
+ items.mist = importSeq(dir + "/mist", "Dino_Mist", fps);
75
+ if (!items.beauty) throw new Error("No beauty PNG sequence in " + dir + "/beauty");
76
+ note("imported sequences from " + dir);
77
+ }
78
+ if (!(comp instanceof CompItem)) {
79
+ if (!items.beauty) throw new Error("Open a composition first (or pass PARAMS.render_dir).");
80
+ comp = app.project.items.addComp("Dino_Shot", items.beauty.width, items.beauty.height, 1,
81
+ items.beauty.duration, fps);
82
+ comp.openInViewer();
83
+ note("created comp Dino_Shot");
84
+ }
85
+ var beauty = layerNamed(comp, "Dino_Render_Beauty") || (items.beauty ? comp.layers.add(items.beauty) : null);
86
+ if (!beauty) throw new Error("No layer named Dino_Render_Beauty in comp " + comp.name);
87
+ beauty.name = "Dino_Render_Beauty";
88
+ var shadow = layerNamed(comp, "Dino_Shadow") || (items.shadow ? comp.layers.add(items.shadow) : null);
89
+ var mist = layerNamed(comp, "Dino_Mist") || (items.mist ? comp.layers.add(items.mist) : null);
90
+ var plate = layerNamed(comp, "BG_Plate");
91
+ if (!plate) note("no BG_Plate layer: light wrap and grain matching need one (name your plate BG_Plate)");
92
+
93
+ // Stack order (top -> bottom): light wrap, haze, beauty, shadow, plate
94
+ if (plate) plate.moveToEnd();
95
+ if (shadow) {
96
+ if (plate) shadow.moveBefore(plate); else shadow.moveToEnd();
97
+ shadow.name = "Dino_Shadow";
98
+ shadow.blendingMode = BlendingMode.MULTIPLY; // shadow catcher: white = no shadow
99
+ shadow.opacity.setValue(opt("shadow_opacity", 85));
100
+ note("shadow pass multiplied at " + opt("shadow_opacity", 85) + "%");
101
+ }
102
+ beauty.moveToBeginning();
103
+
104
+ // CG is sharper than any real lens: soften by half a pixel before grain
105
+ var soft = beauty.Effects.addProperty("ADBE Gaussian Blur 2");
106
+ soft.name = "CG Softening";
107
+ setP(soft, "Blurriness", 0.5);
108
+
109
+ var lensR = opt("lens_blur_radius", 0);
110
+ if (mist && lensR > 0) {
111
+ var lb = beauty.Effects.addProperty("ADBE Camera Lens Blur");
112
+ setP(lb, "Blur Radius", lensR);
113
+ setLayerRef(lb, "Layer", mist);
114
+ setP(lb, "Blur Focal Distance", Math.round(255 * opt("focus_value", 0.1)));
115
+ note("depth lens blur r=" + lensR + " from mist pass");
116
+ }
117
+
118
+ if (mist) {
119
+ mist.name = "Dino_Mist";
120
+ // Atmospheric perspective: haze colour, matted by depth, clipped to the CG
121
+ var hazeSolid = comp.layers.addSolid(opt("haze_color", [0.62, 0.68, 0.74]), "Dino_Haze",
122
+ comp.width, comp.height, comp.pixelAspect, comp.duration);
123
+ hazeSolid.moveBefore(beauty);
124
+ var hazeMatte = comp.layers.add(mist.source);
125
+ hazeMatte.name = "Dino_Haze_Matte";
126
+ hazeMatte.moveBefore(hazeSolid);
127
+ matteTo(hazeSolid, hazeMatte, TrackMatteType.LUMA);
128
+ hazeSolid.opacity.setValue(opt("haze_amount", 35));
129
+ // keep the haze on the CG only
130
+ var hazeClip = hazeSolid.Effects.addProperty("ADBE Set Matte3");
131
+ setLayerRef(hazeClip, "Take Matte From Layer", beauty);
132
+ mist.enabled = false;
133
+ note("depth haze " + opt("haze_amount", 35) + "% from mist pass");
134
+ }
135
+
136
+ if (plate) {
137
+ // Light wrap precomp: blurred plate, visible only in the CG's inner edge
138
+ var lw = app.project.items.addComp("Dino_LightWrap", comp.width, comp.height, comp.pixelAspect,
139
+ comp.duration, comp.frameRate);
140
+ var base = lw.layers.add(beauty.source);
141
+ var fill = base.Effects.addProperty("ADBE Fill");
142
+ setP(fill, "Color", [0, 0, 0]);
143
+ var wrapPlate = lw.layers.add(plate.source);
144
+ var pb = wrapPlate.Effects.addProperty("ADBE Gaussian Blur 2");
145
+ setP(pb, "Blurriness", 60);
146
+ setP(pb, "Repeat Edge Pixels", 1);
147
+ wrapPlate.preserveTransparency = true; // only over the CG
148
+ var edge = lw.layers.add(beauty.source);
149
+ var eb = edge.Effects.addProperty("ADBE Gaussian Blur 2");
150
+ setP(eb, "Blurriness", opt("wrap_px", 18));
151
+ matteTo(wrapPlate, edge, TrackMatteType.ALPHA_INVERTED); // inner edge only
152
+ var wrapLayer = comp.layers.add(lw);
153
+ wrapLayer.moveToBeginning();
154
+ wrapLayer.blendingMode = BlendingMode.SCREEN;
155
+ wrapLayer.opacity.setValue(opt("wrap_opacity", 55));
156
+ note("light wrap precomp (" + opt("wrap_px", 18) + " px edge, screen " + opt("wrap_opacity", 55) + "%)");
157
+ }
158
+
159
+ for (var r = 0; r < layerRefs.length; r++) setP(layerRefs[r].effect, layerRefs[r].name, layerRefs[r].layer.index);
160
+
161
+ // Grain on the CG only (the plate already has its own)
162
+ var grain = beauty.Effects.addProperty("ADBE Add Grain");
163
+ setP(grain, "Viewing Mode", 3); // Final Output (default is a preview box)
164
+ setP(grain, "Intensity", 0.35);
165
+ setP(grain, "Size", 0.9);
166
+ note("grain on CG (Add Grain, Final Output)");
167
+
168
+ app.endUndoGroup();
169
+ report.comp = comp.name;
170
+ report.layers = [];
171
+ for (var i = 1; i <= comp.numLayers; i++) report.layers.push(comp.layer(i).name);
172
+ $.global.MCP_RESULT = report;
173
+ })();