diff --git a/VFXReviewConnector.jsx b/VFXReviewConnector.jsx index 3cbc50f..2f83860 100644 --- a/VFXReviewConnector.jsx +++ b/VFXReviewConnector.jsx @@ -315,6 +315,27 @@ var SETTINGS_KEY = "cfg"; return CONFIG.footageRoot + (showId ? "/" + showId : ""); } + // Mirrors the server's export layout so farm and local renders land together: + // {exportRoot}/{showId}/[{episode} for episodic]/{shotCode}/{version} + function getShotExportDir(shot) { + var path = getShowExportRoot(); + var episode; + var match; + + if (CURRENT_PROJECT && CURRENT_PROJECT.projectType === "EPISODIC") { + episode = trimText(shot.episode); + if (!episode) { + match = String(shot.shotCode).match(/^[A-Z]{3}_(\d{3})_/); + episode = match ? match[1] : ""; + } + if (episode) { + path += "/" + episode; + } + } + + return path + "/" + shot.shotCode + "/" + (shot.shotVersion || "v001"); + } + function ensureFolder(path) { var folder = new Folder(path); var parent; @@ -912,7 +933,7 @@ var SETTINGS_KEY = "cfg"; disableLayerByName(comp, "UNG_VFX_OVERLAY"); disableLayerByName(comp, "_SHOW LUT"); - folderPath = getShowExportRoot() + "/" + shotCode; + folderPath = getShotExportDir(shot); if (!ensureFolder(folderPath)) { addFailure(result, comp.name, "Could not create output folder"); continue; @@ -1242,14 +1263,9 @@ var SETTINGS_KEY = "cfg"; var mainComp; var previewComp; var outputPath; + var folderPath; app.beginUndoGroup("VFXReview Connector - Queue " + label); - if (!ensureFolder(getShowExportRoot())) { - app.endUndoGroup(); - updateStatus(comps.length, "Could not create export folder."); - return; - } - for (i = 0; i < comps.length; i += 1) { shotCode = getShotCodeFromComp(comps[i]); updateStatus(comps.length, "Preparing " + label + " preview for " + shotCode + " (" + (i + 1) + " of " + comps.length + ")"); @@ -1282,7 +1298,13 @@ var SETTINGS_KEY = "cfg"; } updateStatus(comps.length, "Queueing " + label + " for " + shotCode + " (" + (i + 1) + " of " + comps.length + ")"); - outputPath = getShowExportRoot() + "/" + shotCode + "_cmp_TT_" + (apiData.shot.shotVersion || "v001") + "." + extension; + folderPath = getShotExportDir(apiData.shot); + if (!ensureFolder(folderPath)) { + addFailure(result, comps[i].name, "Could not create output folder"); + continue; + } + + outputPath = folderPath + "/" + shotCode + "_cmp_TT_" + (apiData.shot.shotVersion || "v001") + "." + extension; if (queueCompWithOutput(previewComp, templateName, outputPath)) { queued += 1; result.queued += 1; @@ -1323,7 +1345,7 @@ var SETTINGS_KEY = "cfg"; disableLayerByName(comp, "UNG_VFX_OVERLAY"); disableLayerByName(comp, "_SHOW LUT"); - folderPath = getShowExportRoot() + "/" + shotCode; + folderPath = getShotExportDir(shot); if (!ensureFolder(folderPath)) { addFailure(result, comp.name, "Could not create output folder"); continue; @@ -1384,7 +1406,7 @@ var SETTINGS_KEY = "cfg"; continue; } - exportFolder = new Folder(getShowExportRoot() + "/" + shot.shotCode); + exportFolder = new Folder(getShotExportDir(shot)); if (!exportFolder.exists) { updateStatus(comps.length, "Export folder not found: " + exportFolder.fsName); skipped += 1; @@ -1596,7 +1618,7 @@ var SETTINGS_KEY = "cfg"; expectedBaseName = shotCode + "_cmp_TT_" + (shot.shotVersion || "v001"); exrOutputBase = shot.exrOutput || ""; - sourceFolder = new Folder(getShowExportRoot() + "/" + shotCode); + sourceFolder = new Folder(getShotExportDir(shot)); if (!sourceFolder.exists) { addFailure(result, comp.name, "Source export folder not found: " + sourceFolder.fsName); continue; diff --git a/app/api/ext/projects/[projectCode]/shots/route.ts b/app/api/ext/projects/[projectCode]/shots/route.ts index 40440ff..bf9d0b1 100644 --- a/app/api/ext/projects/[projectCode]/shots/route.ts +++ b/app/api/ext/projects/[projectCode]/shots/route.ts @@ -18,6 +18,7 @@ function isAuthorized(req: NextRequest): boolean { // // Query params (all optional): // episode e.g. 108 +// scene e.g. 022 // sequence e.g. 004 // status e.g. IN_PROGRESS // page (default 1) @@ -60,6 +61,7 @@ export async function GET( where: { projectId: project.id, ...(episode ? { episode } : {}), + ...(scene ? { scene } : {}), ...(sequence ? { sequence } : {}), ...(status ? { status: status as never } : {}), },