After Effects 圖層屬性及屬性組結構詳解

VE視訊引擎發表於2021-10-12

根據結構型別的屬性分類

在 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',

相關文章