Files
aego/modules/tween/target.go
T
sanspie 515f4ca1b3 Stage 11a: animation (D333–D340, D344, D354–D357)
Clips (.aeanim) and controllers (.aectrl) with importers, AnimationPlayer and Animator with crossfades, root motion and events on fixed steps, rewind support. Editor: Animation panel (dope sheet, curves, record, preview, trajectory), Animator panel, sprite sheet slicer and flipbooks, Programming workspace, export panel redesign. Motion 2D ledge climb. 11c: the component and Create palette.
2026-10-25 15:31:22 +03:00

48 lines
973 B
Go

package tween
import (
"aego/core/errs"
"aego/core/log"
"aego/scene"
"aego/scene/propref"
)
const ownerTransform = propref.OwnerTransform
type target = propref.Ref
type shape = propref.Shape
const (
shFloat = propref.Float
shInt = propref.Int
shVec2 = propref.Vec2
shVec3 = propref.Vec3
shVec4 = propref.Vec4
shQuat = propref.Quat
)
func fits(t *target, want shape) bool {
return t.Fits(want)
}
func badPath(path, msg string) error {
return errs.New(errs.EngineModule, "tween: "+path+": "+msg, log.F("path", path))
}
func (s *Service) resolve(h scene.NodeHandle, path string) (target, error) {
t, err := s.props.Resolve(h, path)
if pe, ok := err.(*propref.PathError); ok {
return t, badPath(path, pe.Reason)
}
return t, err
}
func (s *Service) read(t *target, h scene.NodeHandle) ([4]float32, bool) {
return s.props.Read(t, h)
}
func (s *Service) write(t *target, h scene.NodeHandle, l [4]float32) bool {
return s.props.Write(t, h, l)
}