Corrected a UI issue with selecting directories of non-supported images. Works on macOS now with videos, images and image sequences. Testing on linux again before resolving.

This commit is contained in:
Matt McWilliams 2021-02-24 11:50:15 -05:00
parent fb7b1e2fb6
commit 31c701734a
6 changed files with 50 additions and 24 deletions

View File

@ -169,9 +169,11 @@ class FilmOut {
} }
else if (this.stillExtensions.indexOf(ext) !== -1) { else if (this.stillExtensions.indexOf(ext) !== -1) {
this.state.still = true; this.state.still = true;
this.state.directory = false;
} }
else if (this.videoExtensions.indexOf(ext) !== -1) { else if (this.videoExtensions.indexOf(ext) !== -1) {
this.state.still = false; this.state.still = false;
this.state.directory = false;
} }
else { else {
this.log.error(`File is not of a valid file type`, 'FILMOUT', true, true); this.log.error(`File is not of a valid file type`, 'FILMOUT', true, true);

File diff suppressed because one or more lines are too long

View File

@ -150,7 +150,6 @@ class FilmOut {
let linuxChoice = 0; let linuxChoice = 0;
if (process.platform === 'linux') { if (process.platform === 'linux') {
linuxChoice = yield gui.choice(linuxMessage, linuxChoices); linuxChoice = yield gui.choice(linuxMessage, linuxChoices);
console.log(linuxChoice);
if (linuxChoice === 0) { if (linuxChoice === 0) {
options.properties = ['openFile']; options.properties = ['openFile'];
} }
@ -174,12 +173,14 @@ class FilmOut {
pathStr = files.filePaths[0]; pathStr = files.filePaths[0];
displayName = path.basename(pathStr); displayName = path.basename(pathStr);
valid = this.validateSelection(files); valid = this.validateSelection(files);
if (valid) {
log.info(`Selected "${displayName}"`, 'FILMOUT', true); log.info(`Selected "${displayName}"`, 'FILMOUT', true);
elem.attr('data-file', pathStr); elem.attr('data-file', pathStr);
elem.val(displayName); elem.val(displayName);
$('#filmout_file').val(displayName); $('#filmout_file').val(displayName);
this.useFile(); this.useFile();
} }
}
if (!valid) { if (!valid) {
gui.warn('Invalid selection', `The selection "${displayName}" is not an accepted video, image or folder containing an image sequence.`); gui.warn('Invalid selection', `The selection "${displayName}" is not an accepted video, image or folder containing an image sequence.`);
return false; return false;
@ -208,7 +209,7 @@ class FilmOut {
fileList = fs.readdirSync(pathStr); fileList = fs.readdirSync(pathStr);
fileList = fileList.filter((file) => { fileList = fileList.filter((file) => {
let ext = path.extname(file).toLowerCase(); let ext = path.extname(file).toLowerCase();
if (this.sequenceExtensions.indexOf(ext)) { if (this.sequenceExtensions.indexOf(ext) !== -1) {
return true; return true;
} }
return false; return false;
@ -216,13 +217,18 @@ class FilmOut {
if (fileList.length > 0) { if (fileList.length > 0) {
valid = true; valid = true;
} }
else {
valid = false;
} }
}
else {
ext = path.extname(pathStr.toLowerCase()); ext = path.extname(pathStr.toLowerCase());
valid = this.videoExtensions.indexOf(ext) === -1; valid = this.videoExtensions.indexOf(ext) === -1;
if (!valid) { if (!valid) {
valid = this.stillExtensions.indexOf(ext) === -1; valid = this.stillExtensions.indexOf(ext) === -1;
} }
} }
}
return valid; return valid;
} }
/** /**
@ -288,6 +294,7 @@ class FilmOut {
$('#filmout_stats_video_name').text(state.fileName); $('#filmout_stats_video_name').text(state.fileName);
$('#filmout_stats_video_size').text(`${state.info.width} x ${state.info.height}`); $('#filmout_stats_video_size').text(`${state.info.width} x ${state.info.height}`);
$('#filmout_stats_video_frames').text(`${state.frames} frames`); $('#filmout_stats_video_frames').text(`${state.frames} frames`);
this.reset();
gui.updateState(); gui.updateState();
this.previewFrame(); this.previewFrame();
if (!this.state.directory) { if (!this.state.directory) {
@ -359,6 +366,10 @@ class FilmOut {
} }
$('#filmout_position').val(this.state.frame).trigger('change'); $('#filmout_position').val(this.state.frame).trigger('change');
} }
reset() {
this.state.frame = 0;
$('#filmout_position').val(this.state.frame).trigger('change');
}
preview() { preview() {
const frame = this.state.frame; const frame = this.state.frame;
ipcRenderer.send('preview', { frame }); ipcRenderer.send('preview', { frame });

File diff suppressed because one or more lines are too long

View File

@ -176,12 +176,14 @@ class FilmOut {
pathStr = files.filePaths[0]; pathStr = files.filePaths[0];
displayName = path.basename(pathStr); displayName = path.basename(pathStr);
valid = this.validateSelection(files); valid = this.validateSelection(files);
if (valid) {
log.info(`Selected "${displayName}"`, 'FILMOUT', true); log.info(`Selected "${displayName}"`, 'FILMOUT', true);
elem.attr('data-file', pathStr); elem.attr('data-file', pathStr);
elem.val(displayName); elem.val(displayName);
$('#filmout_file').val(displayName); $('#filmout_file').val(displayName);
this.useFile(); this.useFile();
} }
}
if (!valid) { if (!valid) {
gui.warn('Invalid selection', `The selection "${displayName}" is not an accepted video, image or folder containing an image sequence.`); gui.warn('Invalid selection', `The selection "${displayName}" is not an accepted video, image or folder containing an image sequence.`);
@ -211,21 +213,24 @@ class FilmOut {
fileList = fs.readdirSync(pathStr); fileList = fs.readdirSync(pathStr);
fileList = fileList.filter((file : string) => { fileList = fileList.filter((file : string) => {
let ext : string = path.extname(file).toLowerCase(); let ext : string = path.extname(file).toLowerCase();
if (this.sequenceExtensions.indexOf(ext)) { if (this.sequenceExtensions.indexOf(ext) !== -1) {
return true; return true;
} }
return false; return false;
}); });
if (fileList.length > 0) { if (fileList.length > 0) {
valid = true; valid = true;
} else {
valid = false
} }
} } else {
ext = path.extname(pathStr.toLowerCase()); ext = path.extname(pathStr.toLowerCase());
valid = this.videoExtensions.indexOf(ext) === -1; valid = this.videoExtensions.indexOf(ext) === -1;
if (!valid) { if (!valid) {
valid = this.stillExtensions.indexOf(ext) === -1; valid = this.stillExtensions.indexOf(ext) === -1;
} }
} }
}
return valid; return valid;
} }
@ -297,6 +302,7 @@ class FilmOut {
$('#filmout_stats_video_size').text(`${state.info.width} x ${state.info.height}`); $('#filmout_stats_video_size').text(`${state.info.width} x ${state.info.height}`);
$('#filmout_stats_video_frames').text(`${state.frames} frames`); $('#filmout_stats_video_frames').text(`${state.frames} frames`);
this.reset();
gui.updateState(); gui.updateState();
this.previewFrame(); this.previewFrame();
if (!this.state.directory) { if (!this.state.directory) {
@ -375,6 +381,11 @@ class FilmOut {
$('#filmout_position').val(this.state.frame).trigger('change'); $('#filmout_position').val(this.state.frame).trigger('change');
} }
reset () {
this.state.frame = 0;
$('#filmout_position').val(this.state.frame).trigger('change');
}
preview () { preview () {
const frame : number = this.state.frame; const frame : number = this.state.frame;
ipcRenderer.send('preview', { frame }); ipcRenderer.send('preview', { frame });

View File

@ -178,8 +178,10 @@ class FilmOut {
this.state.still = !isAnimated; this.state.still = !isAnimated;
} else if (this.stillExtensions.indexOf(ext) !== -1) { } else if (this.stillExtensions.indexOf(ext) !== -1) {
this.state.still = true; this.state.still = true;
this.state.directory = false;
} else if (this.videoExtensions.indexOf(ext) !== -1) { } else if (this.videoExtensions.indexOf(ext) !== -1) {
this.state.still = false; this.state.still = false;
this.state.directory = false;
} else { } else {
this.log.error(`File is not of a valid file type`, 'FILMOUT', true, true); this.log.error(`File is not of a valid file type`, 'FILMOUT', true, true);
return false; return false;