diff --git a/README.md b/README.md index 933a303e..4fd37ca6 100644 --- a/README.md +++ b/README.md @@ -376,7 +376,7 @@ by specifying `src`, and one of the `layerName` or `layerIndex` options. * `type`: string, for footage items, is one of (`image`, `audio`, `video`) * `layerName`: string, target layer name in the After Effects project * `layerIndex`: integer, can be used instead of `layerName` to select a layer by providing an index, starting from 1 (default behavior of AE jsx scripting env) -* `compositionName`: string, composition where the layer is, useful for searching layer in pre-compositions. If none is provided, it uses the default composition set in the template. +* `composition`: string, composition where the layer is, useful for searching layer in pre-compositions. If none is provided, it uses the default composition set in the template. Specified asset from `src` field will be downloaded/copied to the working directory, and just before rendering will happen, a fotage item with specified `layerName` or `layerIndex` in the original project will be replaced with the freshly downloaded asset. @@ -415,7 +415,7 @@ To do that a special asset of type `data` can be used. * `property`: string, indicates which layer property you want to change * `value`: mixed, optional, indicates which value you want to be set to a specified property * `expression`: string, optional, allows you to specify an expression that can be executed every frame to calculate the value -* `compositionName`: string, composition where the layer is, useful for searching layer in pre-compositions. If none is provided, it uses the default composition set in the template. +* `composition`: string, composition where the layer is, useful for searching layer in pre-compositions. If none is provided, it uses the default composition set in the template. Since both `value` and `expression` are optional you can provide them in any combination, depending on the effect you want to achieve. Providing value will set the exact value for the property right after execution, and providing an expression will make sure it will be evaluated every frame. diff --git a/packages/nexrender-core/src/tasks/script.js b/packages/nexrender-core/src/tasks/script.js index 5191286d..f3f900a7 100644 --- a/packages/nexrender-core/src/tasks/script.js +++ b/packages/nexrender-core/src/tasks/script.js @@ -2,20 +2,20 @@ const fs = require('fs') const path = require('path') const script = require('../assets/nexrender.jsx') -const wrapLayer = (layerName, layerIndex, compositionName) => (layerName - ? `nexrender.layerName('${layerName}', ${compositionName !== undefined ? `'${compositionName}'` : `null`})` - : `nexrender.layerIndex('${layerIndex}', ${compositionName !== undefined ? `'${compositionName}'` : `null`})` +const wrapLayer = (layerName, layerIndex, composition) => (layerName + ? `nexrender.layerName('${layerName}', ${composition !== undefined ? `'${composition}'` : `null`})` + : `nexrender.layerIndex('${layerIndex}', ${composition !== undefined ? `'${composition}'` : `null`})` ) -const wrapFootage = ({ layerName, layerIndex, dest, compositionName }) => (`(function() { +const wrapFootage = ({ layerName, layerIndex, dest, composition }) => (`(function() { nexrender.replaceFootage( - ${wrapLayer(layerName, layerIndex, compositionName)}, + ${wrapLayer(layerName, layerIndex, composition)}, '${dest.replace(/\\/g, "\\\\")}' ); })();\n`) -const wrapData = ({ layerName, layerIndex, property, value, expression, compositionName }) => (`(function() { - var layer = ${wrapLayer(layerName, layerIndex, compositionName)}; if (!layer) return false; +const wrapData = ({ layerName, layerIndex, property, value, expression, composition }) => (`(function() { + var layer = ${wrapLayer(layerName, layerIndex, composition)}; if (!layer) return false; var property = layer.property('${property}'); if (!property) return false; ${value !== undefined ? `property.setValue(${typeof value == 'string' ? `'${value}'` : JSON.stringify(value)});` : ''}