From c22e240abeb6d04af7fa8b3dff04ff5e41364f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Henrique?= Date: Thu, 10 Sep 2026 19:37:09 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20preparado=20teste=20incremental=20do=20?= =?UTF-8?q?gancho=20com=20inser=C3=A7=C3=A3o=20de=20adjust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - preparado teste incremental do gancho com inserção de adjustment layer na faixa superior - integrado o teste de adjustment layer ao checkbox da montagem incremental do painel Resumo: - 6 arquivos alterados - 2 novos - 4 modificados - 0 removidos 4 files changed, 80 insertions(+) Arquivos: - .jhonny/analises.db - code/cep-plugin/main.js - code/engine/aplicar_montagem_incremental_prototipo.py - code/src/tools/timeline.ts - code/engine/editor/plano_teste_gancho_adjustment.json - code/engine/editor/plano_teste_zooms_plano_6.json --- .jhonny/analises.db | Bin 1175552 -> 1175552 bytes code/cep-plugin/main.js | 3 + .../aplicar_montagem_incremental_prototipo.py | 25 +++++++++ .../editor/plano_teste_gancho_adjustment.json | 17 ++++++ .../editor/plano_teste_zooms_plano_6.json | 33 +++++++++++ code/src/tools/timeline.ts | 52 ++++++++++++++++++ 6 files changed, 130 insertions(+) create mode 100644 code/engine/editor/plano_teste_gancho_adjustment.json create mode 100644 code/engine/editor/plano_teste_zooms_plano_6.json diff --git a/.jhonny/analises.db b/.jhonny/analises.db index 743174deafabaafe8c1d3959e8a608a56f6c1cda..079b0b39748ca319c6f524d6c2ff5ff8177b4db5 100644 GIT binary patch delta 769 zcmZ{gPe>F|9LMLq+1)oYJAZ9OOV_4|lyGErHr;k%z-4vClU4?02itT+!`)f5F4odY zh>!=fE#4)N2rm^bDl*Y25UNY2A_SdQ5FxVYAOuC&+m-TC4?gdA`F+2?-}jd-v}Frz z_o@_=qQFt=?<;dp*9U<)e`RT|LiTxR4Wx$>DSM=+&+4)I2741W%GKv%AbuyEpGfBc zPUqo+GQ;3xo~hbnxGqf+go#=iLt&a?`Rj`w-E7m-I}UT~yK;iFeZ^ zj9mJqiFt`8xCm~7hkytSfhBMRFM%fr1d&kG$j-c^oL@cSMcb6H&OhbD-Z^hIcadFT zO=g|BfVRm2-l8+fI0*;J5xNmY^r&qoo2TykMmO8$nx~d(UYz|rzI->;pBS;!l&$t# zy#uy7VqYD$RQzQ}sm6z1E0ua+=Ox`NG`Tp2gNfmpeQWIWV zP%1PdlNoFw3$SDXJBmue>|xGKKl#v{tt*Z{dLYE=q*#kL-zZgr7$fr-A{uLqAzb*V W__%||Q6)RfHR z#C*2NI_sSootg{Qw->BuoL;b=X^H?FR|W&WC%-7460aH$4_C%!MS~Eo?HRk6=CE?G z@$F^cU&!yco$mnCM83%e1`5-Et`jiX{_z}>upqM&AJcU92TZL%9c8@RncgumF){OT zot@79fk_r9wvuc6*g}}%Wf7d=;d$U$j=PKEI`Z(#B4y!4#XTl%n8I? zK+FxqJV49~#C$*u(j%~aBfntq1tE6Ma}2zfcvkUPa 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: {