乐趣区

关于后端:After-Effects-图层属性及属性组结构详解

依据构造类型的属性分类

在 After Effects 的脚本开发中,图层的属性可被辨别为三种类型:PROPERTY、INDEXED_GROUP 和 NAMED_GROUP。通过应用 app.project.item().layer().propertySpec.propertyType 能够对属性的类型进行判断。在 AEGP 插件的开发中这些类型对应为 AEGP_StreamGroupingType_LEAF、AEGP_StreamGroupingType_INDEXED_GROUP 和 AEGP_StreamGroupingType_NAMED_GROUP,通过调用 AEGP_DynamicStreamSuite 的 AEGP_GetStreamGroupingType 办法进行获取。
PROPERTY(LEAF)类型的属性为属性组中最底层的属性,即具备对应的值可供用户操作调整的属性;INDEXED_GROUP 类型的属性组中子级的名称可编辑,换言之 INDEXED_GROUP 类型的属性组中的子级是不固定的,可进行增删,如成果和蒙版都是这种类型;NAMED_GROUP 类型的属性组具备固定的子级属性,且子级属性的名称是不可更改的。
在脚本中间接输入 propertyType 时会输入一个数字,这是 ExtendScript 中定义的 PropertyType 枚举。

例如,某个图层的“变换”属性组的 propertyType 输入值如图所示,表明“变换”是一个 NAMED_GROUP 属性组。

某个文字图层的“文本”属性组下的“动画制作工具”属性组是一个 INDEXED_GROUP 属性组。

属性的可见性

在 AEGP 插件的开发中能够通过调用 AEGP_DynamicStreamSuite 的 AEGP_GetDynamicStreamFlags 办法获取属性的标记,其中具备几个值得注意的内容。AEGP_DynStreamFlag_ELIDED 标记着一个属性组始终不会将本身显示在时间轴面板中,但它的子级属性会间接显示在该属性组的父级属性组中。一个罕用的例子是文本图层的“动画制作工具”:当给文本图层增加一个动画制作工具后,“文本”属性组中“动画制作工具 1”会与“源文本”、“门路选项”和“更多选项”并列显示,但实际上“动画制作工具 1”是存在于“动画制作工具”属性组中的,但因为“动画制作工具”具备 ELIDED 标记,导致“动画制作工具”不会显示在时间轴中。编写脚本时拜访此类属性组中的属性须要留神。另外,在脚本中应用 app.project.item().layer().porpertySpec.elided 也能获取到某属性组是否具备 ELIDED 标记。
特定类型图层所具备的属性组是固定的,未显示在时间轴中的属性不代表它不存在,通常未被批改的属性及其属性组会被暗藏。在脚本中能够通过 app.project.item().layer().porpertySpec.isModified 判断某属性在创立后是否被批改。

图层属性的构造

在脚本中图层能够当作属性组进行解决,如下图所示:

在 AEGP 插件开发中通常应用 AEGP_DynamicStreamSuite 的 AEGP_GetNewStreamRefForLayer办法检索与图层对应的 AEGP_StreamRefH,用于启动图层属性流的递归。亦是将图层作为属性组进行解决。
因图层是 NAMED_GROUP 类型的属性组,故其子级属性组是固定的。本文整顿了 AVLayer、TextLayer、ShapeLayer、CameraLayer 和 LightLayer 五类图层的属性组构造,其中包含属性的中文名称与其 MatchName 的对照。因树形图尺寸过大,以下提供 FreeMind 文件的下载链接:https://wwe.lanzoui.com/ilSn0v23p3e
若您对遍历某属性组中的属性有趣味,也能够参考以下脚本代码:

var str = '';
var selProp = app.project.activeItem.selectedLayers[0].property("Transform");// 将该变量批改为您须要遍历的属性组
var numProps = selProp.numProperties;
for(var i = 0; i < numProps; i ++){str += selProp.property(i + 1).name + '-' + selProp.property(i + 1).matchName + '\n';// 输入名称和 MatchName
}
alert(str);

脚本中拜访属性的简介写法

在 ExtendScript 脚本中拜访属性具备简洁写法,例如 .property(“Transform”) 也能够应用 . transform。以下提供局部对照以供查找和参考:

属性 简洁写法
ADBE Transform Group: ‘transform’,
ADBE Anchor Point: .pointOfInterest’ 或 ‘.anchorPoint’,
ADBE Position: ‘.position’,
ADBE Scale: ‘.scale’,
ADBE Orientation: ‘.orientation’,
ADBE Rotate X: ‘.xRotation’,
ADBE Rotate Y: ‘.yRotation’,
ADBE Rotate Z: .zRotation’ 或 ‘.rotation’,
ADBE Opacity: ‘.opacity’,
ADBE Material Options Group: ‘materialOption’,
ADBE Casts Shadows: ‘.castsShadows’,
ADBE Light Transmission: ‘.lightTransmission’,
ADBE Accepts Shadows: ‘.acceptsShadows’,
ADBE Accepts Lights: ‘.acceptsLights’,
ADBE Ambient Coefficient: ‘.ambient’,
ADBE Diffuse Coefficient: ‘.diffuse’,
ADBE Specular Coefficient: ‘.specular’,
ADBE Shininess Coefficient: ‘.shininess’,
ADBE Metal Coefficient: ‘.metal’,
ADBE Light Options Group: ‘lightOption’,
ADBE Light Intensity: ‘.intensity’,
ADBE Light Color: ‘.color’,
ADBE Light Cone Angle: ‘.coneAngle’,
ADBE Light Cone Feather 2: ‘.coneFeather’,
ADBE Light Shadow Darkness: ‘.shadowDarkness’,
ADBE Light Shadow Diffusion: ‘.shadowDiffusion’,
ADBE Camera Options Group: ‘cameraOption’,
ADBE Camera Zoom: ‘.zoom’,
ADBE Camera Depth of Field: ‘.depthOfField’,
ADBE Camera Focus Distance: ‘.focusDistance’,
ADBE Camera Aperture: ‘.aperture’,
ADBE Camera Blur Level: ‘.blurLevel’,
ADBE Text Properties: ‘text’,
ADBE Text Document: ‘.sourceText’,
ADBE Text Path Options: ‘.pathOption’,
ADBE Text Path: ‘.path’,
ADBE Text Reverse Path: ‘.reversePath’,
ADBE Text Perpendicular To Path: ‘.perpendicularToPath’,
ADBE Text Force Align Path: ‘.forceAlignment’,
ADBE Text First Margin: ‘.firstMargin’,
ADBE Text Last Margin: ‘.lastMargin’,
ADBE Text More Options: ‘.moreOption’,
ADBE Text Anchor Point Option: ‘.anchorPointGrouping’,
ADBE Text Anchor Point Align: ‘.groupingAlignment’,
ADBE Text Render Order: ‘.fillANdStroke’,
ADBE Text Character Blend Mode: ‘.interCharacterBlending’,
ADBE Text Animators: ‘.animator’,
ADBE Text Selectors: ‘.selector’,
ADBE Text Percent Start: ‘.start’,
ADBE Text Percent End: ‘.end’,
ADBE Text Percent Offset: ‘.offset’,
ADBE Text Range Advanced: ‘.advanced’,
ADBE Text Range Units: ‘.units’,
ADBE Text Range Type2: ‘.basedOn’,
ADBE Text Selector Mode: ‘.mode’,
ADBE Text Range Shape: ‘.shape’,
ADBE Text Selector Smoothness: ‘.smoothness’,
ADBE Text Levels Max Ease: ‘.easeHigh’,
ADBE Text Levels Min Ease: ‘.easeLow’,
ADBE Text Randomize Order: ‘.randomizeOrder’,
ADBE Text Random Seed: ‘.randomSeed’,
ADBE Text Selector Mode: ‘.mode’,
ADBE Text Wiggly Max Amount: ‘.maxAmount’,
ADBE Text Wiggly Min Amount: ‘.minAmount’,
ADBE Text Range Type2: ‘.basedOn’,
ADBE Text Temporal Freq: ‘.wigglesSecond’,
ADBE Text Character Correlation: ‘.correlation’,
ADBE Text Temporal Phase: ‘.temporalPhase’,
ADBE Text Spatial Phase: ‘.spatialPhase’,
ADBE Text Wiggly Lock Dim: ‘.lockDimensions’,
ADBE Text Wiggly Random Seed: ‘.randomSeed’,
ADBE Text Range Type2: ‘.basedOn’,
ADBE Text Expressible Amount: ‘.amount’,
ADBE Text Animator Properties: ‘.property’,
ADBE Text Anchor Point 3D: ‘.anchorPoint’,
ADBE Text Position 3D: ‘.position’,
ADBE Text Scale 3D: ‘.scale’,
ADBE Text Skew: ‘.skew’,
ADBE Text Skew Axis: ‘.skewAxis’,
ADBE Text Rotation X: ‘.xRotation’,
ADBE Text Rotation Y: ‘.yRotation’,
ADBE Text Rotation: ‘.zRotation’,
ADBE Text Opacity: ‘.opacity’,
ADBE Text Fill Opacity: ‘.fillOpacity’,
ADBE Text Fill Color: ‘.fillColor’,
ADBE Text Fill Hue: ‘.fillHue’,
ADBE Text Fill Saturation: ‘.fillSaturation’,
ADBE Text Fill Brightness: ‘.fillBrightness’,
ADBE Text Stroke Opacity: ‘.strokeOpacity’,
ADBE Text Stroke Color: ‘.strokeColor’,
ADBE Text Stroke Hue: ‘.strokeHue’,
ADBE Text Stroke Saturation: ‘.strokeSaturation’,
ADBE Text Stroke Brightness: ‘.strokeBrightness’,
ADBE Text Stroke Width: ‘.strokeWidth’,
ADBE Text Line Anchor: ‘.lineAnchor’,
ADBE Text Line Spacing: ‘.lineSpacing’,
ADBE Text Track Type: ‘.trackingType’,
ADBE Text Tracking Amount: ‘.trackingAmount’,
ADBE Text Character Change Type: ‘.characterAlignment’,
ADBE Text Character Range: ‘.characterRange’,
ADBE Text Character Replace: ‘.characterValue’,
ADBE Text Character Offset: ‘.characterOffset’,
ADBE Text Blur: ‘.blur’,
ADBE Mask Parade: ‘mask’,
ADBE Mask Shape: ‘.maskPath’,
ADBE Mask Feather: ‘.maskFeather’,
ADBE Mask Opacity: ‘.maskOpacity’,
ADBE Mask Offset: ‘.maskExpansion’,
ADBE Effect Parade: ‘effect’,
ADBE Paint Group: ‘.stroke’,
ADBE Paint Shape: ‘.path’,
ADBE Paint Properties: ‘.strokeOption’,
ADBE Paint Begin: ‘.start’,
ADBE Paint End: ‘.end’,
ADBE Paint Color: ‘.color’,
ADBE Paint Diameter: ‘.diameter’,
ADBE Paint Angle: ‘.angle’,
ADBE Paint Hardness: ‘.hardness’,
ADBE Paint Roundness: ‘.roundness’,
ADBE Paint Tip Spacing: ‘.spacing’,
ADBE Paint Target Channels: ‘.channels’,
ADBE Paint Opacity: ‘.opacity’,
ADBE Paint Flow: ‘.flow’,
ADBE Paint Clone Layer: ‘.cloneSource’,
ADBE Paint Clone Position: ‘.clonePosition’,
ADBE Paint Clone Time: ‘.cloneTime’,
ADBE Paint Clone Time Shift: ‘.cloneTimeShift’,
ADBE Paint Transform: ‘.transform’,
ADBE Paint Anchor Point: ‘.anchorPoint’,
ADBE Paint Position: ‘.position’,
ADBE Paint Scale: ‘.scale’,
ADBE MTrackers: ‘motionTracker’,
ADBE MTracker Pt Feature Center: ‘.featureCenter’,
ADBE MTracker Pt Feature Size: ‘.featureSize’,
ADBE MTracker Pt Search Ofst: ‘.searchOffset’,
ADBE MTracker Pt Search Size: ‘.searchSize’,
ADBE MTracker Pt Confidence: ‘.confidence’,
ADBE MTracker Pt Attach Pt: ‘.attachPoint’,
ADBE MTracker Pt Attach Pt Ofst: ‘.attachPointOffset’,
ADBE Audio Group: ‘audio’,
ADBE Audio Levels: ‘.audioLevels’,
ADBE Time Remapping: ‘timeRemap’,
ADBE Layer Styles: ‘layerStyle’,
ADBE Blend Options Group: ‘.blendingOption’,
ADBE Global Angle2: ADBE Global Angle2:
ADBE Global Altitude2: ‘.globalLightAltitude’,
ADBE Adv Blend Group: ‘.advancedBlending’,
ADBE Layer Fill Opacity2: ‘.fillOpacity’,
ADBE R Channel Blend: ‘.red’,
ADBE G Channel Blend: ‘.green’,
ADBE B Channel Blend: ‘.blue’,
ADBE Blend Interior: ‘.blendInteriorStylesAsGroup’,
ADBE Blend Ranges: ‘.useBlendRangesFromSource’,
dropShadow/enabled: ‘.dropShadow’,
dropShadow/mode2: ‘.blendMode’,
dropShadow/color: ‘.color’,
dropShadow/opacity: ‘.opacity’,
dropShadow/useGlobalAngle: ‘.useGlobalLight’,
dropShadow/localLightingAngle: ‘.angle’,
dropShadow/distance: ‘.distance’,
dropShadow/chokeMatte: ‘.spread’,
dropShadow/blur: ‘.size’,
dropShadow/noise: ‘.noise’,
dropShadow/layerConceals: ‘.layerKnocksOutDropShadow’,
innerShadow/enabled: ‘.innerShadow’,
innerShadow/mode2: ‘.blendMode’,
innerShadow/color: ‘.color’,
innerShadow/opacity: ‘.opacity’,
innerShadow/useGlobalAngle: ‘.useGlobalLight’,
innerShadow/localLightingAngle: ‘.angle’,
innerShadow/distance: ‘.distance’,
innerShadow/chokeMatte: ‘.choke’,
innerShadow/blur: ‘.size’,
innerShadow/noise: ‘.noise’,
outerGlow/enabled: ‘.outerGlow’,
outerGlow/mode2: ‘.blendMode’,
outerGlow/opacity: ‘.opacity’,
outerGlow/noise: ‘.noise’,
outerGlow/AEColorChoice: ‘.colorType’,
outerGlow/color: ‘.color’,
outerGlow/gradientSmoothness: ‘.gradientSmoothness’,
outerGlow/glowTechnique: ‘.technique’,
outerGlow/chokeMatte: ‘.spread’,
outerGlow/blur: ‘.size’,
outerGlow/inputRange: ‘.range’,
outerGlow/shadingNoise: ‘.jitter’,
innerGlow/enabled: ‘.innerGlow’,
innerGlow/mode2: ‘.blendMode’,
innerGlow/opacity: ‘.opacity’,
innerGlow/noise: ‘.noise’,
innerGlow/AEColorChoice: ‘.colorType’,
innerGlow/color: ‘.color’,
innerGlow/gradientSmoothness: ‘.gradientSmoothness’,
innerGlow/glowTechnique: ‘.technique’,
innerGlow/innerGlowSource: ‘.source’,
innerGlow/chokeMatte: ‘.choke’,
innerGlow/blur: ‘.size’,
innerGlow/inputRange: ‘.range’,
innerGlow/shadingNoise: ‘.jitter’,
bevelEmboss/enabled: ‘.bevelAndEmboss’,
bevelEmboss/bevelStyle: ‘.style’,
bevelEmboss/bevelTechnique: ‘.technique’,
bevelEmboss/strengthRatio: ‘.depth’,
bevelEmboss/bevelDirection: ‘.direction’,
bevelEmboss/blur: ‘.size’,
bevelEmboss/softness: ‘.soften’,
bevelEmboss/useGlobalAngle: ‘.useGlobalLight’,
bevelEmboss/localLightingAngle: ‘.angle’,
bevelEmboss/localLightingAltitude: ‘.altitude’,
bevelEmboss/highlightMode: ‘.highlightMode’,
bevelEmboss/highlightColor: ‘.highlightColor’,
bevelEmboss/highlightOpacity: ‘.highlightOpacity’,
bevelEmboss/shadowMode: ‘.shadowMode’,
bevelEmboss/shadowColor: ‘.opacity’,
innerGlow/opacity: ‘.shadowColor’,
bevelEmboss/shadowOpacity: ‘.shadowOpacity’,
chromeFX/enabled: ‘.satin’,
chromeFX/mode2: ‘.blendMode’,
chromeFX/color: ‘.color’,
chromeFX/opacity: ‘.opacity’,
chromeFX/localLightingAngle: ‘.angle’,
chromeFX/distance: ‘.distance’,
chromeFX/blur: ‘.size’,
chromeFX/invert: ‘.invert’,
solidFill/enabled: ‘.colorOverlay’,
solidFill/mode2: ‘.blendMode’,
solidFill/color: ‘.color’,
solidFill/opacity: ‘.opacity’,
gradientFill/enabled: ‘.gradientOverlay’,
gradientFill/mode2: ‘.blendMode’,
gradientFill/opacity: ‘.opacity’,
gradientFill/gradientSmoothness: ‘.gradientSmoothness’,
gradientFill/angle: ‘.angle’,
gradientFill/type: ‘.style’,
gradientFill/reverse: ‘.reverse’,
gradientFill/align: ‘.alignWithLayer’,
gradientFill/scale: ‘.scale’,
gradientFill/offset: ‘.offset’,
patternFill/enabled: ‘.patternOverlay’,
patternFill/mode2: ‘.blendMode’,
patternFill/opacity: ‘.linkWithLayer’,
patternFill/align: ‘.scale’,
patternFill/scale: ‘.opacity’,
patternFill/phase: ‘.offset’,
frameFX/enabled: ‘.blendMode’,
frameFX/color: ‘.color’,
frameFX/size: ‘.size’,
frameFX/opacity: ‘.opacity’,
innerGlow/opacity: ‘.opacity’,
innerGlow/opacity: ‘.opacity’,
frameFX/style: ‘.position’,
退出移动版