1 /** 2 Contains data used to animate everything in the engine. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.animation; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.classdb; 23 import godot.resource; 24 import godot.reference; 25 /** 26 Contains data used to animate everything in the engine. 27 28 An Animation resource contains data used to animate everything in the engine. Animations are divided into tracks, and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track. 29 30 31 # This creates an animation that makes the node "Enemy" move to the right by 32 # 100 pixels in 1 second. 33 var animation = Animation.new() 34 var track_index = animation.add_track(Animation.TYPE_VALUE) 35 animation.track_set_path(track_index, "Enemy:position.x") 36 animation.track_insert_key(track_index, 0.0, 0) 37 animation.track_insert_key(track_index, 0.5, 100) 38 39 40 Animations are just data containers, and must be added to nodes such as an $(D AnimationPlayer) or $(D AnimationTreePlayer) to be played back. 41 */ 42 @GodotBaseClass struct Animation 43 { 44 enum string _GODOT_internal_name = "Animation"; 45 public: 46 @nogc nothrow: 47 union { godot_object _godot_object; Resource _GODOT_base; } 48 alias _GODOT_base this; 49 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 50 package(godot) __gshared bool _classBindingInitialized = false; 51 package(godot) static struct _classBinding 52 { 53 __gshared: 54 @GodotName("add_track") GodotMethod!(long, long, long) addTrack; 55 @GodotName("remove_track") GodotMethod!(void, long) removeTrack; 56 @GodotName("get_track_count") GodotMethod!(long) getTrackCount; 57 @GodotName("track_get_type") GodotMethod!(Animation.TrackType, long) trackGetType; 58 @GodotName("track_get_path") GodotMethod!(NodePath, long) trackGetPath; 59 @GodotName("track_set_path") GodotMethod!(void, long, NodePath) trackSetPath; 60 @GodotName("find_track") GodotMethod!(long, NodePath) findTrack; 61 @GodotName("track_move_up") GodotMethod!(void, long) trackMoveUp; 62 @GodotName("track_move_down") GodotMethod!(void, long) trackMoveDown; 63 @GodotName("track_swap") GodotMethod!(void, long, long) trackSwap; 64 @GodotName("track_set_imported") GodotMethod!(void, long, bool) trackSetImported; 65 @GodotName("track_is_imported") GodotMethod!(bool, long) trackIsImported; 66 @GodotName("track_set_enabled") GodotMethod!(void, long, bool) trackSetEnabled; 67 @GodotName("track_is_enabled") GodotMethod!(bool, long) trackIsEnabled; 68 @GodotName("transform_track_insert_key") GodotMethod!(long, long, double, Vector3, Quat, Vector3) transformTrackInsertKey; 69 @GodotName("track_insert_key") GodotMethod!(void, long, double, Variant, double) trackInsertKey; 70 @GodotName("track_remove_key") GodotMethod!(void, long, long) trackRemoveKey; 71 @GodotName("track_remove_key_at_position") GodotMethod!(void, long, double) trackRemoveKeyAtPosition; 72 @GodotName("track_set_key_value") GodotMethod!(void, long, long, Variant) trackSetKeyValue; 73 @GodotName("track_set_key_transition") GodotMethod!(void, long, long, double) trackSetKeyTransition; 74 @GodotName("track_get_key_transition") GodotMethod!(double, long, long) trackGetKeyTransition; 75 @GodotName("track_get_key_count") GodotMethod!(long, long) trackGetKeyCount; 76 @GodotName("track_get_key_value") GodotMethod!(Variant, long, long) trackGetKeyValue; 77 @GodotName("track_get_key_time") GodotMethod!(double, long, long) trackGetKeyTime; 78 @GodotName("track_find_key") GodotMethod!(long, long, double, bool) trackFindKey; 79 @GodotName("track_set_interpolation_type") GodotMethod!(void, long, long) trackSetInterpolationType; 80 @GodotName("track_get_interpolation_type") GodotMethod!(Animation.InterpolationType, long) trackGetInterpolationType; 81 @GodotName("track_set_interpolation_loop_wrap") GodotMethod!(void, long, bool) trackSetInterpolationLoopWrap; 82 @GodotName("track_get_interpolation_loop_wrap") GodotMethod!(bool, long) trackGetInterpolationLoopWrap; 83 @GodotName("transform_track_interpolate") GodotMethod!(Array, long, double) transformTrackInterpolate; 84 @GodotName("value_track_set_update_mode") GodotMethod!(void, long, long) valueTrackSetUpdateMode; 85 @GodotName("value_track_get_update_mode") GodotMethod!(Animation.UpdateMode, long) valueTrackGetUpdateMode; 86 @GodotName("value_track_get_key_indices") GodotMethod!(PoolIntArray, long, double, double) valueTrackGetKeyIndices; 87 @GodotName("method_track_get_key_indices") GodotMethod!(PoolIntArray, long, double, double) methodTrackGetKeyIndices; 88 @GodotName("method_track_get_name") GodotMethod!(String, long, long) methodTrackGetName; 89 @GodotName("method_track_get_params") GodotMethod!(Array, long, long) methodTrackGetParams; 90 @GodotName("bezier_track_insert_key") GodotMethod!(long, long, double, double, Vector2, Vector2) bezierTrackInsertKey; 91 @GodotName("bezier_track_set_key_value") GodotMethod!(void, long, long, double) bezierTrackSetKeyValue; 92 @GodotName("bezier_track_set_key_in_handle") GodotMethod!(void, long, long, Vector2) bezierTrackSetKeyInHandle; 93 @GodotName("bezier_track_set_key_out_handle") GodotMethod!(void, long, long, Vector2) bezierTrackSetKeyOutHandle; 94 @GodotName("bezier_track_get_key_value") GodotMethod!(double, long, long) bezierTrackGetKeyValue; 95 @GodotName("bezier_track_get_key_in_handle") GodotMethod!(Vector2, long, long) bezierTrackGetKeyInHandle; 96 @GodotName("bezier_track_get_key_out_handle") GodotMethod!(Vector2, long, long) bezierTrackGetKeyOutHandle; 97 @GodotName("bezier_track_interpolate") GodotMethod!(double, long, double) bezierTrackInterpolate; 98 @GodotName("audio_track_insert_key") GodotMethod!(long, long, double, Resource, double, double) audioTrackInsertKey; 99 @GodotName("audio_track_set_key_stream") GodotMethod!(void, long, long, Resource) audioTrackSetKeyStream; 100 @GodotName("audio_track_set_key_start_offset") GodotMethod!(void, long, long, double) audioTrackSetKeyStartOffset; 101 @GodotName("audio_track_set_key_end_offset") GodotMethod!(void, long, long, double) audioTrackSetKeyEndOffset; 102 @GodotName("audio_track_get_key_stream") GodotMethod!(Resource, long, long) audioTrackGetKeyStream; 103 @GodotName("audio_track_get_key_start_offset") GodotMethod!(double, long, long) audioTrackGetKeyStartOffset; 104 @GodotName("audio_track_get_key_end_offset") GodotMethod!(double, long, long) audioTrackGetKeyEndOffset; 105 @GodotName("animation_track_insert_key") GodotMethod!(long, long, double, String) animationTrackInsertKey; 106 @GodotName("animation_track_set_key_animation") GodotMethod!(void, long, long, String) animationTrackSetKeyAnimation; 107 @GodotName("animation_track_get_key_animation") GodotMethod!(String, long, long) animationTrackGetKeyAnimation; 108 @GodotName("set_length") GodotMethod!(void, double) setLength; 109 @GodotName("get_length") GodotMethod!(double) getLength; 110 @GodotName("set_loop") GodotMethod!(void, bool) setLoop; 111 @GodotName("has_loop") GodotMethod!(bool) hasLoop; 112 @GodotName("set_step") GodotMethod!(void, double) setStep; 113 @GodotName("get_step") GodotMethod!(double) getStep; 114 @GodotName("clear") GodotMethod!(void) clear; 115 @GodotName("copy_track") GodotMethod!(void, long, Animation) copyTrack; 116 } 117 bool opEquals(in Animation other) const { return _godot_object.ptr is other._godot_object.ptr; } 118 Animation opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 119 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 120 mixin baseCasts; 121 static Animation _new() 122 { 123 static godot_class_constructor constructor; 124 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Animation"); 125 if(constructor is null) return typeof(this).init; 126 return cast(Animation)(constructor()); 127 } 128 @disable new(size_t s); 129 /// 130 enum TrackType : int 131 { 132 /** 133 Value tracks set values in node properties, but only those which can be Interpolated. 134 */ 135 typeValue = 0, 136 /** 137 Transform tracks are used to change node local transforms or skeleton pose bones. Transitions are Interpolated. 138 */ 139 typeTransform = 1, 140 /** 141 Method tracks call functions with given arguments per key. 142 */ 143 typeMethod = 2, 144 /** 145 146 */ 147 typeBezier = 3, 148 /** 149 150 */ 151 typeAudio = 4, 152 /** 153 154 */ 155 typeAnimation = 5, 156 } 157 /// 158 enum UpdateMode : int 159 { 160 /** 161 Update between keyframes. 162 */ 163 updateContinuous = 0, 164 /** 165 Update at the keyframes and hold the value. 166 */ 167 updateDiscrete = 1, 168 /** 169 Update at the keyframes. 170 */ 171 updateTrigger = 2, 172 /** 173 174 */ 175 updateCapture = 3, 176 } 177 /// 178 enum InterpolationType : int 179 { 180 /** 181 No interpolation (nearest value). 182 */ 183 interpolationNearest = 0, 184 /** 185 Linear interpolation. 186 */ 187 interpolationLinear = 1, 188 /** 189 Cubic interpolation. 190 */ 191 interpolationCubic = 2, 192 } 193 /// 194 enum Constants : int 195 { 196 typeValue = 0, 197 interpolationNearest = 0, 198 updateContinuous = 0, 199 interpolationLinear = 1, 200 updateDiscrete = 1, 201 typeTransform = 1, 202 updateTrigger = 2, 203 interpolationCubic = 2, 204 typeMethod = 2, 205 typeBezier = 3, 206 updateCapture = 3, 207 typeAudio = 4, 208 typeAnimation = 5, 209 } 210 /** 211 Add a track to the Animation. The track type must be specified as any of the values in the TYPE_* enumeration. 212 */ 213 long addTrack(in long type, in long at_position = -1) 214 { 215 checkClassBinding!(typeof(this))(); 216 return ptrcall!(long)(_classBinding.addTrack, _godot_object, type, at_position); 217 } 218 /** 219 Remove a track by specifying the track index. 220 */ 221 void removeTrack(in long idx) 222 { 223 checkClassBinding!(typeof(this))(); 224 ptrcall!(void)(_classBinding.removeTrack, _godot_object, idx); 225 } 226 /** 227 Return the amount of tracks in the animation. 228 */ 229 long getTrackCount() const 230 { 231 checkClassBinding!(typeof(this))(); 232 return ptrcall!(long)(_classBinding.getTrackCount, _godot_object); 233 } 234 /** 235 Get the type of a track. 236 */ 237 Animation.TrackType trackGetType(in long idx) const 238 { 239 checkClassBinding!(typeof(this))(); 240 return ptrcall!(Animation.TrackType)(_classBinding.trackGetType, _godot_object, idx); 241 } 242 /** 243 Get the path of a track. for more information on the path format, see $(D trackSetPath) 244 */ 245 NodePath trackGetPath(in long idx) const 246 { 247 checkClassBinding!(typeof(this))(); 248 return ptrcall!(NodePath)(_classBinding.trackGetPath, _godot_object, idx); 249 } 250 /** 251 Set the path of a track. Paths must be valid scene-tree paths to a node, and must be specified starting from the parent node of the node that will reproduce the animation. Tracks that control properties or bones must append their name after the path, separated by ":". 252 $(B Example:) "character/skeleton:ankle" or "character/mesh:transform/local". 253 */ 254 void trackSetPath(NodePathArg1)(in long idx, in NodePathArg1 path) 255 { 256 checkClassBinding!(typeof(this))(); 257 ptrcall!(void)(_classBinding.trackSetPath, _godot_object, idx, path); 258 } 259 /** 260 Return the index of the specified track. If the track is not found, return -1. 261 */ 262 long findTrack(NodePathArg0)(in NodePathArg0 path) const 263 { 264 checkClassBinding!(typeof(this))(); 265 return ptrcall!(long)(_classBinding.findTrack, _godot_object, path); 266 } 267 /** 268 Move a track up. 269 */ 270 void trackMoveUp(in long idx) 271 { 272 checkClassBinding!(typeof(this))(); 273 ptrcall!(void)(_classBinding.trackMoveUp, _godot_object, idx); 274 } 275 /** 276 Move a track down. 277 */ 278 void trackMoveDown(in long idx) 279 { 280 checkClassBinding!(typeof(this))(); 281 ptrcall!(void)(_classBinding.trackMoveDown, _godot_object, idx); 282 } 283 /** 284 285 */ 286 void trackSwap(in long idx, in long with_idx) 287 { 288 checkClassBinding!(typeof(this))(); 289 ptrcall!(void)(_classBinding.trackSwap, _godot_object, idx, with_idx); 290 } 291 /** 292 Set the given track as imported or not. 293 */ 294 void trackSetImported(in long idx, in bool imported) 295 { 296 checkClassBinding!(typeof(this))(); 297 ptrcall!(void)(_classBinding.trackSetImported, _godot_object, idx, imported); 298 } 299 /** 300 Return true if the given track is imported. Else, return false. 301 */ 302 bool trackIsImported(in long idx) const 303 { 304 checkClassBinding!(typeof(this))(); 305 return ptrcall!(bool)(_classBinding.trackIsImported, _godot_object, idx); 306 } 307 /** 308 Enables/disables the given track. Tracks are enabled by default. 309 */ 310 void trackSetEnabled(in long idx, in bool enabled) 311 { 312 checkClassBinding!(typeof(this))(); 313 ptrcall!(void)(_classBinding.trackSetEnabled, _godot_object, idx, enabled); 314 } 315 /** 316 Returns `true` if the track at index `idx` is enabled. 317 */ 318 bool trackIsEnabled(in long idx) const 319 { 320 checkClassBinding!(typeof(this))(); 321 return ptrcall!(bool)(_classBinding.trackIsEnabled, _godot_object, idx); 322 } 323 /** 324 Insert a transform key for a transform track. 325 */ 326 long transformTrackInsertKey(in long idx, in double time, in Vector3 location, in Quat rotation, in Vector3 scale) 327 { 328 checkClassBinding!(typeof(this))(); 329 return ptrcall!(long)(_classBinding.transformTrackInsertKey, _godot_object, idx, time, location, rotation, scale); 330 } 331 /** 332 Insert a generic key in a given track. 333 */ 334 void trackInsertKey(VariantArg2)(in long idx, in double time, in VariantArg2 key, in double transition = 1) 335 { 336 checkClassBinding!(typeof(this))(); 337 ptrcall!(void)(_classBinding.trackInsertKey, _godot_object, idx, time, key, transition); 338 } 339 /** 340 Remove a key by index in a given track. 341 */ 342 void trackRemoveKey(in long idx, in long key_idx) 343 { 344 checkClassBinding!(typeof(this))(); 345 ptrcall!(void)(_classBinding.trackRemoveKey, _godot_object, idx, key_idx); 346 } 347 /** 348 Remove a key by position (seconds) in a given track. 349 */ 350 void trackRemoveKeyAtPosition(in long idx, in double position) 351 { 352 checkClassBinding!(typeof(this))(); 353 ptrcall!(void)(_classBinding.trackRemoveKeyAtPosition, _godot_object, idx, position); 354 } 355 /** 356 Set the value of an existing key. 357 */ 358 void trackSetKeyValue(VariantArg2)(in long idx, in long key, in VariantArg2 value) 359 { 360 checkClassBinding!(typeof(this))(); 361 ptrcall!(void)(_classBinding.trackSetKeyValue, _godot_object, idx, key, value); 362 } 363 /** 364 Set the transition curve (easing) for a specific key (see built-in math function "ease"). 365 */ 366 void trackSetKeyTransition(in long idx, in long key_idx, in double transition) 367 { 368 checkClassBinding!(typeof(this))(); 369 ptrcall!(void)(_classBinding.trackSetKeyTransition, _godot_object, idx, key_idx, transition); 370 } 371 /** 372 Return the transition curve (easing) for a specific key (see built-in math function "ease"). 373 */ 374 double trackGetKeyTransition(in long idx, in long key_idx) const 375 { 376 checkClassBinding!(typeof(this))(); 377 return ptrcall!(double)(_classBinding.trackGetKeyTransition, _godot_object, idx, key_idx); 378 } 379 /** 380 Return the amount of keys in a given track. 381 */ 382 long trackGetKeyCount(in long idx) const 383 { 384 checkClassBinding!(typeof(this))(); 385 return ptrcall!(long)(_classBinding.trackGetKeyCount, _godot_object, idx); 386 } 387 /** 388 Return the value of a given key in a given track. 389 */ 390 Variant trackGetKeyValue(in long idx, in long key_idx) const 391 { 392 checkClassBinding!(typeof(this))(); 393 return ptrcall!(Variant)(_classBinding.trackGetKeyValue, _godot_object, idx, key_idx); 394 } 395 /** 396 Return the time at which the key is located. 397 */ 398 double trackGetKeyTime(in long idx, in long key_idx) const 399 { 400 checkClassBinding!(typeof(this))(); 401 return ptrcall!(double)(_classBinding.trackGetKeyTime, _godot_object, idx, key_idx); 402 } 403 /** 404 Find the key index by time in a given track. Optionally, only find it if the exact time is given. 405 */ 406 long trackFindKey(in long idx, in double time, in bool exact = false) const 407 { 408 checkClassBinding!(typeof(this))(); 409 return ptrcall!(long)(_classBinding.trackFindKey, _godot_object, idx, time, exact); 410 } 411 /** 412 Set the interpolation type of a given track, from the INTERPOLATION_* enum. 413 */ 414 void trackSetInterpolationType(in long idx, in long interpolation) 415 { 416 checkClassBinding!(typeof(this))(); 417 ptrcall!(void)(_classBinding.trackSetInterpolationType, _godot_object, idx, interpolation); 418 } 419 /** 420 Return the interpolation type of a given track, from the INTERPOLATION_* enum. 421 */ 422 Animation.InterpolationType trackGetInterpolationType(in long idx) const 423 { 424 checkClassBinding!(typeof(this))(); 425 return ptrcall!(Animation.InterpolationType)(_classBinding.trackGetInterpolationType, _godot_object, idx); 426 } 427 /** 428 If `true` the track at `idx` wraps the interpolation loop. 429 */ 430 void trackSetInterpolationLoopWrap(in long idx, in bool interpolation) 431 { 432 checkClassBinding!(typeof(this))(); 433 ptrcall!(void)(_classBinding.trackSetInterpolationLoopWrap, _godot_object, idx, interpolation); 434 } 435 /** 436 Returns `true` if the track at `idx` wraps the interpolation loop. Default value: `true`. 437 */ 438 bool trackGetInterpolationLoopWrap(in long idx) const 439 { 440 checkClassBinding!(typeof(this))(); 441 return ptrcall!(bool)(_classBinding.trackGetInterpolationLoopWrap, _godot_object, idx); 442 } 443 /** 444 Return the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position ($(D Vector3)), rotation ($(D Quat)) and scale ($(D Vector3)). 445 */ 446 Array transformTrackInterpolate(in long idx, in double time_sec) const 447 { 448 checkClassBinding!(typeof(this))(); 449 return ptrcall!(Array)(_classBinding.transformTrackInterpolate, _godot_object, idx, time_sec); 450 } 451 /** 452 Set the update mode (UPDATE_*) of a value track. 453 */ 454 void valueTrackSetUpdateMode(in long idx, in long mode) 455 { 456 checkClassBinding!(typeof(this))(); 457 ptrcall!(void)(_classBinding.valueTrackSetUpdateMode, _godot_object, idx, mode); 458 } 459 /** 460 Return the update mode of a value track. 461 */ 462 Animation.UpdateMode valueTrackGetUpdateMode(in long idx) const 463 { 464 checkClassBinding!(typeof(this))(); 465 return ptrcall!(Animation.UpdateMode)(_classBinding.valueTrackGetUpdateMode, _godot_object, idx); 466 } 467 /** 468 Return all the key indices of a value track, given a position and delta time. 469 */ 470 PoolIntArray valueTrackGetKeyIndices(in long idx, in double time_sec, in double delta) const 471 { 472 checkClassBinding!(typeof(this))(); 473 return ptrcall!(PoolIntArray)(_classBinding.valueTrackGetKeyIndices, _godot_object, idx, time_sec, delta); 474 } 475 /** 476 Return all the key indices of a method track, given a position and delta time. 477 */ 478 PoolIntArray methodTrackGetKeyIndices(in long idx, in double time_sec, in double delta) const 479 { 480 checkClassBinding!(typeof(this))(); 481 return ptrcall!(PoolIntArray)(_classBinding.methodTrackGetKeyIndices, _godot_object, idx, time_sec, delta); 482 } 483 /** 484 Return the method name of a method track. 485 */ 486 String methodTrackGetName(in long idx, in long key_idx) const 487 { 488 checkClassBinding!(typeof(this))(); 489 return ptrcall!(String)(_classBinding.methodTrackGetName, _godot_object, idx, key_idx); 490 } 491 /** 492 Return the arguments values to be called on a method track for a given key in a given track. 493 */ 494 Array methodTrackGetParams(in long idx, in long key_idx) const 495 { 496 checkClassBinding!(typeof(this))(); 497 return ptrcall!(Array)(_classBinding.methodTrackGetParams, _godot_object, idx, key_idx); 498 } 499 /** 500 501 */ 502 long bezierTrackInsertKey(in long track, in double time, in double value, in Vector2 in_handle = Vector2(0, 0), in Vector2 out_handle = Vector2(0, 0)) 503 { 504 checkClassBinding!(typeof(this))(); 505 return ptrcall!(long)(_classBinding.bezierTrackInsertKey, _godot_object, track, time, value, in_handle, out_handle); 506 } 507 /** 508 509 */ 510 void bezierTrackSetKeyValue(in long idx, in long key_idx, in double value) 511 { 512 checkClassBinding!(typeof(this))(); 513 ptrcall!(void)(_classBinding.bezierTrackSetKeyValue, _godot_object, idx, key_idx, value); 514 } 515 /** 516 517 */ 518 void bezierTrackSetKeyInHandle(in long idx, in long key_idx, in Vector2 in_handle) 519 { 520 checkClassBinding!(typeof(this))(); 521 ptrcall!(void)(_classBinding.bezierTrackSetKeyInHandle, _godot_object, idx, key_idx, in_handle); 522 } 523 /** 524 525 */ 526 void bezierTrackSetKeyOutHandle(in long idx, in long key_idx, in Vector2 out_handle) 527 { 528 checkClassBinding!(typeof(this))(); 529 ptrcall!(void)(_classBinding.bezierTrackSetKeyOutHandle, _godot_object, idx, key_idx, out_handle); 530 } 531 /** 532 533 */ 534 double bezierTrackGetKeyValue(in long idx, in long key_idx) const 535 { 536 checkClassBinding!(typeof(this))(); 537 return ptrcall!(double)(_classBinding.bezierTrackGetKeyValue, _godot_object, idx, key_idx); 538 } 539 /** 540 541 */ 542 Vector2 bezierTrackGetKeyInHandle(in long idx, in long key_idx) const 543 { 544 checkClassBinding!(typeof(this))(); 545 return ptrcall!(Vector2)(_classBinding.bezierTrackGetKeyInHandle, _godot_object, idx, key_idx); 546 } 547 /** 548 549 */ 550 Vector2 bezierTrackGetKeyOutHandle(in long idx, in long key_idx) const 551 { 552 checkClassBinding!(typeof(this))(); 553 return ptrcall!(Vector2)(_classBinding.bezierTrackGetKeyOutHandle, _godot_object, idx, key_idx); 554 } 555 /** 556 557 */ 558 double bezierTrackInterpolate(in long track, in double time) const 559 { 560 checkClassBinding!(typeof(this))(); 561 return ptrcall!(double)(_classBinding.bezierTrackInterpolate, _godot_object, track, time); 562 } 563 /** 564 565 */ 566 long audioTrackInsertKey(in long track, in double time, Resource stream, in double start_offset = 0, in double end_offset = 0) 567 { 568 checkClassBinding!(typeof(this))(); 569 return ptrcall!(long)(_classBinding.audioTrackInsertKey, _godot_object, track, time, stream, start_offset, end_offset); 570 } 571 /** 572 573 */ 574 void audioTrackSetKeyStream(in long idx, in long key_idx, Resource stream) 575 { 576 checkClassBinding!(typeof(this))(); 577 ptrcall!(void)(_classBinding.audioTrackSetKeyStream, _godot_object, idx, key_idx, stream); 578 } 579 /** 580 581 */ 582 void audioTrackSetKeyStartOffset(in long idx, in long key_idx, in double offset) 583 { 584 checkClassBinding!(typeof(this))(); 585 ptrcall!(void)(_classBinding.audioTrackSetKeyStartOffset, _godot_object, idx, key_idx, offset); 586 } 587 /** 588 589 */ 590 void audioTrackSetKeyEndOffset(in long idx, in long key_idx, in double offset) 591 { 592 checkClassBinding!(typeof(this))(); 593 ptrcall!(void)(_classBinding.audioTrackSetKeyEndOffset, _godot_object, idx, key_idx, offset); 594 } 595 /** 596 597 */ 598 Ref!Resource audioTrackGetKeyStream(in long idx, in long key_idx) const 599 { 600 checkClassBinding!(typeof(this))(); 601 return ptrcall!(Resource)(_classBinding.audioTrackGetKeyStream, _godot_object, idx, key_idx); 602 } 603 /** 604 605 */ 606 double audioTrackGetKeyStartOffset(in long idx, in long key_idx) const 607 { 608 checkClassBinding!(typeof(this))(); 609 return ptrcall!(double)(_classBinding.audioTrackGetKeyStartOffset, _godot_object, idx, key_idx); 610 } 611 /** 612 613 */ 614 double audioTrackGetKeyEndOffset(in long idx, in long key_idx) const 615 { 616 checkClassBinding!(typeof(this))(); 617 return ptrcall!(double)(_classBinding.audioTrackGetKeyEndOffset, _godot_object, idx, key_idx); 618 } 619 /** 620 621 */ 622 long animationTrackInsertKey(StringArg2)(in long track, in double time, in StringArg2 animation) 623 { 624 checkClassBinding!(typeof(this))(); 625 return ptrcall!(long)(_classBinding.animationTrackInsertKey, _godot_object, track, time, animation); 626 } 627 /** 628 629 */ 630 void animationTrackSetKeyAnimation(StringArg2)(in long idx, in long key_idx, in StringArg2 animation) 631 { 632 checkClassBinding!(typeof(this))(); 633 ptrcall!(void)(_classBinding.animationTrackSetKeyAnimation, _godot_object, idx, key_idx, animation); 634 } 635 /** 636 637 */ 638 String animationTrackGetKeyAnimation(in long idx, in long key_idx) const 639 { 640 checkClassBinding!(typeof(this))(); 641 return ptrcall!(String)(_classBinding.animationTrackGetKeyAnimation, _godot_object, idx, key_idx); 642 } 643 /** 644 645 */ 646 void setLength(in double time_sec) 647 { 648 checkClassBinding!(typeof(this))(); 649 ptrcall!(void)(_classBinding.setLength, _godot_object, time_sec); 650 } 651 /** 652 653 */ 654 double getLength() const 655 { 656 checkClassBinding!(typeof(this))(); 657 return ptrcall!(double)(_classBinding.getLength, _godot_object); 658 } 659 /** 660 661 */ 662 void setLoop(in bool enabled) 663 { 664 checkClassBinding!(typeof(this))(); 665 ptrcall!(void)(_classBinding.setLoop, _godot_object, enabled); 666 } 667 /** 668 669 */ 670 bool hasLoop() const 671 { 672 checkClassBinding!(typeof(this))(); 673 return ptrcall!(bool)(_classBinding.hasLoop, _godot_object); 674 } 675 /** 676 677 */ 678 void setStep(in double size_sec) 679 { 680 checkClassBinding!(typeof(this))(); 681 ptrcall!(void)(_classBinding.setStep, _godot_object, size_sec); 682 } 683 /** 684 685 */ 686 double getStep() const 687 { 688 checkClassBinding!(typeof(this))(); 689 return ptrcall!(double)(_classBinding.getStep, _godot_object); 690 } 691 /** 692 Clear the animation (clear all tracks and reset all). 693 */ 694 void clear() 695 { 696 checkClassBinding!(typeof(this))(); 697 ptrcall!(void)(_classBinding.clear, _godot_object); 698 } 699 /** 700 Adds a new track that is a copy of the given track from `to_animation`. 701 */ 702 void copyTrack(in long track, Animation to_animation) 703 { 704 checkClassBinding!(typeof(this))(); 705 ptrcall!(void)(_classBinding.copyTrack, _godot_object, track, to_animation); 706 } 707 /** 708 The total length of the animation (in seconds). Note that length is not delimited by the last key, as this one may be before or after the end to ensure correct interpolation and looping. 709 */ 710 @property double length() 711 { 712 return getLength(); 713 } 714 /// ditto 715 @property void length(double v) 716 { 717 setLength(v); 718 } 719 /** 720 A flag indicating that the animation must loop. This is uses for correct interpolation of animation cycles, and for hinting the player that it must restart the animation. 721 */ 722 @property bool loop() 723 { 724 return hasLoop(); 725 } 726 /// ditto 727 @property void loop(bool v) 728 { 729 setLoop(v); 730 } 731 /** 732 The animation step value. 733 */ 734 @property double step() 735 { 736 return getStep(); 737 } 738 /// ditto 739 @property void step(double v) 740 { 741 setStep(v); 742 } 743 }