Skip to content

Commit

Permalink
Rename option compositionName to composition
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryLafranc committed Feb 8, 2019
1 parent 632b683 commit c4287ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions packages/nexrender-core/src/tasks/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)});` : ''}
Expand Down

0 comments on commit c4287ac

Please sign in to comment.