Browse Source

Expose Animation::value_track_interpolate to GDscript

(cherry picked from commit ff4af94414ff34e1993fa315fa8988af78ee6d8c)
lolligerjoj 5 years ago
parent
commit
0586c856f6
2 changed files with 12 additions and 0 deletions
  1. 11 0
      doc/classes/Animation.xml
  2. 1 0
      scene/resources/animation.cpp

+ 11 - 0
doc/classes/Animation.xml

@@ -681,6 +681,17 @@
 				Sets the update mode (see [enum UpdateMode]) of a value track.
 			</description>
 		</method>
+		<method name="value_track_interpolate" qualifiers="const">
+			<return type="float">
+			</return>
+			<argument index="0" name="track_idx" type="int">
+			</argument>
+			<argument index="1" name="time_sec" type="float">
+			</argument>
+			<description>
+				Returns the interpolated value at the given time (in seconds). The [code]track_idx[/code] must be the index of a value track.
+			</description>
+		</method>
 	</methods>
 	<members>
 		<member name="length" type="float" setter="set_length" getter="get_length" default="1.0">

+ 1 - 0
scene/resources/animation.cpp

@@ -2788,6 +2788,7 @@ void Animation::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("value_track_get_update_mode", "track_idx"), &Animation::value_track_get_update_mode);
 
 	ClassDB::bind_method(D_METHOD("value_track_get_key_indices", "track_idx", "time_sec", "delta"), &Animation::_value_track_get_key_indices);
+	ClassDB::bind_method(D_METHOD("value_track_interpolate", "track_idx", "time_sec"), &Animation::value_track_interpolate);
 
 	ClassDB::bind_method(D_METHOD("method_track_get_key_indices", "track_idx", "time_sec", "delta"), &Animation::_method_track_get_key_indices);
 	ClassDB::bind_method(D_METHOD("method_track_get_name", "track_idx", "key_idx"), &Animation::method_track_get_name);