mirror of
https://github.com/godotengine/godot.git
synced 2024-12-27 11:24:59 +08:00
Merge pull request #61972 from and-rad/confirm-insert
Fixed keying multiple animation tracks
This commit is contained in:
commit
2f9a074fb4
@ -4089,6 +4089,8 @@ void CanvasItemEditor::_button_tool_select(int p_index) {
|
||||
void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation, bool p_scale, bool p_on_existing) {
|
||||
const HashMap<Node *, Object *> &selection = editor_selection->get_selection();
|
||||
|
||||
AnimationTrackEditor *te = AnimationPlayerEditor::get_singleton()->get_track_editor();
|
||||
te->make_insert_queue();
|
||||
for (const KeyValue<Node *, Object *> &E : selection) {
|
||||
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E.key);
|
||||
if (!canvas_item || !canvas_item->is_visible_in_tree()) {
|
||||
@ -4103,13 +4105,13 @@ void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation,
|
||||
Node2D *n2d = Object::cast_to<Node2D>(canvas_item);
|
||||
|
||||
if (key_pos && p_location) {
|
||||
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(n2d, "position", n2d->get_position(), p_on_existing);
|
||||
te->insert_node_value_key(n2d, "position", n2d->get_position(), p_on_existing);
|
||||
}
|
||||
if (key_rot && p_rotation) {
|
||||
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(n2d, "rotation", n2d->get_rotation(), p_on_existing);
|
||||
te->insert_node_value_key(n2d, "rotation", n2d->get_rotation(), p_on_existing);
|
||||
}
|
||||
if (key_scale && p_scale) {
|
||||
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(n2d, "scale", n2d->get_scale(), p_on_existing);
|
||||
te->insert_node_value_key(n2d, "scale", n2d->get_scale(), p_on_existing);
|
||||
}
|
||||
|
||||
if (n2d->has_meta("_edit_bone_") && n2d->get_parent_item()) {
|
||||
@ -4135,13 +4137,13 @@ void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation,
|
||||
if (has_chain && ik_chain.size()) {
|
||||
for (Node2D *&F : ik_chain) {
|
||||
if (key_pos) {
|
||||
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(F, "position", F->get_position(), p_on_existing);
|
||||
te->insert_node_value_key(F, "position", F->get_position(), p_on_existing);
|
||||
}
|
||||
if (key_rot) {
|
||||
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(F, "rotation", F->get_rotation(), p_on_existing);
|
||||
te->insert_node_value_key(F, "rotation", F->get_rotation(), p_on_existing);
|
||||
}
|
||||
if (key_scale) {
|
||||
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(F, "scale", F->get_scale(), p_on_existing);
|
||||
te->insert_node_value_key(F, "scale", F->get_scale(), p_on_existing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4151,16 +4153,17 @@ void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation,
|
||||
Control *ctrl = Object::cast_to<Control>(canvas_item);
|
||||
|
||||
if (key_pos) {
|
||||
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(ctrl, "rect_position", ctrl->get_position(), p_on_existing);
|
||||
te->insert_node_value_key(ctrl, "rect_position", ctrl->get_position(), p_on_existing);
|
||||
}
|
||||
if (key_rot) {
|
||||
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(ctrl, "rect_rotation", ctrl->get_rotation(), p_on_existing);
|
||||
te->insert_node_value_key(ctrl, "rect_rotation", ctrl->get_rotation(), p_on_existing);
|
||||
}
|
||||
if (key_scale) {
|
||||
AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(ctrl, "rect_size", ctrl->get_size(), p_on_existing);
|
||||
te->insert_node_value_key(ctrl, "rect_size", ctrl->get_size(), p_on_existing);
|
||||
}
|
||||
}
|
||||
}
|
||||
te->commit_insert_queue();
|
||||
}
|
||||
|
||||
void CanvasItemEditor::_update_override_camera_button(bool p_game_running) {
|
||||
|
Loading…
Reference in New Issue
Block a user