Skip to content

Commit 4800ea2

Browse files
committed
added basic text layer prop parsing
1 parent b2cdc02 commit 4800ea2

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

data/Property-01.aep

14.8 KB
Binary file not shown.

layer.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type Layer struct {
5757
AudioEnabled bool
5858
VideoEnabled bool
5959
Effects []*Property
60+
Text *Property
6061
}
6162

6263
func parseLayer(layerHead *rifx.List, project *Project) (*Layer, error) {
@@ -100,15 +101,24 @@ func parseLayer(layerHead *rifx.List, project *Project) (*Layer, error) {
100101

101102
rootTDGP, _ := indexedGroupToMap(layerHead.SublistMerge("tdgp"))
102103

103-
effectsTDGP := rootTDGP["ADBE Effect Parade"]
104-
if effectsTDGP == nil {
105-
layer.Effects = make([]*Property, 0)
106-
} else {
104+
// Parse effects stack
105+
if effectsTDGP, ok := rootTDGP["ADBE Effect Parade"]; ok {
107106
effectsProp, err := parseProperty(effectsTDGP, "ADBE Effect Parade")
108107
if err != nil {
109108
return nil, err
110109
}
111110
layer.Effects = effectsProp.Properties
111+
} else {
112+
layer.Effects = make([]*Property, 0)
113+
}
114+
115+
// Parse text layer properties
116+
if textTDGP, ok := rootTDGP["ADBE Text Properties"]; ok {
117+
textProp, err := parseProperty(textTDGP, "ADBE Text Properties")
118+
if err != nil {
119+
return nil, err
120+
}
121+
layer.Text = textProp
112122
}
113123

114124
return layer, nil

property_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ func TestPropertyParsing(t *testing.T) {
1111
}
1212

1313
comp01 := project.RootFolder.FolderContents[0]
14+
textLayer := comp01.CompositionLayers[1]
15+
expect(t, len(textLayer.Effects), 0)
16+
expect(t, textLayer.Text != nil)
17+
1418
expressionControlsLayer := comp01.CompositionLayers[0]
1519
expect(t, len(expressionControlsLayer.Effects), 7)
20+
expect(t, expressionControlsLayer.Text == nil)
1621

1722
checkboxEffect := expressionControlsLayer.Effects[0]
1823
expect(t, checkboxEffect.Index, uint32(1))

0 commit comments

Comments
 (0)