nexrender icon indicating copy to clipboard operation
nexrender copied to clipboard

nexrender-server / worker don't use the custom script asset

Open miku2525 opened this issue 3 years ago • 3 comments

Describe your question: I'm using a custom jsx to change filepaths of my AE-project footage, because otherwise the rendering won't include it. The AE-project is saved on my computer and the rendering happens on a different one. This thread https://github.com/inlife/nexrender/issues/238 helped me to figure out the problem with the absolute filepaths for footage.

Using the nexrender-cli-win64 the custom jsx works fine, it gets copied into the temporary working folder and the log file show my outputs of the jsx. When I use the nexrender-server and nexrender-worker however, the script asset gets ignored.

The assets in my job looks like this. The renderscript.jsx is what i need:

"assets": [
        {
	  "src": "file:///C:/startskripte/renderscript.jsx",
	  "type": "script",
	  "parameters" : [
		  {
			  "key" : "projectPath",
			  "value": "C:/something"
		  }
	  ]
	},
	{
            "type": "data",
            "layerName": "MONAT",
            "property": "Source Text",
            "value": "MONAT"
        }        
    ]

The renderscript.jsx looks like this and is pretty much the same as in the thread i mentioned above:

function isSourceLayered(av_item) {
    // check if there is a "/"
    if (av_item.name.indexOf("/") != -1) {
        return true;
    }

    return false;
}

function canImportAsComp(file) {
    var io = new ImportOptions(file);

    return io.canImportAs(ImportAsType.COMP);
}

function getPathFromItem(item) {
    if (item.mainSource && item.mainSource.file) {
        return item.mainSource.file.path + "/" + item.mainSource.file.name;
    } else {
        return false;
    }
}

function getReplacePath(path) {
    var matches = path.match(regex);

    if (matches && matches.length) {
        var splitPath = path.split(regex);
        if (splitPath && splitPath.length > 1) {
			var theProjectPath = NX && NX.get("projectPath") || "";
            var newPath = (theProjectPath + matches[matches.length - 1] + splitPath[1]).replace(/\//g, '\\');
			gAECommandLineRenderer.log_file.writeln("newPath: " + newPath);
            return newPath;
        } else {
            return false;
        }
    } else {
        return false;
    }
}

var regex = /\/\(\w+\)\//;

gAECommandLineRenderer.log_file.writeln("!!!!! ALARM renderscript.jsx !!!!!"); 
gAECommandLineRenderer.log_file.writeln("NX.projectPath: " + NX.get("projectPath"));

for (var i = 1; i <= app.project.items.length; i++) {
    var item = app.project.items[i];
    gAECommandLineRenderer.log_file.writeln("ITEM: " + item.name + "[" + item.toString() + "]");

    var path = getPathFromItem(item);
    if (path != false) {
        var replacePath = getReplacePath(path);

        if (replacePath != false) {
            var file = new File(replacePath);

            if (!file.exists) {
                gAECommandLineRenderer.log_file.writeln("ERROR: could not make file from " + replacePath);    
            } else {
                if (!isSourceLayered(item) || (isSourceLayered(item) && !canImportAsComp(file))) {
                    gAECommandLineRenderer.log_file.writeln("INFO: Pointing " + path + " to " + replacePath);
                    item.replace(file); // This works fine
                } else if (isSourceLayered(item) && canImportAsComp(file)) {
                    gAECommandLineRenderer.log_file.writeln("INFO: Pointing layered " + path + " to " + replacePath);
                    item.replace(file); // This shows all contents of the PSD instead of the layer
                }
            }
        } else {
            gAECommandLineRenderer.log_file.writeln("NO REPLACE: " + path);
        }
    }

    gAECommandLineRenderer.log_file.writeln("END ITEM \n");
}

As I said, when I use the nexrender-cli-win64.exe via cmd everything works fine. When I use the server and the job gets created and written in the database.js, the script asset is not in there. The aerender log file in the temporary working path starts like this:

Skipping DX support: Microsoft Basic Render Driver
[6396][Warn] [general] We are going to deprecate hostInfo access soon. Please use HostInfoController instead.
[2022-06-29 09:54:07] [info] asio async_connect error: asio.system:10061 (No connection could be made because the target machine actively refused it.)
[2022-06-29 09:54:07] [info] Error getting remote endpoint: asio.system:10057 (A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.)
[2022-06-29 09:54:07] [error] handle_connect error: No connection could be made because the target machine actively refused it.
aerender version 22.4x56
Running Script: C:\Users\ADMINI~1\AppData\Local\Temp\2\nexrender\_eFPe8LOIVY-lgl8S4NPZ\nexrender-_eFPe8LOIVY-lgl8S4NPZ-script.jsx
PROGRESS: Adding specified comp to Render Queue
PROGRESS:  29.06.2022 09:54:09: Starting composition
...

The logfile of the nexrender-cli-win64.exe that works the rendercript.jsx output right before the first "PROGRESS:" and the rest looks the same. The nexrender-...-script.jsx that gets created in the working folder includes the renderscript.jsx under custom jsx while it doesn't with the server/worker

Does anyone have an idea what I do wrong or does the server&worker don't support the custom script assets at all? Thanks for the help in advance

miku2525 avatar Jun 29 '22 09:06 miku2525

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 31 '22 02:08 stale[bot]

There should be no problem with the script in any environment.

inlife avatar Aug 31 '22 06:08 inlife

If it does not work for you, I would suggest debugging it. To do so, let nexrender create a project in a temp folder, but run it with the cleanup flag set to false so that it won't delete the project afterward. Then open that project manually in AE and use the Adobe ExtendScript toolkit to see and debug the scripting side.

inlife avatar Aug 31 '22 06:08 inlife

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 01 '22 01:11 stale[bot]