| 4253 | } |
| 4254 | |
| 4255 | void AnimationTrackEditor::commit_insert_queue() { |
| 4256 | bool reset_allowed = true; |
| 4257 | AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player(); |
| 4258 | if (is_global_library_read_only() || (player->has_animation(SceneStringName(RESET)) && player->get_animation(SceneStringName(RESET)) == animation)) { |
| 4259 | // Avoid messing with the reset animation itself. |
| 4260 | reset_allowed = false; |
| 4261 | } else { |
| 4262 | bool some_resettable = false; |
| 4263 | for (const AnimationTrackEditor::InsertData &E : insert_data) { |
| 4264 | if (track_type_is_resettable(E.type)) { |
| 4265 | some_resettable = true; |
| 4266 | break; |
| 4267 | } |
| 4268 | } |
| 4269 | if (!some_resettable) { |
| 4270 | reset_allowed = false; |
| 4271 | } |
| 4272 | } |
| 4273 | |
| 4274 | // Organize insert data. |
| 4275 | int num_tracks = 0; |
| 4276 | String last_track_query; |
| 4277 | bool all_bezier = true; |
| 4278 | for (const AnimationTrackEditor::InsertData &E : insert_data) { |
| 4279 | if (E.type != Animation::TYPE_VALUE && E.type != Animation::TYPE_BEZIER) { |
| 4280 | all_bezier = false; |
| 4281 | } |
| 4282 | |
| 4283 | if (E.track_idx == -1) { |
| 4284 | ++num_tracks; |
| 4285 | last_track_query = E.query; |
| 4286 | } |
| 4287 | |
| 4288 | if (E.type != Animation::TYPE_VALUE) { |
| 4289 | continue; |
| 4290 | } |
| 4291 | |
| 4292 | switch (E.value.get_type()) { |
| 4293 | case Variant::INT: |
| 4294 | case Variant::FLOAT: |
| 4295 | case Variant::VECTOR2: |
| 4296 | case Variant::VECTOR3: |
| 4297 | case Variant::QUATERNION: |
| 4298 | case Variant::PLANE: |
| 4299 | case Variant::COLOR: { |
| 4300 | // Valid. |
| 4301 | } break; |
| 4302 | default: { |
| 4303 | all_bezier = false; |
| 4304 | } |
| 4305 | } |
| 4306 | } |
| 4307 | |
| 4308 | // Skip the confirmation dialog if the user holds Shift while clicking the key icon. |
| 4309 | // If `confirm_insert_track` editor setting is disabled, the behavior is reversed. |
| 4310 | bool confirm_insert = EDITOR_GET("editors/animation/confirm_insert_track"); |
| 4311 | if ((Input::get_singleton()->is_key_pressed(Key::SHIFT) != confirm_insert) && num_tracks > 0) { |
| 4312 | String dialog_text; |
no test coverage detected