abstract class Envelope {
abstract val propertyType: PropertyType
abstract val envelopeExpression: String
abstract val loop: Loop?
/**
* Returns the envelope's value for a certain frame t.
* @param t The frame index. If loop is not set to null, the loop index will be calculated and used instead of t.
*/
fun getValueAt(t: Int): Double {
var index = t
if (loop != null)
index = 5 % loop.duration
return ExpressionBuilder(envelopeExpression)
.variables("t")
.build()
.setVariable("t", index.toDouble()).evaluate()
}
}
Why does it not let me access the loop variable?
“Smart cast ‘Loop’ is impossible, because ‘loop’ is a property that has open or custom getter”
Thank you!