From ef3449c347944dea8d35d90f5179737d44ed3910 Mon Sep 17 00:00:00 2001 From: Evan BLAUDY Date: Wed, 5 Jan 2022 14:46:31 +0100 Subject: [PATCH] [harmony] different fixes for Harmony with openHarmony --- .../src/components/modals/AddPreviewModal.vue | 4 +- .../Kitsu Publisher Plugin/HTTP/server.js | 15 +++--- .../Kitsu Publisher Plugin/configure.js | 4 +- .../Kitsu Publisher Plugin/harmonyServer.js | 47 ++++++++++++------- 4 files changed, 43 insertions(+), 27 deletions(-) diff --git a/app/renderer/src/components/modals/AddPreviewModal.vue b/app/renderer/src/components/modals/AddPreviewModal.vue index 3b0cf36..6cb51d8 100644 --- a/app/renderer/src/components/modals/AddPreviewModal.vue +++ b/app/renderer/src/components/modals/AddPreviewModal.vue @@ -75,7 +75,7 @@

- + = 0 - ? [['.mov', 'QUICKTIME']] - : [['.png', 'PNG']] + return globals.getExtensions( + ['true', '1', 'yes'].indexOf(url.queryItemValue('is_video')) >= 0 + ) }) server.add_route('/take-render-screenshot', ['GET'], function (method, url) { @@ -51,6 +55,14 @@ server.add_route('/take-render-screenshot', ['GET'], function (method, url) { 'Missing query argument ' ) } + + image_extensions = globals.getExtensions(false) + for (var n = 0; n < image_extensions.length; n++) { + if (image_extensions[n][1] == extension) { + extension = image_extensions[n][0] + } + } + output_path = url.queryItemValue('output_path') if (!output_path) { date = new Date() @@ -68,13 +80,14 @@ server.add_route('/take-render-screenshot', ['GET'], function (method, url) { date.getSeconds() output_path = System.getenv('TEMP') + '/harmony-' + date + extension } + use_colorspace = ['true', '1', 'yes'].indexOf(url.queryItemValue('use_colorspace')) >= 0 return { - file: globals.$.scene.exportLayoutImage( + file: $.scene.exportLayoutImage( output_path, undefined, - globals.$.scene.currentFrame, + $.scene.currentFrame, use_colorspace, 1 )._path @@ -108,6 +121,14 @@ server.add_route('/take-render-animation', ['GET'], function (method, url) { 'Missing query argument ' ) } + + video_extensions = globals.getExtensions(true) + for (var n = 0; n < video_extensions.length; n++) { + if (video_extensions[n][1] == extension) { + extension = video_extensions[n][0] + } + } + output_path = url.queryItemValue('output_path') if (!output_path) { date = new Date() @@ -125,18 +146,10 @@ server.add_route('/take-render-animation', ['GET'], function (method, url) { date.getSeconds() output_path = System.getenv('TEMP') + '/harmony-' + date + extension } - output_path = new globals.$.oFile(output_path) + output_path = new $.oFile(output_path) use_colorspace = ['true', '1', 'yes'].indexOf(url.queryItemValue('use_colorspace')) >= 0 - if ( - globals.$.scene.exportQT( - output_path, - globals.$.scene.defaultDisplay, - 1, - true, - false - ) - ) { + if ($.scene.exportQT(output_path, $.scene.defaultDisplay, 1, true, false)) { return { file: output_path.toString() } } else { throw new Error("Can't create QuickTime export (" + output_path + ')')