# HG changeset patch # User Sam # Date 1688899246 -25200 # Node ID b4b3143e3626e7ed4c7af11bd19822e1c642cdcb # Parent 555b55e6b25bfcb92640eb4356dfbbf76feda19b did: add "playing" query to public API diff -r 555b55e6b25b -r b4b3143e3626 src/semicongine/scene.nim --- a/src/semicongine/scene.nim Sun Jul 09 17:07:36 2023 +0700 +++ b/src/semicongine/scene.nim Sun Jul 09 17:40:46 2023 +0700 @@ -52,18 +52,25 @@ animation.player.stop() animation.player.resetPlayer() +func playing*(animation: EntityAnimation): bool = + animation.player.playing + func update*(animation: EntityAnimation, dt: float32) = animation.player.advance(dt) func parent(entity: Entity): Entity = entity.parent +# TODO: this is wrong: transfrom setter + getter are not "symetric" func transform*(entity: Entity): Mat4 = result = entity.internal_transform for component in entity.components.mvalues: if component of EntityAnimation and EntityAnimation(component).player.playing: result = result * EntityAnimation(component).player.currentValue +func `transform=`*(entity: Entity, value: Mat4) = + entity.internal_transform = value + # TODO: position-setter func position*(entity: Entity): Vec3f = return entity.transform.col(3) @@ -71,9 +78,6 @@ func originalTransform*(entity: Entity): Mat4 = entity.internal_transform -func `transform=`*(entity: Entity, value: Mat4) = - entity.internal_transform = value - func getModelTransform*(entity: Entity): Mat4 = result = entity.transform if not entity.parent.isNil: