diff --git a/.jhonny/analises.db b/.jhonny/analises.db index 743174d..079b0b3 100644 Binary files a/.jhonny/analises.db and b/.jhonny/analises.db differ diff --git a/code/cep-plugin/main.js b/code/cep-plugin/main.js index 6341bf4..9505d5e 100755 --- a/code/cep-plugin/main.js +++ b/code/cep-plugin/main.js @@ -3874,6 +3874,9 @@ function applyEditorialActions() { } function aplicarMontagemIncremental(plan, numActions) { + // No modo incremental, o gancho também é materializado numa Adjustment + // Layer para validar a montagem diretamente pelo fluxo do painel. + plan = Object.assign({}, plan, { test_adjustment_layer: true }); var summary = numActions + " ação(ões) serão convertidas em trechos preservados.\n\n" + "Será criada uma nova sequência clonada; a sequência original não será cortada. Confirmar?"; diff --git a/code/engine/aplicar_montagem_incremental_prototipo.py b/code/engine/aplicar_montagem_incremental_prototipo.py index 516e8dc..ef30c1f 100644 --- a/code/engine/aplicar_montagem_incremental_prototipo.py +++ b/code/engine/aplicar_montagem_incremental_prototipo.py @@ -85,6 +85,31 @@ def executar(caminho_do_plano: Path) -> dict[str, object]: "confirm_prototype": True, }, ) + if plano.get("test_adjustment_layer") is True: + gancho = next( + ( + acao + for acao in plano["actions"] + if isinstance(acao, dict) and acao.get("kind") == "hook" + ), + None, + ) + if gancho is None: + raise ErroDeMontagemIncremental( + "O teste da adjustment layer exige uma ação hook no plano." + ) + inicio_do_gancho = 0.0 + fim_do_gancho = float(gancho["end"]) - float(gancho["start"]) + camada = cliente.chamar( + "insert_adjustment_layer_range", + { + "item_id": "Adjustment Layer", + "track_index": 0, + "start_seconds": inicio_do_gancho, + "end_seconds": fim_do_gancho, + }, + ) + resultado["adjustment_layer"] = camada return {"ok": True, "plano_incremental": True, "resultado": resultado} finally: cliente.desconectar() diff --git a/code/engine/editor/plano_teste_gancho_adjustment.json b/code/engine/editor/plano_teste_gancho_adjustment.json new file mode 100644 index 0000000..9569b9b --- /dev/null +++ b/code/engine/editor/plano_teste_gancho_adjustment.json @@ -0,0 +1,17 @@ +{ + "test_adjustment_layer": true, + "actions": [ + { + "kind": "hook", + "start": 255.98, + "end": 274.96, + "reason": "Gancho de abertura: Toda minha vida, eu olhava no espelho..." + }, + { "kind": "cut", "start": 0, "end": 124.47, "reason": "Remover trecho inicial" }, + { "kind": "cut", "start": 215.06, "end": 255.98, "reason": "Remover respiro antes do gancho" }, + { "kind": "cut", "start": 427.32, "end": 469.24, "reason": "Remover trecho" }, + { "kind": "cut", "start": 552.28, "end": 848.42, "reason": "Remover trecho" }, + { "kind": "cut", "start": 879.89, "end": 962.78, "reason": "Remover trecho" }, + { "kind": "cut", "start": 1014.99, "end": 1018.2255, "reason": "Remover final" } + ] +} diff --git a/code/engine/editor/plano_teste_zooms_plano_6.json b/code/engine/editor/plano_teste_zooms_plano_6.json new file mode 100644 index 0000000..65ed5cb --- /dev/null +++ b/code/engine/editor/plano_teste_zooms_plano_6.json @@ -0,0 +1,33 @@ +{ + "source": "/Volumes/Merongo/PROJETOS/DEPOIMENTO - ERIKA/0E6A8829.MP4", + "actions": [ + { + "kind": "zoom", + "start": 157.4, + "end": 164.3, + "reason": "Ênfase em Sempre tentei levar a minha mudança de vida como meu principal objetivo.", + "params": {"scale": 1.18} + }, + { + "kind": "zoom", + "start": 515.13, + "end": 517.09, + "reason": "Ênfase em Se algo der errado, eu vou estar aqui.", + "params": {"scale": 1.3} + }, + { + "kind": "zoom", + "start": 877.26, + "end": 879.56, + "reason": "Ênfase em Então, mudou muito a minha vida em todos os sentidos.", + "params": {"scale": 1.2} + }, + { + "kind": "zoom", + "start": 1010.26, + "end": 1014.64, + "reason": "Ênfase no fecho sobre a segurança do profissional.", + "params": {"scale": 1.5} + } + ] +} diff --git a/code/src/tools/timeline.ts b/code/src/tools/timeline.ts index 41ca691..229873d 100755 --- a/code/src/tools/timeline.ts +++ b/code/src/tools/timeline.ts @@ -542,6 +542,58 @@ export function getTimelineTools(bridgeOptions: BridgeOptions) { }, }, + insert_adjustment_layer_range: { + description: + "Insert an existing Adjustment Layer project item on a video track and extend the timeline instance to an exact bounded range.", + parameters: { + type: "object" as const, + additionalProperties: false, + properties: { + item_id: { type: "string", minLength: 1, description: "Project item node ID of an existing Adjustment Layer." }, + track_index: { type: "integer", minimum: 0, description: "Video track index." }, + start_seconds: { type: "number", minimum: 0, description: "Exact timeline start in seconds." }, + end_seconds: { type: "number", minimum: 0, description: "Exact timeline end in seconds." }, + }, + required: ["item_id", "track_index", "start_seconds", "end_seconds"], + }, + handler: async (args: { item_id: string; track_index: number; start_seconds: number; end_seconds: number }) => { + if (!Number.isFinite(args.start_seconds) || !Number.isFinite(args.end_seconds) || args.end_seconds <= args.start_seconds) { + return { success: false, error: "The adjustment-layer range must have finite start/end values and positive duration." }; + } + const script = buildToolScript(` + var seq = app.project.activeSequence; + if (!seq) return __error("No active sequence"); + var item = __findProjectItem("${escapeForExtendScript(args.item_id)}"); + if (!item) return __error("Adjustment Layer project item not found"); + var track = seq.videoTracks[${args.track_index}]; + if (!track) return __error("Video track not found: ${args.track_index}"); + var startTicks = __secondsToTicks(${args.start_seconds}).toString(); + var endTicks = __secondsToTicks(${args.end_seconds}).toString(); + var beforeIds = {}; + for (var b = 0; b < track.clips.numItems; b++) beforeIds[String(track.clips[b].nodeId)] = true; + seq.insertClip(item, startTicks, ${args.track_index}, 0); + var inserted = null; + for (var i = 0; i < track.clips.numItems; i++) { + var candidate = track.clips[i]; + if (!beforeIds[String(candidate.nodeId)] && Math.abs(parseFloat(candidate.start.ticks) - parseFloat(startTicks)) < 1) { inserted = candidate; break; } + } + if (!inserted) return __error("Premiere inserted the Adjustment Layer but it could not be identified"); + try { inserted.end = endTicks; } catch (e) { return __error("Could not extend the Adjustment Layer to the requested end: " + e.toString()); } + var actualStart = __ticksToSeconds(inserted.start.ticks); + var actualEnd = __ticksToSeconds(inserted.end.ticks); + var frameTicks = seq.timebase ? parseFloat(seq.timebase) : TICKS_PER_SECOND / 24; + var tolerance = __ticksToSeconds(frameTicks); + if (Math.abs(actualStart - ${args.start_seconds}) > tolerance || Math.abs(actualEnd - ${args.end_seconds}) > tolerance) { + return __error("Adjustment Layer range read back as " + actualStart + "-" + actualEnd + "s, not the requested range"); + } + var isAdjustment = false; + try { isAdjustment = inserted.isAdjustmentLayer(); } catch (eCheck) {} + return __result({ inserted: true, verified: true, nodeId: String(inserted.nodeId), trackIndex: ${args.track_index}, startSeconds: actualStart, endSeconds: actualEnd, isAdjustmentLayer: isAdjustment }); + `); + return sendCommand(script, bridgeOptions); + }, + }, + move_clip: { description: "Move a clip to a new position on the timeline", parameters: {