@nexrender/core 1.30.0 → 1.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/readme.md +7 -0
- package/src/assets/commandLineRenderer-2022.jsx +1130 -0
- package/src/assets/{commandLineRenderer.jsx → commandLineRenderer-default.jsx} +12 -12
- package/src/assets/nexrender.jsx +45 -5
- package/src/helpers/autofind.js +6 -0
- package/src/helpers/patch.js +9 -1
- package/src/index.js +1 -0
- package/src/tasks/actions.js +7 -3
- package/src/tasks/render.js +13 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports = /*syntax:js*/ `// Command line renderer for After Effects. (nexrender-patch-v1.0.
|
|
1
|
+
module.exports = /*syntax:js*/ `// Command line renderer for After Effects. (nexrender-patch-v1.0.3)
|
|
2
2
|
|
|
3
3
|
// This function constructs an AECommandLineRenderer object.
|
|
4
4
|
// One and only one of these will be created to perform rendering tasks
|
|
@@ -120,7 +120,7 @@ function AECommandLineRenderer() {
|
|
|
120
120
|
// Report an error. This writes errors to the log file, if present.
|
|
121
121
|
// This is called from the context of the application, so we
|
|
122
122
|
// need to precede variable names with gAECommandLineRenderer
|
|
123
|
-
//
|
|
123
|
+
//
|
|
124
124
|
function checkParentDied() {
|
|
125
125
|
var result = false;
|
|
126
126
|
if (gAECommandLineRenderer.log_file instanceof Socket) {
|
|
@@ -143,13 +143,13 @@ function AECommandLineRenderer() {
|
|
|
143
143
|
checkParentDied();
|
|
144
144
|
if (severity_string == "PROBLEM" || severity_string == "FATAL") {
|
|
145
145
|
// These two errors cause us to change the exit code.
|
|
146
|
-
// We don't write an error or throw here, because we got here as part of a thrown
|
|
146
|
+
// We don't write an error or throw here, because we got here as part of a thrown
|
|
147
147
|
// error already, and the message will be printed as part of the catch.
|
|
148
148
|
gAECommandLineRenderer.SetExitCode(gAECommandLineRenderer.EXIT_AE_RUNTIME);
|
|
149
149
|
} else {
|
|
150
150
|
// PROBLEM and FATAL will throw exceptions, and so will be logged to the file
|
|
151
151
|
// when we catch the exception.
|
|
152
|
-
// All other errors (NAKED, INFO, WARNING, PROGRESS, and DEBUG) will not
|
|
152
|
+
// All other errors (NAKED, INFO, WARNING, PROGRESS, and DEBUG) will not
|
|
153
153
|
// throw exceptions. So we log them to the file right here:
|
|
154
154
|
if (gAECommandLineRenderer.is_verbose_mode) {
|
|
155
155
|
if (gAECommandLineRenderer.log_file != null) {
|
|
@@ -177,7 +177,7 @@ function AECommandLineRenderer() {
|
|
|
177
177
|
|
|
178
178
|
// Report an error. This establishes exitCodes for reporting errors from AfterFX.
|
|
179
179
|
function my_SetExitCode(code) {
|
|
180
|
-
// Some codes are set differently depending on whether we have a custom user
|
|
180
|
+
// Some codes are set differently depending on whether we have a custom user
|
|
181
181
|
// log file. Check for these and use the alternate if appropriate.
|
|
182
182
|
var real_code = code;
|
|
183
183
|
if (gAECommandLineRenderer.has_user_log_file) {
|
|
@@ -203,7 +203,7 @@ function AECommandLineRenderer() {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
// Arguments may be enclosed in quotes. This
|
|
206
|
+
// Arguments may be enclosed in quotes. This
|
|
207
207
|
// will remove them and return the result.
|
|
208
208
|
function my_StripAnyEnclosingQuotes(inString) {
|
|
209
209
|
var result = inString;
|
|
@@ -514,7 +514,7 @@ function AECommandLineRenderer() {
|
|
|
514
514
|
try {
|
|
515
515
|
// While rendering we'll report errors to the log file.
|
|
516
516
|
if (app.onError == this.onError) {
|
|
517
|
-
// If the previous error handler is just this one, don't store it.
|
|
517
|
+
// If the previous error handler is just this one, don't store it.
|
|
518
518
|
// That can happen in extreme cases where this script does not get a
|
|
519
519
|
// chance to clean up and put back the oldErrorHandler when it's done.
|
|
520
520
|
this.oldErrorHandler = null;
|
|
@@ -719,10 +719,10 @@ function AECommandLineRenderer() {
|
|
|
719
719
|
}
|
|
720
720
|
} else {
|
|
721
721
|
// Render times are stored as timeSpanStart and timeSpanDuration.
|
|
722
|
-
// Setting only the timeSpanStart will not change the timeSpanDuration and
|
|
723
|
-
// so will move the end time, but we want the end time unchanged if
|
|
722
|
+
// Setting only the timeSpanStart will not change the timeSpanDuration and
|
|
723
|
+
// so will move the end time, but we want the end time unchanged if
|
|
724
724
|
// it was not specified.
|
|
725
|
-
// So we must calculate both start_time and end_time,
|
|
725
|
+
// So we must calculate both start_time and end_time,
|
|
726
726
|
// then set both timeSpanStart and timeSpanDuration.
|
|
727
727
|
// Note: frameDuration is stored in the comp.
|
|
728
728
|
var start_time = rqi.timeSpanStart;
|
|
@@ -760,12 +760,12 @@ function AECommandLineRenderer() {
|
|
|
760
760
|
// Increment as defined here is one greater then the
|
|
761
761
|
// the render queue item's skipFrames.
|
|
762
762
|
// skipFrames 0 is the same as increment of 1.
|
|
763
|
-
//
|
|
763
|
+
//
|
|
764
764
|
rqi.skipFrames = (this.in_increment - 1);
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
767
|
|
|
768
|
-
// If we are in verbose mode, set the log type to ERRORS_AND_PER_FRAME_INFO
|
|
768
|
+
// If we are in verbose mode, set the log type to ERRORS_AND_PER_FRAME_INFO
|
|
769
769
|
// for all RQ items we are about to render.
|
|
770
770
|
if (this.is_verbose_mode) {
|
|
771
771
|
this.SetLogPerFrameInfoInRQ();
|
package/src/assets/nexrender.jsx
CHANGED
|
@@ -34,9 +34,45 @@ nexrender.replaceFootage = function (layer, filepath) {
|
|
|
34
34
|
return true;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
/*
|
|
37
|
+
/* invoke callback for every composition matching specific name */
|
|
38
38
|
nexrender.selectCompositionsByName = function(name, callback) {
|
|
39
39
|
var items = [];
|
|
40
|
+
var nameChain = name.split("->");
|
|
41
|
+
var name = nameChain.pop();
|
|
42
|
+
|
|
43
|
+
function isNestedComp(comp, name, parentChain) {
|
|
44
|
+
if (
|
|
45
|
+
name &&
|
|
46
|
+
comp.name === name &&
|
|
47
|
+
parentChain &&
|
|
48
|
+
parentChain.length > 0 &&
|
|
49
|
+
comp.usedIn.length > 0
|
|
50
|
+
) {
|
|
51
|
+
var parentComp = null;
|
|
52
|
+
for (var i = 0; i < comp.usedIn.length; i++) {
|
|
53
|
+
if (
|
|
54
|
+
comp.usedIn[i] instanceof CompItem &&
|
|
55
|
+
comp.usedIn[i].name === parentChain[parentChain.length - 1]
|
|
56
|
+
) {
|
|
57
|
+
parentComp = comp.usedIn[i];
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (parentComp) {
|
|
63
|
+
if (parentChain.length === 1) {
|
|
64
|
+
return true;
|
|
65
|
+
} else {
|
|
66
|
+
return isNestedComp(
|
|
67
|
+
parentComp,
|
|
68
|
+
parentChain.pop(),
|
|
69
|
+
parentChain
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
40
76
|
|
|
41
77
|
/* step 1: collect all matching compositions */
|
|
42
78
|
var len = app.project.items.length;
|
|
@@ -46,12 +82,16 @@ nexrender.selectCompositionsByName = function(name, callback) {
|
|
|
46
82
|
|
|
47
83
|
if (name !== "*" && item.name !== name) {
|
|
48
84
|
continue;
|
|
49
|
-
} else {
|
|
85
|
+
} else if (nameChain.length === 0) { // if the comp name wasn't hierarchical
|
|
86
|
+
items.push(item);
|
|
87
|
+
} else if (isNestedComp(item, name, nameChain)) { // otherwise only add the comp if it matches the hierarchical position defined in the comp name
|
|
50
88
|
items.push(item);
|
|
89
|
+
} else {
|
|
90
|
+
continue;
|
|
51
91
|
}
|
|
52
92
|
}
|
|
53
93
|
|
|
54
|
-
/* step 2:
|
|
94
|
+
/* step 2: invoke callback for every match */
|
|
55
95
|
var len = items.length;
|
|
56
96
|
for (var i = 0; i < len; i++) {
|
|
57
97
|
callback(items[i]);
|
|
@@ -83,7 +123,7 @@ nexrender.selectLayersByName = function(compositionName, name, callback, types)
|
|
|
83
123
|
}
|
|
84
124
|
}
|
|
85
125
|
|
|
86
|
-
/* step 2:
|
|
126
|
+
/* step 2: invoke callback for every match */
|
|
87
127
|
var len = items.length;
|
|
88
128
|
for (var i = 0; i < len; i++) {
|
|
89
129
|
callback(items[i], name);
|
|
@@ -122,7 +162,7 @@ nexrender.selectLayersByType = function(
|
|
|
122
162
|
}
|
|
123
163
|
}
|
|
124
164
|
|
|
125
|
-
/* step 2:
|
|
165
|
+
/* step 2: invoke callback for every match */
|
|
126
166
|
var len = items.length;
|
|
127
167
|
for (var i = 0; i < len; i++) {
|
|
128
168
|
callback(items[i]);
|
package/src/helpers/autofind.js
CHANGED
|
@@ -12,7 +12,9 @@ const defaultPaths = {
|
|
|
12
12
|
'/Applications/Adobe After Effects CC 2019',
|
|
13
13
|
'/Applications/Adobe After Effects 2020',
|
|
14
14
|
'/Applications/Adobe After Effects 2021',
|
|
15
|
+
'/Applications/Adobe After Effects 2022',
|
|
15
16
|
'/Applications/Adobe After Effects CC 2021',
|
|
17
|
+
'/Applications/Adobe After Effects CC 2022',
|
|
16
18
|
],
|
|
17
19
|
win32: [
|
|
18
20
|
'C:\\Program Files\\Adobe\\After Effects CC',
|
|
@@ -25,6 +27,7 @@ const defaultPaths = {
|
|
|
25
27
|
'C:\\Program Files\\Adobe\\After Effects CC 2020\\Support Files',
|
|
26
28
|
'C:\\Program Files\\Adobe\\After Effects 2020\\Support Files',
|
|
27
29
|
'C:\\Program Files\\Adobe\\After Effects 2021\\Support Files',
|
|
30
|
+
'C:\\Program Files\\Adobe\\After Effects 2022\\Support Files',
|
|
28
31
|
|
|
29
32
|
'C:\\Program Files\\Adobe\\Adobe After Effects CC',
|
|
30
33
|
'C:\\Program Files\\Adobe\\Adobe After Effects CC\\Support Files',
|
|
@@ -36,6 +39,7 @@ const defaultPaths = {
|
|
|
36
39
|
'C:\\Program Files\\Adobe\\Adobe After Effects CC 2020\\Support Files',
|
|
37
40
|
'C:\\Program Files\\Adobe\\Adobe After Effects 2020\\Support Files',
|
|
38
41
|
'C:\\Program Files\\Adobe\\Adobe After Effects 2021\\Support Files',
|
|
42
|
+
'C:\\Program Files\\Adobe\\Adobe After Effects 2022\\Support Files',
|
|
39
43
|
],
|
|
40
44
|
wsl: [
|
|
41
45
|
'/mnt/c/Program Files/Adobe/After Effects CC',
|
|
@@ -48,6 +52,7 @@ const defaultPaths = {
|
|
|
48
52
|
'/mnt/c/Program Files/Adobe/After Effects CC 2020/Support Files',
|
|
49
53
|
'/mnt/c/Program Files/Adobe/After Effects 2020/Support Files',
|
|
50
54
|
'/mnt/c/Program Files/Adobe/After Effects 2021/Support Files',
|
|
55
|
+
'/mnt/c/Program Files/Adobe/After Effects 2022/Support Files',
|
|
51
56
|
|
|
52
57
|
'/mnt/c/Program Files/Adobe/Adobe After Effects CC',
|
|
53
58
|
'/mnt/c/Program Files/Adobe/Adobe After Effects CC/Support Files',
|
|
@@ -59,6 +64,7 @@ const defaultPaths = {
|
|
|
59
64
|
'/mnt/c/Program Files/Adobe/Adobe After Effects CC 2020/Support Files',
|
|
60
65
|
'/mnt/c/Program Files/Adobe/Adobe After Effects 2020/Support Files',
|
|
61
66
|
'/mnt/c/Program Files/Adobe/Adobe After Effects 2021/Support Files',
|
|
67
|
+
'/mnt/c/Program Files/Adobe/Adobe After Effects 2022/Support Files',
|
|
62
68
|
],
|
|
63
69
|
}
|
|
64
70
|
|
package/src/helpers/patch.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const fs = require('fs')
|
|
2
2
|
const path = require('path')
|
|
3
3
|
const mkdirp = require('mkdirp')
|
|
4
|
-
const
|
|
4
|
+
const patchedDefault = require('../assets/commandLineRenderer-default.jsx')
|
|
5
|
+
const patched2022 = require('../assets/commandLineRenderer-2022.jsx')
|
|
5
6
|
|
|
6
7
|
const writeTo = (data, dst) => fs.writeFileSync(dst, data)
|
|
7
8
|
const copyTo = (src, dst) => fs.writeFileSync(dst, fs.readFileSync(src))
|
|
@@ -14,6 +15,13 @@ module.exports = (settings) => {
|
|
|
14
15
|
const targetScript = 'commandLineRenderer.jsx';
|
|
15
16
|
|
|
16
17
|
const afterEffects = path.dirname(settings.binary)
|
|
18
|
+
const afterEffectsYearMatch = afterEffects.match(/(20[0-9]{2})/);
|
|
19
|
+
|
|
20
|
+
let patched = patchedDefault;
|
|
21
|
+
if (afterEffectsYearMatch && afterEffectsYearMatch[0] >= "2022") {
|
|
22
|
+
patched = patched2022;
|
|
23
|
+
}
|
|
24
|
+
|
|
17
25
|
const originalFile = path.join(afterEffects, 'Scripts', 'Startup', targetScript)
|
|
18
26
|
const backupFile = path.join(afterEffects, 'Backup.Scripts', 'Startup', targetScript)
|
|
19
27
|
|
package/src/index.js
CHANGED
package/src/tasks/actions.js
CHANGED
|
@@ -21,10 +21,14 @@ module.exports = actionType => (job, settings) => {
|
|
|
21
21
|
settings.logger.log(`[${job.uid}] applying ${actionType} actions...`);
|
|
22
22
|
|
|
23
23
|
return PromiseSerial((job.actions[actionType] || []).map(action => () => {
|
|
24
|
-
|
|
25
|
-
return
|
|
26
|
-
}
|
|
24
|
+
if(settings.actions[action.module]){
|
|
25
|
+
return settings.actions[action.module](job, settings, action, actionType);
|
|
26
|
+
}else{
|
|
27
|
+
return requireg(action.module)(job, settings, action, actionType);
|
|
28
|
+
}
|
|
27
29
|
})).then(() => {
|
|
28
30
|
return Promise.resolve(job)
|
|
31
|
+
}).catch(err => {
|
|
32
|
+
return Promise.reject(new Error(`Error loading ${actionType} module ${action.module}: ${err}`));
|
|
29
33
|
});
|
|
30
34
|
}
|
package/src/tasks/render.js
CHANGED
|
@@ -53,7 +53,7 @@ module.exports = (job, settings) => {
|
|
|
53
53
|
|
|
54
54
|
option(params, '-r', jobScriptFile);
|
|
55
55
|
|
|
56
|
-
if (!settings.skipRender && settings.multiFrames) params.push('-
|
|
56
|
+
if (!settings.skipRender && settings.multiFrames) params.push('-mfr', 'ON', settings.multiFramesCPU);
|
|
57
57
|
if (settings.reuse) params.push('-reuse');
|
|
58
58
|
if (job.template.continueOnMissing) params.push('-continueOnMissingFootage')
|
|
59
59
|
|
|
@@ -186,7 +186,17 @@ module.exports = (job, settings) => {
|
|
|
186
186
|
return resolve(job)
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
// When a render has finished, look for a .mov file too, on AE 2022
|
|
190
|
+
// the outputfile appears to be forced as .mov.
|
|
191
|
+
// We need to maintain this here while we have 2022 and 2020
|
|
192
|
+
// workers simultaneously
|
|
193
|
+
const movOutputFile = outputFile.replace(/\.avi$/g, '.mov')
|
|
194
|
+
const existsMovOutputFile = fs.existsSync(movOutputFile)
|
|
195
|
+
if (existsMovOutputFile) {
|
|
196
|
+
job.output = movOutputFile
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (!fs.existsSync(job.output)) {
|
|
190
200
|
if (fs.existsSync(logPath)) {
|
|
191
201
|
settings.logger.log(`[${job.uid}] dumping aerender log:`)
|
|
192
202
|
settings.logger.log(fs.readFileSync(logPath, 'utf8'))
|
|
@@ -195,7 +205,7 @@ module.exports = (job, settings) => {
|
|
|
195
205
|
return reject(new Error(`Couldn't find a result file: ${outputFile}`))
|
|
196
206
|
}
|
|
197
207
|
|
|
198
|
-
const stats = fs.statSync(
|
|
208
|
+
const stats = fs.statSync(job.output)
|
|
199
209
|
|
|
200
210
|
/* file smaller than 1000 bytes */
|
|
201
211
|
if (stats.size < 1000) {
|