Hello,
As the title says, the function HasSpline in an attribute fails if that attribute has both splines and time samples. Is that expected? I’ve tested with usd 25.11 and 24.11
Consider the following code:
stage = Usd.Stage.CreateInMemory()
prim_path = "/TestPrim"
xform = UsdGeom.Xform.Define(stage, prim_path)
prim = xform.GetPrim()
translateXOp = xform.AddTranslateXOp()
translateYOp = xform.AddTranslateYOp()
timeFrames = [1.0, 5.0, 10.0]
xValues = [0.0, 5.0, 10.0]
yValues = [0.0, 3.0, 6.0]
spline = Ts.Spline()
knots = Ts.KnotMap()
for time, value in zip(timeFrames, xValues):
knot = Ts.Knot()
knot.SetTime(time)
knot.SetValue(value)
knots[time] = knot
spline.SetKnots(knots)
translateXAttr = translateXOp.GetAttr()
translateXAttr.SetSpline(spline)
translateYAttr = translateYOp.GetAttr()
translateYAttr.SetSpline(spline)
for time, value in zip(timeFrames, yValues): # Removing this for loop makes HasSpline become true
translateXAttr.Set(value, time)
translateYAttr.Set(value, time)
print(f"translateX:")
print(f" - Has Spline: {translateXAttr.HasSpline()}")
print(f" - Has time samples: {translateXAttr.GetNumTimeSamples() > 0}")
print(f"translateY:")
print(f" - Has Spline: {translateYAttr.HasSpline()}")
print(f" - Has time samples: {translateYAttr.GetNumTimeSamples() > 0}")