Skip to content

Commit f496e27

Browse files
timlehrmarkreidvfx
authored andcommitted
Added workaround for properties with 0/0 values
Storyboard Pro exports AAF in a weird way that can contain animated properties with 0/0 values, which is mathematically impossible. This is a workaround that falls back to a 0/1 value, which will be represented as 0.0 in the data. Signed-off-by: Tim Lehr <tim.lehr@disneyanimation.com>
1 parent 4f15598 commit f496e27

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/aaf2/rational.py

+11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
)
77

88
import sys
9+
import logging
910
from fractions import Fraction, _RATIONAL_FORMAT
1011
from decimal import Decimal
1112
import numbers
@@ -92,6 +93,16 @@ def __new__(cls, numerator=0, denominator=None):
9293
"Rational instances")
9394

9495
if denominator == 0:
96+
if numerator == 0:
97+
# AAF seemingly can have valid 0/0 property values,
98+
# which we default to 0/1, which is mathematically not
99+
# correct but works around this weird AAF behaviour (observed in
100+
# AAF files exported from Storyboard Pro)
101+
logging.warning("Fraction(0,0) not mathematically plausible, "
102+
"use Fraction(0,1) instead.")
103+
self._numerator = 0
104+
self._denominator = 1
105+
return self
95106
raise ZeroDivisionError('Fraction(%s, 0)' % numerator)
96107
# don't find the gcd
97108
#g = gcd(numerator, denominator)

0 commit comments

Comments
 (0)