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

Identify a color-solid on layer level (ExtendScript)

Participant ,
Aug 07, 2020 Aug 07, 2020

Copy link to clipboard

Copied

Is there any way to differentiate a solid color layer from any other footage layer (aka AVLayer object) with extend script? This only gives back "Footage" als type:

 

alert(app.project.activeItem.layer(4).source.typeName);

 

I know that there is the SolidSource object, where I could test against e.g. if this is not undefined:

app.project.item(7).mainSource.color

but that only works on project level - I need to distinguish the solids on a layer level.

TOPICS
Error or problem , How to , Scripting , SDK

Views

809

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

Enthusiast , Aug 07, 2020 Aug 07, 2020

This might not cover every layer type but it should give you an idea:

var theLayer = app.project.activeItem.layer(1);
if (theLayer instanceof AVLayer) {
	if (theLayer.source instanceof CompItem) alert("it's a comp");
	else if (theLayer.source instanceof FootageItem) {
		if (theLayer.nullLayer) alert("it's a null");
		else if (theLayer.source.mainSource instanceof SolidSource) alert("it's a solid");
		else alert("it's footage");
	}
} else alert("not AV");
 

Votes

Translate

Translate
Enthusiast ,
Aug 07, 2020 Aug 07, 2020

Copy link to clipboard

Copied

This might not cover every layer type but it should give you an idea:

var theLayer = app.project.activeItem.layer(1);
if (theLayer instanceof AVLayer) {
	if (theLayer.source instanceof CompItem) alert("it's a comp");
	else if (theLayer.source instanceof FootageItem) {
		if (theLayer.nullLayer) alert("it's a null");
		else if (theLayer.source.mainSource instanceof SolidSource) alert("it's a solid");
		else alert("it's footage");
	}
} else alert("not AV");
 

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
Participant ,
Aug 07, 2020 Aug 07, 2020

Copy link to clipboard

Copied

LATEST

Great, works for me, thx!

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