Highlighted

Identify a color-solid on layer level (ExtendScript)

Explorer ,
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.

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");
 
TOPICS
Error or problem, How to, Scripting, SDK

Views

38

Likes

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

Identify a color-solid on layer level (ExtendScript)

Explorer ,
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.

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");
 
TOPICS
Error or problem, How to, Scripting, SDK

Views

39

Likes

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
Aug 07, 2020 0
Engaged ,
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");
 

Likes

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
Reply
Loading...
Aug 07, 2020 1
Explorer ,
Aug 07, 2020

Copy link to clipboard

Copied

Great, works for me, thx!

Likes

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
Reply
Loading...
Aug 07, 2020 0