Skip to content

Commit f16e689

Browse files
author
Nathan
committed
implement parsing custom user-defined property labels
1 parent c31f4f2 commit f16e689

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

data/Property-01.aep

100755100644
13.1 KB
Binary file not shown.

property.go

+16
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func (p PropertyTypeName) String() string {
6565
type Property struct {
6666
MatchName string
6767
Name string
68+
Label string
6869
Index uint32
6970
PropertyType PropertyTypeName
7071
Properties []*Property
@@ -106,6 +107,21 @@ func parseProperty(propData interface{}, matchName string) (*Property, error) {
106107
if err == nil {
107108
prop.Name = fnamBlock.ToString()
108109
}
110+
tdgpBlock, err := propHead.SublistFind("tdgp")
111+
if err == nil {
112+
fmt.Println("DEBUUUUUUGGG ===========================")
113+
fmt.Println(tdgpBlock)
114+
115+
// Look for a tdsn which specifies the user-defined label of the property
116+
tdsnBlock, err := tdgpBlock.FindByType("tdsn")
117+
if err == nil {
118+
label := fmt.Sprintf("%s", tdsnBlock.ToString())
119+
120+
if label != "-_0_/-" {
121+
prop.Label = label
122+
}
123+
}
124+
}
109125
parTList := propHead.SublistMerge("parT")
110126
subPropMatchNames, subPropPards := pairMatchNames(parTList)
111127
for idx, mn := range subPropMatchNames {

property_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func TestPropertyParsing(t *testing.T) {
8888
expect(t, angleEffect.Index, uint32(6))
8989
expect(t, angleEffect.MatchName, "ADBE Angle Control")
9090
expect(t, angleEffect.Name, "Angle Control")
91+
expect(t, angleEffect.Label, "Custom Angle Control Label")
9192
expect(t, angleEffect.PropertyType, PropertyTypeGroup)
9293
expect(t, len(angleEffect.Properties), 1)
9394
expect(t, angleEffect.Properties[0].Index, uint32(1))

0 commit comments

Comments
 (0)