• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How I can change part of my expression using JavaScript ?

Explorer ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

When I extracting Duik controllers to the other composition. it creates an expressions on controllers into composition with all my rigged character, and thats some issues when After Effect can lose name of composition in expression when I rename my comp, thats sample:

//Duik.link
var link = comp("Comp 1").layer("B_HEAD").transform.position;
var timeLayer = comp("Comp 1").layer("Boss_1");
var timeOffset = timeLayer.startTime;
link.valueAtTime(time + timeOffset);

If I want to rename my comp, AE show an error thats he can`t find composition and expression is doesnt work

I want to write a Script that can help me change this part of my expression and place the correct composition name 

TOPICS
Expressions , How to , Scripting

Views

198

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 03, 2022 Aug 03, 2022

Say you chage the name of "Comp 1" to "New Comp Name". Your script might be as simple as this:

 

 

app.project.autoFixExpressions("Comp 1", "New Comp Name");

 

 

Votes

Translate

Translate
Community Expert ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Say you chage the name of "Comp 1" to "New Comp Name". Your script might be as simple as this:

 

 

app.project.autoFixExpressions("Comp 1", "New Comp Name");

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

It works! Thank you! 
But can I using this method automatically found where Script should changing text? I found this line

app.project.activeItem.propertySpec.expression

Is this what I want? Cuz I cant understand how this line works 😞 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

I'm not sure what you're asking, but I don't think you'd use .propertySpec, which is just shorthand notation for the the actual path to a property, like .property("Position"), without specifying a layer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

LATEST

Fine, I understand, thank your very much for helping!!! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines