From eceadb0a2775311f99d439703127416ed845f8f2 Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Tue, 14 Jan 2025 00:19:37 -0500 Subject: [PATCH 1/4] Fix mp4 export on macOS --- src/main.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/main.js b/src/main.js index 878a09d..2a1bb2d 100644 --- a/src/main.js +++ b/src/main.js @@ -4883,14 +4883,19 @@ function downloadObjectURL(url, filename) { URL.revokeObjectURL(url); } -function done(output) { - const url = URL.createObjectURL(output); - downloadObjectURL(url, "test.mp4") +async function done(output, path) { + await writeFile( + path, // The destination file path for saving + new Uint8Array(await output.arrayBuffer()), + ); + // const url = URL.createObjectURL(output); + // downloadObjectURL(url, "test.mp4") const modal = document.getElementById('progressModal'); modal.style.display = 'none'; + document.querySelector("body").style.cursor = "default"; } -async function exportMp4() { +async function exportMp4(path) { const worker = new Worker("/ffmpeg-worker-mp4.js") // const worker = new Worker("/ffmpeg-worker-webm.js") @@ -5041,7 +5046,7 @@ async function exportMp4() { type: "video/mp4" }); // Trigger the done callback with the final video blob - done(finalBlob); + done(finalBlob, path); return; } @@ -5100,7 +5105,7 @@ async function exportMp4() { type: "video/mp4" }); // Trigger the done callback with the final video blob - done(finalBlob); + done(finalBlob, path); break; case 'stderr': console.log(msg.data); @@ -5154,11 +5159,13 @@ async function exportMp4() { // exportMp4() async function render() { - exportMp4() - return document.querySelector("body").style.cursor = "wait"; const path = await saveFileDialog({ filters: [ + { + name: "MP4 files (.mp4)", + extensions: ["mp4"], + }, { name: "APNG files (.png)", extensions: ["png"], @@ -5168,7 +5175,7 @@ async function render() { extensions: ["html"], }, ], - defaultPath: await join(await documentDir(), "untitled.png"), + defaultPath: await join(await documentDir(), "untitled.mp4"), }); if (path != undefined) { // SVG balks on images @@ -5183,6 +5190,10 @@ async function render() { const ext = path.split(".").pop().toLowerCase(); switch (ext) { + case "mp4": + exportMp4(path) + return + break case "html": fetch("/player.html") .then((response) => { From bbaac4ebc334fd7543e1827cc9f13bcfd3e0e1fe Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Tue, 14 Jan 2025 02:09:55 -0500 Subject: [PATCH 2/4] Fix animations in imported clips not playing grouped object movements correctly --- src/main.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.js b/src/main.js index 2a1bb2d..5057117 100644 --- a/src/main.js +++ b/src/main.js @@ -2242,6 +2242,7 @@ class Layer extends Widget { json.children = []; let idMap = {} for (let child of this.children) { + // TODO: we may not need the randomizeUuid parameter anymore let childJson = child.toJSON(randomizeUuid) idMap[child.idx] = childJson.idx json.children.push(childJson); @@ -2253,7 +2254,7 @@ class Layer extends Widget { for (let key in frameJson.keys) { if (key in idMap) { frameJson.keys[idMap[key]] = frameJson.keys[key] - delete frameJson.keys[key] + // delete frameJson.keys[key] } } json.frames.push(frameJson); @@ -4364,9 +4365,9 @@ async function _save(path) { } return value; } - for (let action of undoStack) { - console.log(action.name); - } + // for (let action of undoStack) { + // console.log(action.name); + // } const fileData = { version: "1.7", width: config.fileWidth, @@ -4686,6 +4687,8 @@ async function importFile() { uuidCache[key] = uuidv4(); // Store the generated UUID for the value } obj[key] = uuidCache[key]; // Assign the UUID to the object property + } else if (value in uuidCache) { + obj[key] = value } } } From 62daaf9e42468971f9ab3ee91baa4e9021f99531 Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Tue, 14 Jan 2025 02:10:39 -0500 Subject: [PATCH 3/4] technically a new file version --- src/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index 5057117..0c696bc 100644 --- a/src/main.js +++ b/src/main.js @@ -4369,7 +4369,7 @@ async function _save(path) { // console.log(action.name); // } const fileData = { - version: "1.7", + version: "1.7.5", width: config.fileWidth, height: config.fileHeight, fps: config.framerate, From f2ae5624d7bd5396e1a7f9bd8459e6feff672dd9 Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Tue, 14 Jan 2025 02:11:43 -0500 Subject: [PATCH 4/4] Bump version to 0.7.8 --- Changelog.md | 5 +++++ src-tauri/tauri.conf.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index a71dacb..d58d29a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,8 @@ +# 0.7.8-alpha: +Bugfixes: +- Fix mp4 export on macOS +- Fix animations in imported clips not playing grouped object movements correctly + # 0.7.7-alpha: Bugfixes: - Fix pasting multiple times diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 59cf689..2117e94 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Lightningbeam", - "version": "0.7.7-alpha", + "version": "0.7.8-alpha", "identifier": "org.lightningbeam.core", "build": { "frontendDist": "../src"