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

Crash on adding camera to composition

Community Beginner ,
Jul 08, 2021 Jul 08, 2021

Copy link to clipboard

Copied

After adding a camera to a comp via script, AFX crashes on opening the comp.

 

After running this, open the comp and AFX crashes.

var myItemCollection = app.project.items;
var myComp = app.project.items.addComp('Composition Name', 1920.0, 1080.0, 1, 5.6, 25);
var newCamera = myComp.layers.addCamera('020_030_', [0, 5.6]);

 

When manually creating a comp and then adding camera via script, it works.

var newCamera = app.project.items.activeItem.layers.addCamera('020_030_', [0, 5.6]);

 

AFX Version is 18.2.0

 

Am I doing something wrong or is this a bug?

TOPICS
Crash , Error or problem , Scripting

Views

323

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
LEGEND ,
Jul 08, 2021 Jul 08, 2021

Copy link to clipboard

Copied

You pretty much answered your own question: Order of execution matters and your code does neither branch nor does it have any checks for whether collections exist and are valid and if stuff already has been created. You will of course need a bit more work rather than just blindly firing three lines of code. Add an if...else... or try...catch... or refer to the scripting guide on how to check and manipulate the various internal collections to create safe code.

 

Mylenium

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 Beginner ,
Jul 08, 2021 Jul 08, 2021

Copy link to clipboard

Copied

nor does it have any checks for whether collections exist 

quote

You pretty much answered your own question: Order of execution matters and your code does neither branch nor does it have any checks for whether collections exist and are valid and if stuff already has been created. You will of course need a bit more work rather than just blindly firing three lines of code. Add an if...else... or try...catch... or refer to the scripting guide on how to check and manipulate the various internal collections to create safe code.

 

Mylenium


By @Mylenium


These lines are of course a simplified excerpt of a larger script to illustrate the problem.

The Problem is not with the script, i am merely trying to illustrate the Problem.

 

Run this line:

var newCamera = myComp.layers.addCamera('020_030_', [0, 5.6]);

on any comp you want, then open the comp. AE will crash in the current version.

It's as simple as that.

 

If the script would error, i would understand, but that's not the case. This line makes the comp unopenable.

 

I just checked on AE 17.7.0 and the Problem does not exist.

 

This makes a big part of your production pipeline simply unusable.

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 ,
Jul 08, 2021 Jul 08, 2021

Copy link to clipboard

Copied

I just tried your code on 18.2.1 (Windows) and it works fine for me (no crash).

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 Beginner ,
Jul 08, 2021 Jul 08, 2021

Copy link to clipboard

Copied

Thank you for your reply.

 

So I did some more testing on more machines. All machines run windows, the process is always the same. Open a new AE project and run a script file containing these lines:

 

 

var myComp = app.project.items.addComp('Composition Name', 1920.0, 1080.0, 1, 5.6, 25);
var newCamera = myComp.layers.addCamera('020_030_', [0, 5.6]);

 

 

Then open the new comp by double clicking it.

 

The results are the following:

 

Machine 1

18.2.1 (8) - no crash

17.7.0 (45) - no crash

Machine 2

18.2.0 (37) - no crash

Machine 3

18.2.0 (37) - crash

after update to 18.2.1 (8) - crash

Machine 4

18.0.1 (1) - no crash

Machine 5

18.2.1 (8) - crash

17.7.0 (45) - no crash

Machine 6

18.2.1 (8) - no crash

17.7.0 (45) - no crash

Machine 7

18.0.1 (1) - no crash

Machine 8

18.0.1 (1) - no crash

 

I have the feeling the problem lies somewhere else. Any ideas?

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 Beginner ,
Jul 09, 2021 Jul 09, 2021

Copy link to clipboard

Copied

Maybe it is also worth mentioning that the current script and setup used to work for years.

The scripts didn't change, also not AE plugins.

 

This Problem just came up, i guess with an AE update.

Maybe this is related to something getting messed up during an update?

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 Beginner ,
Jul 09, 2021 Jul 09, 2021

Copy link to clipboard

Copied

Quick follow up, in case someone else is running into the same.

 

Resetting the preferences with CTRL SHIFT ALT when starting AE fixed the problem.

This seems to be AE-update related then...

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 Beginner ,
Jul 23, 2021 Jul 23, 2021

Copy link to clipboard

Copied

LATEST

posting here as i had similar problem and solved. my camera wasnt created via script but ae was instantly crashing when i opened the comp with the cam in it (the only camera in the whole project). Thanks to your advice on resetting the preffs i investigated and found out that my crashes were because of the "Display Markings in Layer Bars" variable for the cache markings which i had set to 01 earlier. Now i set it back to 00 and no more crashes. Its in the "Adobe After Effects 18.2 Prefs.txt" file

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