|
29 | 29 | /*************************************************************************/ |
30 | 30 |
|
31 | 31 | #include "animation.h" |
32 | | -#include "scene/scene_string_names.h" |
33 | 32 |
|
34 | 33 | #include "core/math/geometry_3d.h" |
| 34 | +#include "scene/scene_string_names.h" |
35 | 35 |
|
36 | 36 | bool Animation::_set(const StringName &p_name, const Variant &p_value) { |
37 | 37 | String name = p_name; |
@@ -79,17 +79,16 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { |
79 | 79 | TransformTrack *tt = static_cast<TransformTrack *>(tracks[track]); |
80 | 80 | Vector<real_t> values = p_value; |
81 | 81 | int vcount = values.size(); |
82 | | - ERR_FAIL_COND_V(vcount % 12, false); // should be multiple of 12 |
| 82 | + ERR_FAIL_COND_V(vcount % TRANSFORM_TRACK_SIZE, false); |
83 | 83 |
|
84 | 84 | const real_t *r = values.ptr(); |
85 | 85 |
|
86 | | - int transform3d_size = (int)sizeof(Transform3D); |
87 | | - |
88 | | - tt->transforms.resize(vcount / transform3d_size); |
| 86 | + int64_t count = vcount / TRANSFORM_TRACK_SIZE; |
| 87 | + tt->transforms.resize(count); |
89 | 88 |
|
90 | | - for (int i = 0; i < (vcount / transform3d_size); i++) { |
| 89 | + for (int i = 0; i < count; i++) { |
91 | 90 | TKey<TransformKey> &tk = tt->transforms.write[i]; |
92 | | - const real_t *ofs = &r[i * 12]; |
| 91 | + const real_t *ofs = &r[i * TRANSFORM_TRACK_SIZE]; |
93 | 92 | tk.time = ofs[0]; |
94 | 93 | tk.transition = ofs[1]; |
95 | 94 |
|
@@ -356,7 +355,7 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { |
356 | 355 | if (track_get_type(track) == TYPE_TRANSFORM3D) { |
357 | 356 | Vector<real_t> keys; |
358 | 357 | int kk = track_get_key_count(track); |
359 | | - keys.resize(kk * sizeof(Transform3D)); |
| 358 | + keys.resize(kk * TRANSFORM_TRACK_SIZE); |
360 | 359 |
|
361 | 360 | real_t *w = keys.ptrw(); |
362 | 361 |
|
|
0 commit comments