Nexrender: Manipulating Javascript attributes

Created on 15 Jul 2019  路  20Comments  路  Source: inlife/nexrender

This is less of a request and more of a feature I am considering to contribute myself. But before doing so, I would like to discuss if - maybe - there is good reason that nexrender does not support this, or if it would be a good extension. Or maybe if I am overlooking something and nexrender can already do this.

Is your feature request related to a problem? Please describe.
As you know, nexrender nicely allows us to change values of AE properties. However, objects within AE also have Javascript attributes which cannot be manipulated by nexrender, at least as far as I see.
For example, such attributes concern the timeline. StartTime, InPoint, OutPoint are all examples of such attributes.

Describe the solution you'd like
I would like to add the feature that you can optionally exchange the job field "Property" by "JS-Attribute". If this job field is given as "JS-Attribute", nexrender would change the Javascript property directly instead of looking up the AE property and change the value of that.

Describe alternatives you've considered
Javascript attributes can be manipulated by adding scripts and executing those by nexrender. This is still a great feature for more complex operations. The appeal of nexrender in my opinion, however, is that also the Video people can use the job descriptions, while asking them to write full scripts is too much in most cases. So, maximum power to the job descriptions seems a good stratagem.

Additional context
So what do you think about this feature?

feature

All 20 comments

Well, I guess the main reason it is not implemented yet, is that I didn't even know there are attributes like those you've mentioned. Do you have some more information that I can read about those?

Regarding your proposed solution, I don't see why it couldn't be added. Since we are already using property for AE object properties, we can, as you said to use something like js-attribute, or even just attribute for those attributes.

So overall, I think that would be a valuable addition to the nexrender. 馃憤

Well, I guess the main reason it is not implemented yet, is that I didn't even know there are attributes like those you've mentioned. Do you have some more information that I can read about those?

To give a fair warning, I am also not a big expert in AE scripting, but this is what I found out about this topic.
For example, After Effects Layers do seem to have this list of "Layer Properties" which can be manipulated by nexrender:

http://expressions.aenhancers.com/layer-properties.html

But if you click around in the same documentation like "Layer General" here:

http://expressions.aenhancers.com/layer-general.html

There, you can see those javascript attributes of layers which cannot be manipulated by nexrender, among them the Layer.startTime and such I mentioned above.
And I guess that other kinds of objects (compositions, effects, etc.) will also have such attributes.

Have you tried accessing those from the current property implementation? I feel like they should be supported even now.

Additionally, here are implementations used in the nexrender:

From the code you posted, I think the part that is accessing the properties is

iterator = iterator.property(parts[i]);

to find the right property and

${renderIf(value, "iterator.setValue($value);")}

to set the value (or analogue for expressions).
Now for attributes neither the first nor the second kind of line works, as, e.g., "startTime" does not seem to be among the properties such that layer.property("startTime") yields undefined and also in the end layer.startTime.setValue(42) would not work (if it came to that).

At least as far as we have looked into the issue.

Oh, I see the difference now. Yes, in that case, it would make sense to add something specifically for attributes, I agree.

I have now implemented a first version of this using "attribute" as the job keyword as you proposed. However, I got second thoughts by now about how this should integrate most seamlessly with the other nexrender features.
One point is that it does not mix well with the keypath feature for properties. I can well imagine that a task will need to go down some properties and then change an attribute, e.g., "Prop1.Prop2.startTime". And maybe (I do not know AE well enough) also in a mix like "Prop1.Attribute1.Prop2".
The other point is that the user will not care at all if she is changing a property or an attribute. Most users won't know the difference, just like you and me. (I found out about that only after checking why I can't chane startTime with nexrender.)

So, to sum up, I would rather change the implementation of wrapData in such a way that for each part of the given keypath the system knows to deal with both properties and attributes.

What do you think?

If that is possible, that would be indeed a better way. I feel like me personally, and I assume many others would confuse them anyway. So yeah, I think you are right.

@inlife, could you give me a short hint how to build a new nexrender-cli.exe for Windows from the sources?

sure

  1. get into the root folder of the repo
  2. do npm start (optional, unless you haven't done it yet)
  3. and finally a sequence of commands (to only build nexrender-cli)

    • npm run pkg-prelink

    • npm run pkg-reduce

    • npm run pkg-cli

    • npm run pkg-rename

Or, alternatively, a bit simpler command to build everything at once:

  • npm run pkg

(I personally always use the later one)

Ah, great! I thought I had to build this on a ghastly Windows machine to get the exe. And I got tons of errors there. But on my Mac this ran just fine now, thank you!

Oh, actually haven't tested this set of commands on windows
And yea, most likely they will fail, cuz of the env vars used there

Probably going to add cross-env package to solve that issue

Sorry, this is not meant to turn into a support session, but the created binaries do not seem to work.
Here is what I did:

git clone https://github.com/inlife/nexrender
cd nexrender
npm install
npm start
npm run pkg

After that I get binaries alright. But when I start using them I get an error

$ nexrender/bin/nexrender-cli-macos -f newjob.json 
> starting nexrender-cli
using automatically determined directory of After Effects installation:
 - /Applications/Adobe After Effects CC 2018/aerender
adding default render-only-node license for After Effects at:
 - /Users/doc/Documents/Adobe/ae_render_only_node.txt
checking After Effects command line renderer patch...
command line patch already is in place
[_ta06DshRQYxGOXUJf2xm] setting up job...
> job rendering failed
TypeError: Cannot read property 'length' of undefined
    at module.exports (/snapshot/nexrender/packages/nexrender-cli/node_modules/@nexrender/core/src/tasks/setup.js:0:0)
    at module.exports (/snapshot/nexrender/packages/nexrender-cli/node_modules/@nexrender/core/src/helpers/state.js:0:0)
    at Promise.resolve.then.job (/snapshot/nexrender/packages/nexrender-cli/node_modules/@nexrender/core/src/index.js:0:0)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (pkg/prelude/bootstrap.js:1315:13)
    at startup (internal/bootstrap/node.js:274:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:608:3)

This error comes on windows with the .exeand with the mac client as well.
The same job file runs with your binary release alright.
What am I doing wrong?

There is only a single place that has a length check in setup.js
https://github.com/inlife/nexrender/blob/master/packages/nexrender-core/src/tasks/setup.js#L37

And if I remember correctly using nexrender-types it is impossible to get a job without actions object. Could you try modifying your setup.js to print the contents of job object?

Ok, thanks that helped! We really removed all the post render actions because of some other problem earlier. So even if the job file works with an older version and does not with the newest; this error does not matter at all. I used another file with actions again and it works now. Thanks!

Its done! And I must say, it adds a lot of power to nexrender. 馃槃

You can check it out at https://github.com/brassel/nexrender and I will make a pull request.

@brassel @inlife This sounds like a pretty great change, I'm not sure I completely understand it though (forgive my ignorance).

An update to the docs explaining this would be very much appreciated.

@JamesBotterill, I can have a look at the documentation where changes are appropriate. However, the change is more by lifting a bigger restriction of nexrender. But it was not very obvious that this restriction was there. Both @inlife and me thought that nexrender would already be able to do this kind of thing before we were looking into the details. Therefore, I doubt that it is really visible in the documentation. But I will have a look.

@JamesBotterill, for the next pull request I have extended the section about property paths to at least mention javascript attributes as well. And I have included an example in the data section showing the manipulation of fonts from the discussion about issue #201. That example was not possible to do with nexrender before.

This is done now I would say.

life-saver-feature!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielgwilson picture danielgwilson  路  3Comments

joshea0 picture joshea0  路  5Comments

Dezzymei picture Dezzymei  路  3Comments

whatneuron picture whatneuron  路  3Comments

bluematter picture bluematter  路  5Comments