animation_player.cpp 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289
  1. /*************************************************************************/
  2. /* animation_player.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #include "animation_player.h"
  31. #include "engine.h"
  32. #include "message_queue.h"
  33. #include "scene/scene_string_names.h"
  34. bool AnimationPlayer::_set(const StringName &p_name, const Variant &p_value) {
  35. String name = p_name;
  36. if (p_name == SceneStringNames::get_singleton()->playback_speed || p_name == SceneStringNames::get_singleton()->speed) { //bw compatibility
  37. set_speed_scale(p_value);
  38. } else if (p_name == SceneStringNames::get_singleton()->playback_active) {
  39. set_active(p_value);
  40. } else if (name.begins_with("playback/play")) {
  41. String which = p_value;
  42. if (which == "[stop]")
  43. stop();
  44. else
  45. play(which);
  46. } else if (name.begins_with("anims/")) {
  47. String which = name.get_slicec('/', 1);
  48. add_animation(which, p_value);
  49. } else if (name.begins_with("next/")) {
  50. String which = name.get_slicec('/', 1);
  51. animation_set_next(which, p_value);
  52. } else if (p_name == SceneStringNames::get_singleton()->blend_times) {
  53. Array array = p_value;
  54. int len = array.size();
  55. ERR_FAIL_COND_V(len % 3, false);
  56. for (int i = 0; i < len / 3; i++) {
  57. StringName from = array[i * 3 + 0];
  58. StringName to = array[i * 3 + 1];
  59. float time = array[i * 3 + 2];
  60. set_blend_time(from, to, time);
  61. }
  62. } else if (p_name == SceneStringNames::get_singleton()->autoplay) {
  63. autoplay = p_value;
  64. } else
  65. return false;
  66. return true;
  67. }
  68. bool AnimationPlayer::_get(const StringName &p_name, Variant &r_ret) const {
  69. String name = p_name;
  70. if (name == "playback/speed") { //bw compatibility
  71. r_ret = speed_scale;
  72. } else if (name == "playback/active") {
  73. r_ret = is_active();
  74. } else if (name == "playback/play") {
  75. if (is_active() && is_playing())
  76. r_ret = playback.assigned;
  77. else
  78. r_ret = "[stop]";
  79. } else if (name.begins_with("anims/")) {
  80. String which = name.get_slicec('/', 1);
  81. r_ret = get_animation(which).get_ref_ptr();
  82. } else if (name.begins_with("next/")) {
  83. String which = name.get_slicec('/', 1);
  84. r_ret = animation_get_next(which);
  85. } else if (name == "blend_times") {
  86. Vector<BlendKey> keys;
  87. for (Map<BlendKey, float>::Element *E = blend_times.front(); E; E = E->next()) {
  88. keys.ordered_insert(E->key());
  89. }
  90. Array array;
  91. for (int i = 0; i < keys.size(); i++) {
  92. array.push_back(keys[i].from);
  93. array.push_back(keys[i].to);
  94. array.push_back(blend_times[keys[i]]);
  95. }
  96. r_ret = array;
  97. } else if (name == "autoplay") {
  98. r_ret = autoplay;
  99. } else
  100. return false;
  101. return true;
  102. }
  103. void AnimationPlayer::_get_property_list(List<PropertyInfo> *p_list) const {
  104. List<String> names;
  105. List<PropertyInfo> anim_names;
  106. for (Map<StringName, AnimationData>::Element *E = animation_set.front(); E; E = E->next()) {
  107. anim_names.push_back(PropertyInfo(Variant::OBJECT, "anims/" + String(E->key()), PROPERTY_HINT_RESOURCE_TYPE, "Animation", PROPERTY_USAGE_NOEDITOR));
  108. if (E->get().next != StringName())
  109. anim_names.push_back(PropertyInfo(Variant::STRING, "next/" + String(E->key()), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
  110. names.push_back(E->key());
  111. }
  112. anim_names.sort();
  113. for (List<PropertyInfo>::Element *E = anim_names.front(); E; E = E->next()) {
  114. p_list->push_back(E->get());
  115. }
  116. {
  117. names.sort();
  118. names.push_front("[stop]");
  119. String hint;
  120. for (List<String>::Element *E = names.front(); E; E = E->next()) {
  121. if (E != names.front())
  122. hint += ",";
  123. hint += E->get();
  124. }
  125. p_list->push_back(PropertyInfo(Variant::STRING, "playback/play", PROPERTY_HINT_ENUM, hint, PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_ANIMATE_AS_TRIGGER));
  126. p_list->push_back(PropertyInfo(Variant::BOOL, "playback/active", PROPERTY_HINT_NONE, ""));
  127. p_list->push_back(PropertyInfo(Variant::REAL, "playback/speed", PROPERTY_HINT_RANGE, "-64,64,0.01"));
  128. }
  129. p_list->push_back(PropertyInfo(Variant::ARRAY, "blend_times", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
  130. p_list->push_back(PropertyInfo(Variant::STRING, "autoplay", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
  131. }
  132. void AnimationPlayer::advance(float p_time) {
  133. _animation_process(p_time);
  134. }
  135. void AnimationPlayer::_notification(int p_what) {
  136. switch (p_what) {
  137. case NOTIFICATION_ENTER_TREE: {
  138. if (!processing) {
  139. //make sure that a previous process state was not saved
  140. //only process if "processing" is set
  141. set_physics_process(false);
  142. set_process(false);
  143. }
  144. //_set_process(false);
  145. clear_caches();
  146. } break;
  147. case NOTIFICATION_READY: {
  148. if (!Engine::get_singleton()->is_editor_hint() && animation_set.has(autoplay)) {
  149. play(autoplay);
  150. _animation_process(0);
  151. }
  152. } break;
  153. case NOTIFICATION_INTERNAL_PROCESS: {
  154. if (animation_process_mode == ANIMATION_PROCESS_PHYSICS)
  155. break;
  156. if (processing)
  157. _animation_process(get_process_delta_time());
  158. } break;
  159. case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
  160. if (animation_process_mode == ANIMATION_PROCESS_IDLE)
  161. break;
  162. if (processing)
  163. _animation_process(get_physics_process_delta_time());
  164. } break;
  165. case NOTIFICATION_EXIT_TREE: {
  166. //stop_all();
  167. clear_caches();
  168. } break;
  169. }
  170. }
  171. void AnimationPlayer::_generate_node_caches(AnimationData *p_anim) {
  172. Node *parent = get_node(root);
  173. ERR_FAIL_COND(!parent);
  174. Animation *a = p_anim->animation.operator->();
  175. p_anim->node_cache.resize(a->get_track_count());
  176. for (int i = 0; i < a->get_track_count(); i++) {
  177. p_anim->node_cache[i] = NULL;
  178. RES resource;
  179. Node *child = parent->get_node_and_resource(a->track_get_path(i), resource);
  180. if (!child) {
  181. ERR_EXPLAIN("On Animation: '" + p_anim->name + "', couldn't resolve track: '" + String(a->track_get_path(i)) + "'");
  182. }
  183. ERR_CONTINUE(!child); // couldn't find the child node
  184. uint32_t id = resource.is_valid() ? resource->get_instance_id() : child->get_instance_id();
  185. int bone_idx = -1;
  186. if (a->track_get_path(i).get_property() && Object::cast_to<Skeleton>(child)) {
  187. bone_idx = Object::cast_to<Skeleton>(child)->find_bone(a->track_get_path(i).get_property());
  188. if (bone_idx == -1) {
  189. continue;
  190. }
  191. }
  192. {
  193. if (!child->is_connected("tree_exited", this, "_node_removed"))
  194. child->connect("tree_exited", this, "_node_removed", make_binds(child), CONNECT_ONESHOT);
  195. }
  196. TrackNodeCacheKey key;
  197. key.id = id;
  198. key.bone_idx = bone_idx;
  199. if (node_cache_map.has(key)) {
  200. p_anim->node_cache[i] = &node_cache_map[key];
  201. } else {
  202. node_cache_map[key] = TrackNodeCache();
  203. p_anim->node_cache[i] = &node_cache_map[key];
  204. p_anim->node_cache[i]->path = a->track_get_path(i);
  205. p_anim->node_cache[i]->node = child;
  206. p_anim->node_cache[i]->resource = resource;
  207. p_anim->node_cache[i]->node_2d = Object::cast_to<Node2D>(child);
  208. if (a->track_get_type(i) == Animation::TYPE_TRANSFORM) {
  209. // special cases and caches for transform tracks
  210. // cache spatial
  211. p_anim->node_cache[i]->spatial = Object::cast_to<Spatial>(child);
  212. // cache skeleton
  213. p_anim->node_cache[i]->skeleton = Object::cast_to<Skeleton>(child);
  214. if (p_anim->node_cache[i]->skeleton) {
  215. StringName bone_name = a->track_get_path(i).get_property();
  216. if (bone_name.operator String() != "") {
  217. p_anim->node_cache[i]->bone_idx = p_anim->node_cache[i]->skeleton->find_bone(bone_name);
  218. if (p_anim->node_cache[i]->bone_idx < 0) {
  219. // broken track (nonexistent bone)
  220. p_anim->node_cache[i]->skeleton = NULL;
  221. p_anim->node_cache[i]->spatial = NULL;
  222. printf("bone is %ls\n", String(bone_name).c_str());
  223. ERR_CONTINUE(p_anim->node_cache[i]->bone_idx < 0);
  224. } else {
  225. }
  226. } else {
  227. // no property, just use spatialnode
  228. p_anim->node_cache[i]->skeleton = NULL;
  229. }
  230. }
  231. }
  232. }
  233. if (a->track_get_type(i) == Animation::TYPE_VALUE) {
  234. StringName property = a->track_get_path(i).get_property();
  235. if (!p_anim->node_cache[i]->property_anim.has(property)) {
  236. TrackNodeCache::PropertyAnim pa;
  237. pa.prop = property;
  238. pa.object = resource.is_valid() ? (Object *)resource.ptr() : (Object *)child;
  239. pa.special = SP_NONE;
  240. pa.owner = p_anim->node_cache[i];
  241. if (false && p_anim->node_cache[i]->node_2d) {
  242. if (pa.prop == SceneStringNames::get_singleton()->transform_pos)
  243. pa.special = SP_NODE2D_POS;
  244. else if (pa.prop == SceneStringNames::get_singleton()->transform_rot)
  245. pa.special = SP_NODE2D_ROT;
  246. else if (pa.prop == SceneStringNames::get_singleton()->transform_scale)
  247. pa.special = SP_NODE2D_SCALE;
  248. }
  249. p_anim->node_cache[i]->property_anim[property] = pa;
  250. }
  251. }
  252. }
  253. }
  254. void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float p_time, float p_delta, float p_interp, bool p_allow_discrete) {
  255. if (p_anim->node_cache.size() != p_anim->animation->get_track_count()) {
  256. // animation hasn't been "node-cached"
  257. _generate_node_caches(p_anim);
  258. }
  259. ERR_FAIL_COND(p_anim->node_cache.size() != p_anim->animation->get_track_count());
  260. Animation *a = p_anim->animation.operator->();
  261. bool can_call = is_inside_tree() && !Engine::get_singleton()->is_editor_hint();
  262. for (int i = 0; i < a->get_track_count(); i++) {
  263. TrackNodeCache *nc = p_anim->node_cache[i];
  264. if (!nc) // no node cache for this track, skip it
  265. continue;
  266. if (a->track_get_key_count(i) == 0)
  267. continue; // do nothing if track is empty
  268. switch (a->track_get_type(i)) {
  269. case Animation::TYPE_TRANSFORM: {
  270. if (!nc->spatial)
  271. continue;
  272. Vector3 loc;
  273. Quat rot;
  274. Vector3 scale;
  275. Error err = a->transform_track_interpolate(i, p_time, &loc, &rot, &scale);
  276. //ERR_CONTINUE(err!=OK); //used for testing, should be removed
  277. if (err != OK)
  278. continue;
  279. if (nc->accum_pass != accum_pass) {
  280. ERR_CONTINUE(cache_update_size >= NODE_CACHE_UPDATE_MAX);
  281. cache_update[cache_update_size++] = nc;
  282. nc->accum_pass = accum_pass;
  283. nc->loc_accum = loc;
  284. nc->rot_accum = rot;
  285. nc->scale_accum = scale;
  286. } else {
  287. nc->loc_accum = nc->loc_accum.linear_interpolate(loc, p_interp);
  288. nc->rot_accum = nc->rot_accum.slerp(rot, p_interp);
  289. nc->scale_accum = nc->scale_accum.linear_interpolate(scale, p_interp);
  290. }
  291. } break;
  292. case Animation::TYPE_VALUE: {
  293. if (!nc->node)
  294. continue;
  295. //StringName property=a->track_get_path(i).get_property();
  296. Map<StringName, TrackNodeCache::PropertyAnim>::Element *E = nc->property_anim.find(a->track_get_path(i).get_property());
  297. ERR_CONTINUE(!E); //should it continue, or create a new one?
  298. TrackNodeCache::PropertyAnim *pa = &E->get();
  299. if (a->value_track_get_update_mode(i) == Animation::UPDATE_CONTINUOUS || (p_delta == 0 && a->value_track_get_update_mode(i) == Animation::UPDATE_DISCRETE)) { //delta == 0 means seek
  300. Variant value = a->value_track_interpolate(i, p_time);
  301. if (value == Variant())
  302. continue;
  303. //thanks to trigger mode, this should be solved now..
  304. /*
  305. if (p_delta==0 && value.get_type()==Variant::STRING)
  306. continue; // doing this with strings is messy, should find another way
  307. */
  308. if (pa->accum_pass != accum_pass) {
  309. ERR_CONTINUE(cache_update_prop_size >= NODE_CACHE_UPDATE_MAX);
  310. cache_update_prop[cache_update_prop_size++] = pa;
  311. pa->value_accum = value;
  312. pa->accum_pass = accum_pass;
  313. } else {
  314. Variant::interpolate(pa->value_accum, value, p_interp, pa->value_accum);
  315. }
  316. } else if (p_allow_discrete && p_delta != 0) {
  317. List<int> indices;
  318. a->value_track_get_key_indices(i, p_time, p_delta, &indices);
  319. for (List<int>::Element *F = indices.front(); F; F = F->next()) {
  320. Variant value = a->track_get_key_value(i, F->get());
  321. switch (pa->special) {
  322. case SP_NONE: {
  323. bool valid;
  324. pa->object->set(pa->prop, value, &valid); //you are not speshul
  325. #ifdef DEBUG_ENABLED
  326. if (!valid) {
  327. ERR_PRINTS("Failed setting track value '" + String(pa->owner->path) + "'. Check if property exists or the type of key is valid. Animation '" + a->get_name() + "' at node '" + get_path() + "'.");
  328. }
  329. #endif
  330. } break;
  331. case SP_NODE2D_POS: {
  332. #ifdef DEBUG_ENABLED
  333. if (value.get_type() != Variant::VECTOR2) {
  334. ERR_PRINTS("Position key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2(). Animation '" + a->get_name() + "' at node '" + get_path() + "'.");
  335. }
  336. #endif
  337. static_cast<Node2D *>(pa->object)->set_position(value);
  338. } break;
  339. case SP_NODE2D_ROT: {
  340. #ifdef DEBUG_ENABLED
  341. if (value.is_num()) {
  342. ERR_PRINTS("Rotation key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not numerical. Animation '" + a->get_name() + "' at node '" + get_path() + "'.");
  343. }
  344. #endif
  345. static_cast<Node2D *>(pa->object)->set_rotation(Math::deg2rad((double)value));
  346. } break;
  347. case SP_NODE2D_SCALE: {
  348. #ifdef DEBUG_ENABLED
  349. if (value.get_type() != Variant::VECTOR2) {
  350. ERR_PRINTS("Scale key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()." + a->get_name() + "' at node '" + get_path() + "'.");
  351. }
  352. #endif
  353. static_cast<Node2D *>(pa->object)->set_scale(value);
  354. } break;
  355. }
  356. }
  357. }
  358. } break;
  359. case Animation::TYPE_METHOD: {
  360. if (!nc->node)
  361. continue;
  362. if (p_delta == 0)
  363. continue;
  364. if (!p_allow_discrete)
  365. break;
  366. List<int> indices;
  367. a->method_track_get_key_indices(i, p_time, p_delta, &indices);
  368. for (List<int>::Element *E = indices.front(); E; E = E->next()) {
  369. StringName method = a->method_track_get_name(i, E->get());
  370. Vector<Variant> params = a->method_track_get_params(i, E->get());
  371. int s = params.size();
  372. ERR_CONTINUE(s > VARIANT_ARG_MAX);
  373. if (can_call) {
  374. MessageQueue::get_singleton()->push_call(
  375. nc->node,
  376. method,
  377. s >= 1 ? params[0] : Variant(),
  378. s >= 2 ? params[1] : Variant(),
  379. s >= 3 ? params[2] : Variant(),
  380. s >= 4 ? params[3] : Variant(),
  381. s >= 5 ? params[4] : Variant());
  382. }
  383. }
  384. } break;
  385. }
  386. }
  387. }
  388. void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, float p_blend) {
  389. float delta = p_delta * speed_scale * cd.speed_scale;
  390. bool backwards = delta < 0;
  391. float next_pos = cd.pos + delta;
  392. float len = cd.from->animation->get_length();
  393. bool loop = cd.from->animation->has_loop();
  394. if (!loop) {
  395. if (next_pos < 0)
  396. next_pos = 0;
  397. else if (next_pos > len)
  398. next_pos = len;
  399. // fix delta
  400. delta = next_pos - cd.pos;
  401. if (&cd == &playback.current) {
  402. if (!backwards && cd.pos <= len && next_pos == len /*&& playback.blend.empty()*/) {
  403. //playback finished
  404. end_notify = true;
  405. }
  406. if (backwards && cd.pos >= 0 && next_pos == 0 /*&& playback.blend.empty()*/) {
  407. //playback finished
  408. end_notify = true;
  409. }
  410. }
  411. } else {
  412. next_pos = Math::fposmod(next_pos, len);
  413. }
  414. cd.pos = next_pos;
  415. _animation_process_animation(cd.from, cd.pos, delta, p_blend, &cd == &playback.current);
  416. }
  417. void AnimationPlayer::_animation_process2(float p_delta) {
  418. Playback &c = playback;
  419. accum_pass++;
  420. _animation_process_data(c.current, p_delta, 1.0f);
  421. List<Blend>::Element *prev = NULL;
  422. for (List<Blend>::Element *E = c.blend.back(); E; E = prev) {
  423. Blend &b = E->get();
  424. float blend = b.blend_left / b.blend_time;
  425. _animation_process_data(b.data, p_delta, blend);
  426. b.blend_left -= Math::absf(speed_scale * p_delta);
  427. prev = E->prev();
  428. if (b.blend_left < 0) {
  429. c.blend.erase(E);
  430. }
  431. }
  432. }
  433. void AnimationPlayer::_animation_update_transforms() {
  434. for (int i = 0; i < cache_update_size; i++) {
  435. TrackNodeCache *nc = cache_update[i];
  436. ERR_CONTINUE(nc->accum_pass != accum_pass);
  437. if (nc->spatial) {
  438. Transform t;
  439. t.origin = nc->loc_accum;
  440. t.basis = nc->rot_accum;
  441. t.basis.scale(nc->scale_accum);
  442. if (nc->skeleton && nc->bone_idx >= 0) {
  443. nc->skeleton->set_bone_pose(nc->bone_idx, t);
  444. } else if (nc->spatial) {
  445. nc->spatial->set_transform(t);
  446. }
  447. }
  448. }
  449. cache_update_size = 0;
  450. for (int i = 0; i < cache_update_prop_size; i++) {
  451. TrackNodeCache::PropertyAnim *pa = cache_update_prop[i];
  452. ERR_CONTINUE(pa->accum_pass != accum_pass);
  453. switch (pa->special) {
  454. case SP_NONE: {
  455. bool valid;
  456. pa->object->set(pa->prop, pa->value_accum, &valid); //you are not speshul
  457. #ifdef DEBUG_ENABLED
  458. if (!valid) {
  459. ERR_PRINTS("Failed setting key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "'. Check if property exists or the type of key is right for the property");
  460. }
  461. #endif
  462. } break;
  463. case SP_NODE2D_POS: {
  464. #ifdef DEBUG_ENABLED
  465. if (pa->value_accum.get_type() != Variant::VECTOR2) {
  466. ERR_PRINTS("Position key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()");
  467. }
  468. #endif
  469. static_cast<Node2D *>(pa->object)->set_position(pa->value_accum);
  470. } break;
  471. case SP_NODE2D_ROT: {
  472. #ifdef DEBUG_ENABLED
  473. if (pa->value_accum.is_num()) {
  474. ERR_PRINTS("Rotation key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not numerical");
  475. }
  476. #endif
  477. static_cast<Node2D *>(pa->object)->set_rotation(Math::deg2rad((double)pa->value_accum));
  478. } break;
  479. case SP_NODE2D_SCALE: {
  480. #ifdef DEBUG_ENABLED
  481. if (pa->value_accum.get_type() != Variant::VECTOR2) {
  482. ERR_PRINTS("Scale key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()");
  483. }
  484. #endif
  485. static_cast<Node2D *>(pa->object)->set_scale(pa->value_accum);
  486. } break;
  487. }
  488. }
  489. cache_update_prop_size = 0;
  490. }
  491. void AnimationPlayer::_animation_process(float p_delta) {
  492. if (playback.current.from) {
  493. end_notify = false;
  494. _animation_process2(p_delta);
  495. _animation_update_transforms();
  496. if (end_notify) {
  497. if (queued.size()) {
  498. String old = playback.assigned;
  499. play(queued.front()->get());
  500. String new_name = playback.assigned;
  501. queued.pop_front();
  502. end_notify = false;
  503. emit_signal(SceneStringNames::get_singleton()->animation_changed, old, new_name);
  504. } else {
  505. //stop();
  506. playing = false;
  507. _set_process(false);
  508. end_notify = false;
  509. emit_signal(SceneStringNames::get_singleton()->animation_finished, playback.assigned);
  510. }
  511. }
  512. } else {
  513. _set_process(false);
  514. }
  515. }
  516. Error AnimationPlayer::add_animation(const StringName &p_name, const Ref<Animation> &p_animation) {
  517. #ifdef DEBUG_ENABLED
  518. ERR_EXPLAIN("Invalid animation name: " + String(p_name));
  519. ERR_FAIL_COND_V(String(p_name).find("/") != -1 || String(p_name).find(":") != -1 || String(p_name).find(",") != -1 || String(p_name).find("[") != -1, ERR_INVALID_PARAMETER);
  520. #endif
  521. ERR_FAIL_COND_V(p_animation.is_null(), ERR_INVALID_PARAMETER);
  522. //print_line("Add anim: "+String(p_name)+" name: "+p_animation->get_name());
  523. if (animation_set.has(p_name)) {
  524. _unref_anim(animation_set[p_name].animation);
  525. animation_set[p_name].animation = p_animation;
  526. clear_caches();
  527. } else {
  528. AnimationData ad;
  529. ad.animation = p_animation;
  530. ad.name = p_name;
  531. animation_set[p_name] = ad;
  532. }
  533. _ref_anim(p_animation);
  534. _change_notify();
  535. return OK;
  536. }
  537. void AnimationPlayer::remove_animation(const StringName &p_name) {
  538. ERR_FAIL_COND(!animation_set.has(p_name));
  539. stop_all();
  540. _unref_anim(animation_set[p_name].animation);
  541. animation_set.erase(p_name);
  542. clear_caches();
  543. _change_notify();
  544. }
  545. void AnimationPlayer::_ref_anim(const Ref<Animation> &p_anim) {
  546. if (used_anims.has(p_anim))
  547. used_anims[p_anim]++;
  548. else {
  549. used_anims[p_anim] = 1;
  550. Ref<Animation>(p_anim)->connect("changed", this, "_animation_changed");
  551. }
  552. }
  553. void AnimationPlayer::_unref_anim(const Ref<Animation> &p_anim) {
  554. ERR_FAIL_COND(!used_anims.has(p_anim));
  555. int &n = used_anims[p_anim];
  556. n--;
  557. if (n == 0) {
  558. Ref<Animation>(p_anim)->disconnect("changed", this, "_animation_changed");
  559. used_anims.erase(p_anim);
  560. }
  561. }
  562. void AnimationPlayer::rename_animation(const StringName &p_name, const StringName &p_new_name) {
  563. ERR_FAIL_COND(!animation_set.has(p_name));
  564. ERR_FAIL_COND(String(p_new_name).find("/") != -1 || String(p_new_name).find(":") != -1);
  565. ERR_FAIL_COND(animation_set.has(p_new_name));
  566. //print_line("Rename anim: "+String(p_name)+" name: "+String(p_new_name));
  567. stop_all();
  568. AnimationData ad = animation_set[p_name];
  569. ad.name = p_new_name;
  570. animation_set.erase(p_name);
  571. animation_set[p_new_name] = ad;
  572. List<BlendKey> to_erase;
  573. Map<BlendKey, float> to_insert;
  574. for (Map<BlendKey, float>::Element *E = blend_times.front(); E; E = E->next()) {
  575. BlendKey bk = E->key();
  576. BlendKey new_bk = bk;
  577. bool erase = false;
  578. if (bk.from == p_name) {
  579. new_bk.from = p_new_name;
  580. erase = true;
  581. }
  582. if (bk.to == p_name) {
  583. new_bk.to = p_new_name;
  584. erase = true;
  585. }
  586. if (erase) {
  587. to_erase.push_back(bk);
  588. to_insert[new_bk] = E->get();
  589. }
  590. }
  591. while (to_erase.size()) {
  592. blend_times.erase(to_erase.front()->get());
  593. to_erase.pop_front();
  594. }
  595. while (to_insert.size()) {
  596. blend_times[to_insert.front()->key()] = to_insert.front()->get();
  597. to_insert.erase(to_insert.front());
  598. }
  599. if (autoplay == p_name)
  600. autoplay = p_new_name;
  601. clear_caches();
  602. _change_notify();
  603. }
  604. bool AnimationPlayer::has_animation(const StringName &p_name) const {
  605. return animation_set.has(p_name);
  606. }
  607. Ref<Animation> AnimationPlayer::get_animation(const StringName &p_name) const {
  608. ERR_FAIL_COND_V(!animation_set.has(p_name), Ref<Animation>());
  609. const AnimationData &data = animation_set[p_name];
  610. return data.animation;
  611. }
  612. void AnimationPlayer::get_animation_list(List<StringName> *p_animations) const {
  613. List<String> anims;
  614. for (Map<StringName, AnimationData>::Element *E = animation_set.front(); E; E = E->next()) {
  615. anims.push_back(E->key());
  616. }
  617. anims.sort();
  618. for (List<String>::Element *E = anims.front(); E; E = E->next()) {
  619. p_animations->push_back(E->get());
  620. }
  621. }
  622. void AnimationPlayer::set_blend_time(const StringName &p_animation1, const StringName &p_animation2, float p_time) {
  623. ERR_FAIL_COND(p_time < 0);
  624. BlendKey bk;
  625. bk.from = p_animation1;
  626. bk.to = p_animation2;
  627. if (p_time == 0)
  628. blend_times.erase(bk);
  629. else
  630. blend_times[bk] = p_time;
  631. }
  632. float AnimationPlayer::get_blend_time(const StringName &p_animation1, const StringName &p_animation2) const {
  633. BlendKey bk;
  634. bk.from = p_animation1;
  635. bk.to = p_animation2;
  636. if (blend_times.has(bk))
  637. return blend_times[bk];
  638. else
  639. return 0;
  640. }
  641. void AnimationPlayer::queue(const StringName &p_name) {
  642. if (!is_playing())
  643. play(p_name);
  644. else
  645. queued.push_back(p_name);
  646. }
  647. void AnimationPlayer::clear_queue() {
  648. queued.clear();
  649. };
  650. void AnimationPlayer::play_backwards(const StringName &p_name, float p_custom_blend) {
  651. play(p_name, p_custom_blend, -1, true);
  652. }
  653. void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float p_custom_scale, bool p_from_end) {
  654. //printf("animation is %ls\n", String(p_name).c_str());
  655. //ERR_FAIL_COND(!is_inside_scene());
  656. StringName name = p_name;
  657. if (String(name) == "")
  658. name = playback.assigned;
  659. if (!animation_set.has(name)) {
  660. ERR_EXPLAIN("Animation not found: " + name);
  661. ERR_FAIL();
  662. }
  663. Playback &c = playback;
  664. if (c.current.from) {
  665. float blend_time = 0;
  666. // find if it can blend
  667. BlendKey bk;
  668. bk.from = c.current.from->name;
  669. bk.to = name;
  670. if (p_custom_blend >= 0) {
  671. blend_time = p_custom_blend;
  672. } else if (blend_times.has(bk)) {
  673. blend_time = blend_times[bk];
  674. } else {
  675. bk.from = "*";
  676. if (blend_times.has(bk)) {
  677. blend_time = blend_times[bk];
  678. } else {
  679. bk.from = c.current.from->name;
  680. bk.to = "*";
  681. if (blend_times.has(bk)) {
  682. blend_time = blend_times[bk];
  683. }
  684. }
  685. }
  686. if (p_custom_blend < 0 && blend_time == 0 && default_blend_time)
  687. blend_time = default_blend_time;
  688. if (blend_time > 0) {
  689. Blend b;
  690. b.data = c.current;
  691. b.blend_time = b.blend_left = blend_time;
  692. c.blend.push_back(b);
  693. }
  694. }
  695. c.current.from = &animation_set[name];
  696. c.current.pos = p_from_end ? c.current.from->animation->get_length() : 0;
  697. c.current.speed_scale = p_custom_scale;
  698. c.assigned = p_name;
  699. if (!end_notify)
  700. queued.clear();
  701. _set_process(true); // always process when starting an animation
  702. playing = true;
  703. emit_signal(SceneStringNames::get_singleton()->animation_started, c.assigned);
  704. if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
  705. return; // no next in this case
  706. StringName next = animation_get_next(p_name);
  707. if (next != StringName() && animation_set.has(next)) {
  708. queue(next);
  709. }
  710. }
  711. bool AnimationPlayer::is_playing() const {
  712. return playing;
  713. /*
  714. if (playback.current.from==NULL)
  715. return false;
  716. float len=playback.current.from->animation->get_length();
  717. float pos = playback.current.pos;
  718. bool loop=playback.current.from->animation->has_loop();
  719. if (!loop && pos >= len) {
  720. return false;
  721. };
  722. return true;
  723. */
  724. }
  725. void AnimationPlayer::set_current_animation(const String &p_anim) {
  726. if (is_playing()) {
  727. play(p_anim);
  728. } else {
  729. ERR_FAIL_COND(!animation_set.has(p_anim));
  730. playback.current.pos = 0;
  731. playback.current.from = &animation_set[p_anim];
  732. playback.assigned = p_anim;
  733. }
  734. }
  735. String AnimationPlayer::get_current_animation() const {
  736. return (playback.assigned);
  737. }
  738. void AnimationPlayer::stop(bool p_reset) {
  739. Playback &c = playback;
  740. c.blend.clear();
  741. if (p_reset) {
  742. c.current.from = NULL;
  743. }
  744. _set_process(false);
  745. queued.clear();
  746. playing = false;
  747. }
  748. void AnimationPlayer::stop_all() {
  749. stop();
  750. _set_process(false); // always process when starting an animation
  751. }
  752. void AnimationPlayer::set_speed_scale(float p_speed) {
  753. speed_scale = p_speed;
  754. }
  755. float AnimationPlayer::get_speed_scale() const {
  756. return speed_scale;
  757. }
  758. void AnimationPlayer::seek(float p_time, bool p_update) {
  759. if (!playback.current.from) {
  760. if (playback.assigned)
  761. set_current_animation(playback.assigned);
  762. ERR_FAIL_COND(!playback.current.from);
  763. }
  764. playback.current.pos = p_time;
  765. if (p_update) {
  766. _animation_process(0);
  767. }
  768. }
  769. void AnimationPlayer::seek_delta(float p_time, float p_delta) {
  770. if (!playback.current.from) {
  771. if (playback.assigned)
  772. set_current_animation(playback.assigned);
  773. ERR_FAIL_COND(!playback.current.from);
  774. }
  775. playback.current.pos = p_time - p_delta;
  776. if (speed_scale != 0.0)
  777. p_delta /= speed_scale;
  778. _animation_process(p_delta);
  779. //playback.current.pos=p_time;
  780. }
  781. bool AnimationPlayer::is_valid() const {
  782. return (playback.current.from);
  783. }
  784. float AnimationPlayer::get_current_animation_position() const {
  785. ERR_FAIL_COND_V(!playback.current.from, 0);
  786. return playback.current.pos;
  787. }
  788. float AnimationPlayer::get_current_animation_length() const {
  789. ERR_FAIL_COND_V(!playback.current.from, 0);
  790. return playback.current.from->animation->get_length();
  791. }
  792. void AnimationPlayer::_animation_changed() {
  793. clear_caches();
  794. }
  795. void AnimationPlayer::_node_removed(Node *p_node) {
  796. clear_caches(); // nodes contained here ar being removed, clear the caches
  797. }
  798. void AnimationPlayer::clear_caches() {
  799. node_cache_map.clear();
  800. for (Map<StringName, AnimationData>::Element *E = animation_set.front(); E; E = E->next()) {
  801. E->get().node_cache.clear();
  802. }
  803. cache_update_size = 0;
  804. cache_update_prop_size = 0;
  805. }
  806. void AnimationPlayer::set_active(bool p_active) {
  807. if (active == p_active)
  808. return;
  809. active = p_active;
  810. _set_process(processing, true);
  811. }
  812. bool AnimationPlayer::is_active() const {
  813. return active;
  814. }
  815. StringName AnimationPlayer::find_animation(const Ref<Animation> &p_animation) const {
  816. for (Map<StringName, AnimationData>::Element *E = animation_set.front(); E; E = E->next()) {
  817. if (E->get().animation == p_animation)
  818. return E->key();
  819. }
  820. return "";
  821. }
  822. void AnimationPlayer::set_autoplay(const String &p_name) {
  823. autoplay = p_name;
  824. }
  825. String AnimationPlayer::get_autoplay() const {
  826. return autoplay;
  827. }
  828. void AnimationPlayer::set_animation_process_mode(AnimationProcessMode p_mode) {
  829. if (animation_process_mode == p_mode)
  830. return;
  831. bool pr = processing;
  832. if (pr)
  833. _set_process(false);
  834. animation_process_mode = p_mode;
  835. if (pr)
  836. _set_process(true);
  837. }
  838. AnimationPlayer::AnimationProcessMode AnimationPlayer::get_animation_process_mode() const {
  839. return animation_process_mode;
  840. }
  841. void AnimationPlayer::_set_process(bool p_process, bool p_force) {
  842. if (processing == p_process && !p_force)
  843. return;
  844. switch (animation_process_mode) {
  845. case ANIMATION_PROCESS_PHYSICS: set_physics_process_internal(p_process && active); break;
  846. case ANIMATION_PROCESS_IDLE: set_process_internal(p_process && active); break;
  847. }
  848. processing = p_process;
  849. }
  850. void AnimationPlayer::animation_set_next(const StringName &p_animation, const StringName &p_next) {
  851. ERR_FAIL_COND(!animation_set.has(p_animation));
  852. animation_set[p_animation].next = p_next;
  853. }
  854. StringName AnimationPlayer::animation_get_next(const StringName &p_animation) const {
  855. if (!animation_set.has(p_animation))
  856. return StringName();
  857. return animation_set[p_animation].next;
  858. }
  859. void AnimationPlayer::set_default_blend_time(float p_default) {
  860. default_blend_time = p_default;
  861. }
  862. float AnimationPlayer::get_default_blend_time() const {
  863. return default_blend_time;
  864. }
  865. void AnimationPlayer::set_root(const NodePath &p_root) {
  866. root = p_root;
  867. clear_caches();
  868. }
  869. NodePath AnimationPlayer::get_root() const {
  870. return root;
  871. }
  872. void AnimationPlayer::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
  873. String pf = p_function;
  874. if (p_function == "play" || p_function == "remove_animation" || p_function == "has_animation" || p_function == "queue") {
  875. List<StringName> al;
  876. get_animation_list(&al);
  877. for (List<StringName>::Element *E = al.front(); E; E = E->next()) {
  878. r_options->push_back("\"" + String(E->get()) + "\"");
  879. }
  880. }
  881. Node::get_argument_options(p_function, p_idx, r_options);
  882. }
  883. void AnimationPlayer::_bind_methods() {
  884. ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationPlayer::_node_removed);
  885. ClassDB::bind_method(D_METHOD("_animation_changed"), &AnimationPlayer::_animation_changed);
  886. ClassDB::bind_method(D_METHOD("add_animation", "name", "animation"), &AnimationPlayer::add_animation);
  887. ClassDB::bind_method(D_METHOD("remove_animation", "name"), &AnimationPlayer::remove_animation);
  888. ClassDB::bind_method(D_METHOD("rename_animation", "name", "newname"), &AnimationPlayer::rename_animation);
  889. ClassDB::bind_method(D_METHOD("has_animation", "name"), &AnimationPlayer::has_animation);
  890. ClassDB::bind_method(D_METHOD("get_animation", "name"), &AnimationPlayer::get_animation);
  891. ClassDB::bind_method(D_METHOD("get_animation_list"), &AnimationPlayer::_get_animation_list);
  892. ClassDB::bind_method(D_METHOD("animation_set_next", "anim_from", "anim_to"), &AnimationPlayer::animation_set_next);
  893. ClassDB::bind_method(D_METHOD("animation_get_next", "anim_from"), &AnimationPlayer::animation_get_next);
  894. ClassDB::bind_method(D_METHOD("set_blend_time", "anim_from", "anim_to", "sec"), &AnimationPlayer::set_blend_time);
  895. ClassDB::bind_method(D_METHOD("get_blend_time", "anim_from", "anim_to"), &AnimationPlayer::get_blend_time);
  896. ClassDB::bind_method(D_METHOD("set_default_blend_time", "sec"), &AnimationPlayer::set_default_blend_time);
  897. ClassDB::bind_method(D_METHOD("get_default_blend_time"), &AnimationPlayer::get_default_blend_time);
  898. ClassDB::bind_method(D_METHOD("play", "name", "custom_blend", "custom_speed", "from_end"), &AnimationPlayer::play, DEFVAL(""), DEFVAL(-1), DEFVAL(1.0), DEFVAL(false));
  899. ClassDB::bind_method(D_METHOD("play_backwards", "name", "custom_blend"), &AnimationPlayer::play_backwards, DEFVAL(""), DEFVAL(-1));
  900. ClassDB::bind_method(D_METHOD("stop", "reset"), &AnimationPlayer::stop, DEFVAL(true));
  901. ClassDB::bind_method(D_METHOD("stop_all"), &AnimationPlayer::stop_all);
  902. ClassDB::bind_method(D_METHOD("is_playing"), &AnimationPlayer::is_playing);
  903. ClassDB::bind_method(D_METHOD("set_current_animation", "anim"), &AnimationPlayer::set_current_animation);
  904. ClassDB::bind_method(D_METHOD("get_current_animation"), &AnimationPlayer::get_current_animation);
  905. ClassDB::bind_method(D_METHOD("queue", "name"), &AnimationPlayer::queue);
  906. ClassDB::bind_method(D_METHOD("clear_queue"), &AnimationPlayer::clear_queue);
  907. ClassDB::bind_method(D_METHOD("set_active", "active"), &AnimationPlayer::set_active);
  908. ClassDB::bind_method(D_METHOD("is_active"), &AnimationPlayer::is_active);
  909. ClassDB::bind_method(D_METHOD("set_speed_scale", "speed"), &AnimationPlayer::set_speed_scale);
  910. ClassDB::bind_method(D_METHOD("get_speed_scale"), &AnimationPlayer::get_speed_scale);
  911. ClassDB::bind_method(D_METHOD("set_autoplay", "name"), &AnimationPlayer::set_autoplay);
  912. ClassDB::bind_method(D_METHOD("get_autoplay"), &AnimationPlayer::get_autoplay);
  913. ClassDB::bind_method(D_METHOD("set_root", "path"), &AnimationPlayer::set_root);
  914. ClassDB::bind_method(D_METHOD("get_root"), &AnimationPlayer::get_root);
  915. ClassDB::bind_method(D_METHOD("seek", "seconds", "update"), &AnimationPlayer::seek, DEFVAL(false));
  916. ClassDB::bind_method(D_METHOD("get_position"), &AnimationPlayer::get_current_animation_position);
  917. ClassDB::bind_method(D_METHOD("find_animation", "animation"), &AnimationPlayer::find_animation);
  918. ClassDB::bind_method(D_METHOD("clear_caches"), &AnimationPlayer::clear_caches);
  919. ClassDB::bind_method(D_METHOD("set_animation_process_mode", "mode"), &AnimationPlayer::set_animation_process_mode);
  920. ClassDB::bind_method(D_METHOD("get_animation_process_mode"), &AnimationPlayer::get_animation_process_mode);
  921. ClassDB::bind_method(D_METHOD("get_current_animation_position"), &AnimationPlayer::get_current_animation_position);
  922. ClassDB::bind_method(D_METHOD("get_current_animation_length"), &AnimationPlayer::get_current_animation_length);
  923. ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationPlayer::advance);
  924. ADD_GROUP("Playback Options", "playback_");
  925. ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_animation_process_mode", "get_animation_process_mode");
  926. ADD_PROPERTY(PropertyInfo(Variant::REAL, "playback_default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_default_blend_time", "get_default_blend_time");
  927. ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "root_node"), "set_root", "get_root");
  928. ADD_SIGNAL(MethodInfo("animation_finished", PropertyInfo(Variant::STRING, "name")));
  929. ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING, "old_name"), PropertyInfo(Variant::STRING, "new_name")));
  930. ADD_SIGNAL(MethodInfo("animation_started", PropertyInfo(Variant::STRING, "name")));
  931. BIND_ENUM_CONSTANT(ANIMATION_PROCESS_PHYSICS);
  932. BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE);
  933. }
  934. AnimationPlayer::AnimationPlayer() {
  935. accum_pass = 1;
  936. cache_update_size = 0;
  937. cache_update_prop_size = 0;
  938. speed_scale = 1;
  939. end_notify = false;
  940. animation_process_mode = ANIMATION_PROCESS_IDLE;
  941. processing = false;
  942. default_blend_time = 0;
  943. root = SceneStringNames::get_singleton()->path_pp;
  944. playing = false;
  945. active = true;
  946. }
  947. AnimationPlayer::~AnimationPlayer() {
  948. }