trialed windows file path issues
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @description a script with a UI that will automate rendering process for multiple screens
|
* @description a script with a UI that will automate rendering process for multiple screens
|
||||||
* @name show-render-helper
|
* @name Show Render Helper
|
||||||
* @author Kyle Harter <kylenmotion@gmail.com>
|
* @author Kyle Harter <kylenmotion@gmail.com>
|
||||||
*
|
*
|
||||||
* @license This script is provided "as is," without warranty of any kind, expressed or implied. In
|
* @license This script is provided "as is," without warranty of any kind, expressed or implied. In
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
//@include "../library/OS.jsx";
|
//@include "../library/OS.jsx";
|
||||||
//@include "../library/json2.js"
|
//@include "../library/json2.js"
|
||||||
|
|
||||||
var versionNumber = '0.1.2';
|
var versionNumber = '0.1.4';
|
||||||
var scriptName = "Show Render Helper" + ' v' + versionNumber;
|
var scriptName = "Show Render Helper" + ' v' + versionNumber;
|
||||||
|
|
||||||
createUI(thisObj)
|
createUI(thisObj)
|
||||||
@@ -49,11 +49,12 @@
|
|||||||
proj = app.project;
|
proj = app.project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var defaultFolder = proj && proj.file ? new Folder(proj.file.parent.absoluteURI + '/renders') : Folder.desktop
|
||||||
|
|
||||||
var DEFAULT_SETTINGS = {
|
var DEFAULT_SETTINGS = {
|
||||||
settings:{
|
settings:{
|
||||||
defaultOutputPath: proj && proj.file ? proj.file.parent.fsName + separator + 'renders' : Folder.desktop.fsName,
|
defaultOutputPath: defaultFolder.absoluteURI,
|
||||||
qcExports: true
|
qcExports : true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +159,7 @@
|
|||||||
var locationButton = locationPanel.add("button", undefined, undefined, {name: "locationButton"});
|
var locationButton = locationPanel.add("button", undefined, undefined, {name: "locationButton"});
|
||||||
locationButton.text = "Choose Location...";
|
locationButton.text = "Choose Location...";
|
||||||
var renderLocationText = locationPanel.add("statictext", undefined, undefined, {name: "renderLocationText"});
|
var renderLocationText = locationPanel.add("statictext", undefined, undefined, {name: "renderLocationText"});
|
||||||
renderLocationText.text = truncateFilePath(DEFAULT_SETTINGS.settings.defaultOutputPath, separator);
|
renderLocationText.text = truncateFilePath(Folder.decode(DEFAULT_SETTINGS.settings.defaultOutputPath), separator);
|
||||||
renderLocationText.characters = 25;
|
renderLocationText.characters = 25;
|
||||||
|
|
||||||
|
|
||||||
@@ -167,6 +168,8 @@
|
|||||||
renderPanel.alignChildren = ['fill', 'top'];
|
renderPanel.alignChildren = ['fill', 'top'];
|
||||||
renderPanel.margins = panelMargins;
|
renderPanel.margins = panelMargins;
|
||||||
var renderButton = renderPanel.add("button", undefined, 'Render', {name: "renderButton"});
|
var renderButton = renderPanel.add("button", undefined, 'Render', {name: "renderButton"});
|
||||||
|
//<------ TEST ------->
|
||||||
|
// Button used for spot bug testing to avoid going through entire render process
|
||||||
// var testButton = renderPanel.add("button", undefined, 'Test', {name: "renderButton"});
|
// var testButton = renderPanel.add("button", undefined, 'Test', {name: "renderButton"});
|
||||||
|
|
||||||
|
|
||||||
@@ -210,7 +213,7 @@
|
|||||||
var settingsLocationButton = settingsLocationPanel.add("button", undefined, undefined, {name: "settingsLocationButton"});
|
var settingsLocationButton = settingsLocationPanel.add("button", undefined, undefined, {name: "settingsLocationButton"});
|
||||||
settingsLocationButton.text = "Choose Default Location...";
|
settingsLocationButton.text = "Choose Default Location...";
|
||||||
var settingsLocationText = settingsLocationPanel.add("statictext", undefined, undefined, {name: "settingsLocationText"});
|
var settingsLocationText = settingsLocationPanel.add("statictext", undefined, undefined, {name: "settingsLocationText"});
|
||||||
settingsLocationText.text = truncateFilePath(DEFAULT_SETTINGS.settings.defaultOutputPath, separator);
|
settingsLocationText.text = truncateFilePath(Folder.decode(DEFAULT_SETTINGS.settings.defaultOutputPath), separator);
|
||||||
|
|
||||||
var settingsQCPanel = settingsGroup.add('panel', undefined, undefined);
|
var settingsQCPanel = settingsGroup.add('panel', undefined, undefined);
|
||||||
settingsQCPanel.orientation = 'column'
|
settingsQCPanel.orientation = 'column'
|
||||||
@@ -226,33 +229,51 @@
|
|||||||
// saveSettingsPanel.alignment = ['fill', 'bottom'];
|
// saveSettingsPanel.alignment = ['fill', 'bottom'];
|
||||||
saveSettingsPanel.alignChildren = ['fill', 'fill'];
|
saveSettingsPanel.alignChildren = ['fill', 'fill'];
|
||||||
saveSettingsPanel.margins = panelMargins;
|
saveSettingsPanel.margins = panelMargins;
|
||||||
|
var revealSettingsButton = saveSettingsPanel.add("button", undefined, undefined, {name: "saveSettingsButton"});
|
||||||
|
revealSettingsButton.text = "Reveal Settings";
|
||||||
var saveSettingsButton = saveSettingsPanel.add("button", undefined, undefined, {name: "saveSettingsButton"});
|
var saveSettingsButton = saveSettingsPanel.add("button", undefined, undefined, {name: "saveSettingsButton"});
|
||||||
saveSettingsButton.text = "Save Settings";
|
saveSettingsButton.text = "Save Settings";
|
||||||
|
|
||||||
|
//<------ TEST ------->
|
||||||
|
// Event handler used for spot bug testing to avoid going through entire render process
|
||||||
|
/* testButton.addEventListener('mousedown', function(){
|
||||||
|
var renderFolder = new Folder(renderFolderPath);
|
||||||
|
var test = renderFolder;
|
||||||
|
alert(test.toString())
|
||||||
|
}) */
|
||||||
|
|
||||||
|
|
||||||
|
revealSettingsButton.addEventListener('mousedown', function(){
|
||||||
|
var settingsFolder = getSettingsFolder();
|
||||||
|
return settingsFolder.execute()
|
||||||
|
})
|
||||||
|
|
||||||
settingsLocationButton.addEventListener('mousedown', function(){
|
settingsLocationButton.addEventListener('mousedown', function(){
|
||||||
var updatedDefaultLocation = Folder.selectDialog('Select a default output location');
|
var updatedDefaultLocation = Folder.selectDialog('Select a default output location');
|
||||||
|
var settingsLocation = updatedDefaultLocation.absoluteURI;
|
||||||
|
var settingsDisplay = Folder.decode(settingsLocation);
|
||||||
if(updatedDefaultLocation !== null){
|
if(updatedDefaultLocation !== null){
|
||||||
var truncatedDisplayText = truncateFilePath(updatedDefaultLocation.fsName, separator);
|
var truncatedDisplayText = truncateFilePath(settingsDisplay, separator);
|
||||||
settingsLocationText.text = truncatedDisplayText;
|
settingsLocationText.text = truncatedDisplayText;
|
||||||
renderLocationText.text = truncatedDisplayText;
|
renderLocationText.text = truncatedDisplayText;
|
||||||
DEFAULT_SETTINGS.settings.defaultOutputPath = updatedDefaultLocation.fsName
|
DEFAULT_SETTINGS.settings.defaultOutputPath = updatedDefaultLocation.absoluteURI
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
|
||||||
function syncQCExports(newVal){
|
|
||||||
settingsQCCB.value = newVal;
|
|
||||||
qcExports.value = newVal;
|
|
||||||
DEFAULT_SETTINGS.settings.qcExports = newVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description updates QC checkbox in UI
|
||||||
|
*/
|
||||||
settingsQCCB.onClick = function(){
|
settingsQCCB.onClick = function(){
|
||||||
qcExports.value = settingsQCCB.value;
|
qcExports.value = settingsQCCB.value;
|
||||||
DEFAULT_SETTINGS.settings.qcExports = settingsQCCB.value;
|
DEFAULT_SETTINGS.settings.qcExports = settingsQCCB.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description saves settings to settings file on disk
|
||||||
|
*/
|
||||||
|
|
||||||
saveSettingsButton.addEventListener('mousedown', function(){
|
saveSettingsButton.addEventListener('mousedown', function(){
|
||||||
saveSettingsButton.text = 'Saving...'
|
saveSettingsButton.text = 'Saving...'
|
||||||
if(writeSettingsFile(DEFAULT_SETTINGS)){
|
if(writeSettingsFile(DEFAULT_SETTINGS)){
|
||||||
@@ -261,14 +282,17 @@
|
|||||||
saveSettingsButton.text = "Save Settings"
|
saveSettingsButton.text = "Save Settings"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
// Opens URL in browser for AOM file
|
* @description opens default browser to reveal output module location on GDrive
|
||||||
|
*/
|
||||||
|
|
||||||
omSourceButton.addEventListener('mousedown', function(){
|
omSourceButton.addEventListener('mousedown', function(){
|
||||||
var userOS = OS;
|
var userOS = OS;
|
||||||
var launchCode = userOS.openUrl("https://drive.google.com/file/d/1c7ezAQF5_Sy-e0WlRHLGbPluproroBw1/view")
|
var launchCode = userOS.openUrl("https://drive.google.com/file/d/1c7ezAQF5_Sy-e0WlRHLGbPluproroBw1/view")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
helpEditText.text = setHelpMessage(scriptName, versionNumber);
|
helpEditText.text = setHelpMessage(scriptName, versionNumber);
|
||||||
|
|
||||||
|
|
||||||
@@ -276,7 +300,9 @@
|
|||||||
var bottomWalls = rightColumn.children;
|
var bottomWalls = rightColumn.children;
|
||||||
var wallsArray = [topWalls[0], topWalls[1], bottomWalls[0], bottomWalls[1]];
|
var wallsArray = [topWalls[0], topWalls[1], bottomWalls[0], bottomWalls[1]];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description selects or deselects all wall checkboxes
|
||||||
|
*/
|
||||||
allWalls.onClick = function(){
|
allWalls.onClick = function(){
|
||||||
|
|
||||||
if(allWalls.value == false){
|
if(allWalls.value == false){
|
||||||
@@ -291,24 +317,24 @@
|
|||||||
|
|
||||||
var renderFolderPath = DEFAULT_SETTINGS.settings.defaultOutputPath;
|
var renderFolderPath = DEFAULT_SETTINGS.settings.defaultOutputPath;
|
||||||
|
|
||||||
function truncateFilePath(filePathString, separator) {
|
|
||||||
var pathArray = filePathString.split(separator);
|
|
||||||
var startString = pathArray.slice(0, 1).join(separator);
|
|
||||||
var endString = pathArray.slice(-2,pathArray.length).join(separator);
|
|
||||||
|
|
||||||
var outputString = '...' + separator + endString + separator;
|
|
||||||
return outputString;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description sets location of parent output folder
|
||||||
|
*/
|
||||||
locationButton.addEventListener('mousedown', function(){
|
locationButton.addEventListener('mousedown', function(){
|
||||||
var renderFolder = Folder.selectDialog('Select render destination');
|
var renderFolder = Folder.selectDialog('Select render destination');
|
||||||
if(renderFolder !== null){
|
if(renderFolder !== null){
|
||||||
renderFolderPath = renderFolder.fsName;
|
renderFolderPath = renderFolder.absoluteURI;
|
||||||
var outputString = truncateFilePath(renderFolderPath, separator)
|
var displayFolderPath = Folder.decode(renderFolderPath)
|
||||||
|
var outputString = truncateFilePath(displayFolderPath, separator)
|
||||||
renderLocationText.text = outputString
|
renderLocationText.text = outputString
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description begins render process and post-reender actions
|
||||||
|
*/
|
||||||
|
|
||||||
renderButton.onClick = function(){
|
renderButton.onClick = function(){
|
||||||
try {
|
try {
|
||||||
app.beginUndoGroup("Renders Comps");
|
app.beginUndoGroup("Renders Comps");
|
||||||
@@ -353,14 +379,12 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!Folder.renderFolderPath){
|
var renderFolder = new Folder(renderFolderPath);
|
||||||
renderFolderPath = new Folder(renderFolderPath);
|
if(!renderFolder.exists){
|
||||||
if(!renderFolderPath.exists){
|
renderFolder.create()
|
||||||
renderFolderPath.create()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(renderFolderPath == '') {
|
if(renderFolder.absoluteURI == '') {
|
||||||
alert('Whoops!\rYou don\'t have a folder destination selcted. Select one and try again.');
|
alert('Whoops!\rYou don\'t have a folder destination selcted. Select one and try again.');
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -387,7 +411,7 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var renderPipeline = buildRenderPipeline(renderComps,renderQueue,templateArray,renderFolderPath);
|
var renderPipeline = buildRenderPipeline(renderComps,renderQueue,templateArray,renderFolder);
|
||||||
// RENDERRRRR //
|
// RENDERRRRR //
|
||||||
app.endUndoGroup()
|
app.endUndoGroup()
|
||||||
|
|
||||||
@@ -408,21 +432,21 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
completedComps.push(renderPipeline.rqComps[r]);
|
completedComps.push(renderPipeline.rqComps[r]);
|
||||||
} else {
|
} else {
|
||||||
failedComps.push({
|
failedComps.push({
|
||||||
comps: renderPipeline.rqComps[r],
|
comps : renderPipeline.rqComps[r],
|
||||||
status: item.status
|
status: item.status
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(completedComps.length > 0){
|
if(completedComps.length > 0){
|
||||||
var baseOutputAlert = 'Success!\rYour files were exported to:\r\r' + renderFolderPath.toString() + '\r\r';
|
var baseOutputAlert = 'Success!\rYour files were exported to:\r\r' + Folder.decode(renderFolderPath) + '\r\r';
|
||||||
if(qcExports.value){
|
if(qcExports.value){
|
||||||
var aeFolders = createImportFolders('zz_QC', completedComps, km.getOrCreateFolder);
|
var aeFolders = createImportFolders('zz_QC', completedComps, km.getOrCreateFolder);
|
||||||
alert(baseOutputAlert += 'Your exports will be imported into AE inside the folder named zz_QC for quality control');
|
alert(baseOutputAlert += 'Your exports will be imported into AE inside the folder named zz_QC for quality control.');
|
||||||
importExportsIntoAE(proj, aeFolders, renderFolderPath, renderPipeline.outputFileNames)
|
importExportsIntoAE(proj, aeFolders, renderPipeline.outputFolders, renderPipeline.outputFileNames)
|
||||||
} else {
|
} else {
|
||||||
alert(baseOutputAlert)
|
alert(baseOutputAlert)
|
||||||
var outputFolder = new Folder(renderFolderPath);
|
var outputFolder = new Folder.decode(renderFolderPath);
|
||||||
outputFolder.execute()
|
outputFolder.execute()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -433,11 +457,46 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// HELPER FUNCTIONS
|
// HELPER FUNCTIONS
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description syncs QC exports settings
|
||||||
|
* @param {any} newVal
|
||||||
|
*/
|
||||||
|
function syncQCExports(newVal){
|
||||||
|
settingsQCCB.value = newVal;
|
||||||
|
qcExports.value = newVal;
|
||||||
|
DEFAULT_SETTINGS.settings.qcExports = newVal;
|
||||||
|
}
|
||||||
|
|
||||||
function importExportsIntoAE(proj, folders, location, names){
|
|
||||||
var exports = getExports(location, names);
|
/**
|
||||||
|
* @description truncates input file path string for eventual display in UI
|
||||||
|
* @param {string} filePathString
|
||||||
|
* @param {string} separator - OS-specific path separator
|
||||||
|
* @return {string} outputstring for display
|
||||||
|
*/
|
||||||
|
function truncateFilePath(filePathString, separator) {
|
||||||
|
var pathArray = filePathString.split(separator);
|
||||||
|
var startString = pathArray.slice(0, 1).join(separator);
|
||||||
|
var endString = pathArray.slice(-2,pathArray.length).join(separator);
|
||||||
|
|
||||||
|
var outputString = '...' + separator + endString + separator;
|
||||||
|
return outputString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description imports exported files back into AE and sorts into targeted folders
|
||||||
|
* @param {object} proj - app project
|
||||||
|
* @param {array} folders - array of comp folders
|
||||||
|
* @param {string} locations - file path locations of exported files
|
||||||
|
* @param {array} names - output file names
|
||||||
|
*/
|
||||||
|
function importExportsIntoAE(proj, folders, locations, names){
|
||||||
|
var exports = getExports(locations, names);
|
||||||
var compFolders = folders.compFolders;
|
var compFolders = folders.compFolders;
|
||||||
for(var e = 0; e<exports.length; e++){
|
for(var e = 0; e<exports.length; e++){
|
||||||
var renders = exports[e];
|
var renders = exports[e];
|
||||||
@@ -460,6 +519,13 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description creates folders for imported renders to be sorted into
|
||||||
|
* @param {string} parentFolderName
|
||||||
|
* @param {array} exportedComps exported comps from AE
|
||||||
|
* @param {Function} getFolders - callback function to search folders in AE
|
||||||
|
* @return {Object} returns parent folder to import files into and comp folders that are created per rendered comp
|
||||||
|
*/
|
||||||
function createImportFolders(parentFolderName, exportedComps, getFolders){
|
function createImportFolders(parentFolderName, exportedComps, getFolders){
|
||||||
var parentFolder = getFolders(app.project,parentFolderName);
|
var parentFolder = getFolders(app.project,parentFolderName);
|
||||||
var compFolders = [];
|
var compFolders = [];
|
||||||
@@ -471,35 +537,53 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
parentFolder: parentFolder,
|
parentFolder: parentFolder,
|
||||||
compFolders: compFolders
|
compFolders : compFolders
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getExports(location, names){
|
/**
|
||||||
|
* @description gets exported files from output location
|
||||||
|
* @param {array} locations - gets locations of output folders of each exported comp
|
||||||
|
* @param {array} names - output filenames based on output modules
|
||||||
|
* @return {array} absolute file paths of exports
|
||||||
|
*/
|
||||||
|
function getExports(locations, names){
|
||||||
var exports = [];
|
var exports = [];
|
||||||
var outputFolder = new Folder(location)
|
for(var l = 0; l< locations.length; l++){
|
||||||
|
var location = locations[l];
|
||||||
|
var outputFolder = new Folder(location);
|
||||||
var files = outputFolder.getFiles('*.mov');
|
var files = outputFolder.getFiles('*.mov');
|
||||||
for(var f = 0; f<files.length; f++){
|
for(var f = 0; f<files.length; f++){
|
||||||
var file = files[f];
|
var file = files[f];
|
||||||
for(var d = 0; d<names.length; d++){
|
for(var d = 0; d<names.length; d++){
|
||||||
var dataName = names[d];
|
var dataName = names[d];
|
||||||
if(file.name.replace(/%20/g, ' ') === dataName){
|
if(file.name.replace(/%20/g, ' ') === dataName){
|
||||||
exports.push(file.fsName)
|
exports.push(file.absoluteURI)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return exports
|
return exports
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description builds render queue items, output modules, and output files
|
||||||
|
* @param {array} comps - selected comps to be exported
|
||||||
|
* @param {Object} rq - render queue object
|
||||||
|
* @param {array} wallTemplates - output module templates
|
||||||
|
* @param {Object} folderOutput - Selected parent output folder
|
||||||
|
* @return {Object} render queue items, render queue comp references, output file names, output subfolders
|
||||||
|
*/
|
||||||
function buildRenderPipeline(comps,rq,wallTemplates,folderOutput){
|
function buildRenderPipeline(comps,rq,wallTemplates,folderOutput){
|
||||||
var outputFileNames = [];
|
var outputFileNames = [];
|
||||||
var rqComps = [];
|
var rqComps = [];
|
||||||
var rqItems = [];
|
var rqItems = [];
|
||||||
|
var outputFolders = [];
|
||||||
for(var c = 0; c<comps.length; c++){
|
for(var c = 0; c<comps.length; c++){
|
||||||
var comp = comps[c];
|
var comp = comps[c];
|
||||||
var rqComp = rq.items.add(comp);
|
var rqComp = rq.items.add(comp);
|
||||||
@@ -509,6 +593,7 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
while(rqCompOMCollect.length < wallTemplates.length){
|
while(rqCompOMCollect.length < wallTemplates.length){
|
||||||
rqCompOMCollect.add()
|
rqCompOMCollect.add()
|
||||||
}
|
}
|
||||||
|
var folder_path = Folder.decode(folderOutput.absoluteURI);
|
||||||
for(var i = 0; i<rqCompOMCollect.length; i++){
|
for(var i = 0; i<rqCompOMCollect.length; i++){
|
||||||
var om = rqComp.outputModule(i+1);
|
var om = rqComp.outputModule(i+1);
|
||||||
var templateName = wallTemplates[i];
|
var templateName = wallTemplates[i];
|
||||||
@@ -517,7 +602,6 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
|
|
||||||
|
|
||||||
var file_name = File.decode(om.file.name);
|
var file_name = File.decode(om.file.name);
|
||||||
var folder_path = Folder.decode(folderOutput);
|
|
||||||
var fileNameSplit = file_name.split('.');
|
var fileNameSplit = file_name.split('.');
|
||||||
var fileNameString = fileNameSplit[0].split('_');
|
var fileNameString = fileNameSplit[0].split('_');
|
||||||
var fileNameBaseWall = fileNameString.slice(0,fileNameString.length-1).join('_') + '_'+ templateNameWall.toString() + '_' + fileNameString.slice(-1).toString();
|
var fileNameBaseWall = fileNameString.slice(0,fileNameString.length-1).join('_') + '_'+ templateNameWall.toString() + '_' + fileNameString.slice(-1).toString();
|
||||||
@@ -526,37 +610,48 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
outputFileNames.push(outputFileName)
|
outputFileNames.push(outputFileName)
|
||||||
var new_data = {
|
var new_data = {
|
||||||
"Output File Info": {
|
"Output File Info": {
|
||||||
"Base Path": folder_path,
|
"Base Path" : folder_path,
|
||||||
"File Name": outputFileName
|
"Subfolder Path": rqComp.comp.name,
|
||||||
|
"File Name" : outputFileName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
om.setSettings(new_data)
|
om.setSettings(new_data)
|
||||||
}
|
}
|
||||||
|
outputFolders.push(folder_path + '/' + rqComp.comp.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
rqItems: rqItems,
|
rqItems : rqItems,
|
||||||
rqComps : rqComps,
|
rqComps : rqComps,
|
||||||
outputFileNames: outputFileNames
|
outputFileNames: outputFileNames,
|
||||||
|
outputFolders : outputFolders
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description gets targeted OS-specific path separator
|
||||||
|
* @return {string} separator
|
||||||
|
*/
|
||||||
function getSeparator(){
|
function getSeparator(){
|
||||||
var os = $.os.toLowerCase().indexOf('mac') >= 0 ? "MAC": "WINDOWS";
|
var os = $.os.toLowerCase().indexOf('mac') >= 0 ? "MAC": "WINDOWS";
|
||||||
var separator = os === 'MAC' ? '/' : '\\';
|
var separator = os === 'MAC' ? '/' : '\\';
|
||||||
return separator
|
return separator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description gets settings folder where settings json lives
|
||||||
|
* @return {Folder} OS-targeted settings folder
|
||||||
|
*/
|
||||||
function getSettingsFolder(){
|
function getSettingsFolder(){
|
||||||
var userDataFolder = new Folder(Folder.userData.fsName);
|
var separator = getSeparator();
|
||||||
var kmToolsFolder = new Folder(userDataFolder.fsName + '/km-tools');
|
var userDataFolder = new Folder(Folder.userData.absoluteURI);
|
||||||
|
var kmToolsFolder = new Folder(userDataFolder.absoluteURI + '/km-tools');
|
||||||
if(!kmToolsFolder.exists){
|
if(!kmToolsFolder.exists){
|
||||||
kmToolsFolder.create()
|
kmToolsFolder.create()
|
||||||
}
|
}
|
||||||
|
|
||||||
var settingsFolder = new Folder(kmToolsFolder.fsName + '/sparks-render-helper');
|
var settingsFolder = new Folder(kmToolsFolder.absoluteURI + '/sparks-render-helper');
|
||||||
if(!settingsFolder.exists){
|
if(!settingsFolder.exists){
|
||||||
settingsFolder.create()
|
settingsFolder.create()
|
||||||
}
|
}
|
||||||
@@ -564,11 +659,19 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
return settingsFolder
|
return settingsFolder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description gets settings file
|
||||||
|
* @return {File} settings json file
|
||||||
|
*/
|
||||||
function getSettingsFile(){
|
function getSettingsFile(){
|
||||||
var settingsFile = new File(getSettingsFolder().fsName + '/settings.json')
|
var settingsFile = new File(getSettingsFolder().absoluteURI + '/settings.json')
|
||||||
return settingsFile
|
return settingsFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description reads settings json file
|
||||||
|
* @return {Object} json data from settings file
|
||||||
|
*/
|
||||||
function readSettingsFile(){
|
function readSettingsFile(){
|
||||||
var file = getSettingsFile();
|
var file = getSettingsFile();
|
||||||
if(!file.exists){
|
if(!file.exists){
|
||||||
@@ -591,13 +694,18 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description writes data to settings file
|
||||||
|
* @param {Object} data - data to be written to json file
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
function writeSettingsFile(data){
|
function writeSettingsFile(data){
|
||||||
var file = getSettingsFile();
|
var file = getSettingsFile();
|
||||||
|
|
||||||
var json = JSON.stringify(data, null, 4);
|
var json = JSON.stringify(data, null, 4);
|
||||||
|
|
||||||
if(!file.open('w')){
|
if(!file.open('w')){
|
||||||
alert('Could not open settings file:\n' + file.fsName)
|
alert('Could not open settings file:\n' + file.absoluteURI)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,6 +719,12 @@ function truncateFilePath(filePathString, separator) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description builds help message for help tab
|
||||||
|
* @param {string} scriptName
|
||||||
|
* @param {srting} versionNumber
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
function setHelpMessage(scriptName, versionNumber){
|
function setHelpMessage(scriptName, versionNumber){
|
||||||
var lines = [
|
var lines = [
|
||||||
'ABOUT ' + scriptName.toUpperCase(),
|
'ABOUT ' + scriptName.toUpperCase(),
|
||||||
|
|||||||
Reference in New Issue
Block a user