Show a warning that an animation must be selected in order to edit it. Avoid copying/pasting if no anim selected. Closes #5799
This commit is contained in:
parent
f51a816253
commit
12472534ec
@ -4075,12 +4075,22 @@ AnimationKeyEditor::AnimationKeyEditor() {
|
|||||||
track_editor->set_h_size_flags(SIZE_EXPAND_FILL);
|
track_editor->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
track_pos = memnew( Control );
|
track_pos = memnew( Control );
|
||||||
track_pos->set_area_as_parent_rect();
|
track_pos->set_area_as_parent_rect();
|
||||||
track_pos->set_ignore_mouse(true);
|
track_pos->set_ignore_mouse(true);
|
||||||
track_editor->add_child(track_pos);
|
track_editor->add_child(track_pos);
|
||||||
track_pos->connect("draw",this,"_track_pos_draw");
|
track_pos->connect("draw",this,"_track_pos_draw");
|
||||||
|
|
||||||
|
select_anim_warning = memnew( Label );
|
||||||
|
track_editor->add_child(select_anim_warning);
|
||||||
|
select_anim_warning->set_area_as_parent_rect();
|
||||||
|
select_anim_warning->set_text(TTR("Select an AnimationPlayer from the Scene Tree to edit animations."));
|
||||||
|
select_anim_warning->set_autowrap(true);
|
||||||
|
select_anim_warning->set_align(Label::ALIGN_CENTER);
|
||||||
|
select_anim_warning->set_valign(Label::VALIGN_CENTER);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
v_scroll = memnew( VScrollBar );
|
v_scroll = memnew( VScrollBar );
|
||||||
hb->add_child(v_scroll);
|
hb->add_child(v_scroll);
|
||||||
|
@ -268,6 +268,7 @@ class AnimationKeyEditor : public VBoxContainer {
|
|||||||
|
|
||||||
EditorSelection *editor_selection;
|
EditorSelection *editor_selection;
|
||||||
|
|
||||||
|
Label *select_anim_warning;
|
||||||
|
|
||||||
|
|
||||||
float _get_zoom_scale() const;
|
float _get_zoom_scale() const;
|
||||||
@ -343,6 +344,7 @@ public:
|
|||||||
void insert_value_key(const String& p_property, const Variant& p_value, bool p_advance);
|
void insert_value_key(const String& p_property, const Variant& p_value, bool p_advance);
|
||||||
void insert_transform_key(Spatial *p_node,const String& p_sub,const Transform& p_xform);
|
void insert_transform_key(Spatial *p_node,const String& p_sub,const Transform& p_xform);
|
||||||
|
|
||||||
|
void show_select_node_warning(bool p_show) { select_anim_warning->set_hidden(!p_show); }
|
||||||
AnimationKeyEditor();
|
AnimationKeyEditor();
|
||||||
~AnimationKeyEditor();
|
~AnimationKeyEditor();
|
||||||
};
|
};
|
||||||
|
@ -43,6 +43,7 @@ void AnimationPlayerEditor::_node_removed(Node *p_node) {
|
|||||||
|
|
||||||
key_editor->set_animation(Ref<Animation>());
|
key_editor->set_animation(Ref<Animation>());
|
||||||
key_editor->set_root(NULL);
|
key_editor->set_root(NULL);
|
||||||
|
key_editor->show_select_node_warning(true);
|
||||||
_update_player();
|
_update_player();
|
||||||
//editor->animation_editor_make_visible(false);
|
//editor->animation_editor_make_visible(false);
|
||||||
|
|
||||||
@ -832,6 +833,7 @@ void AnimationPlayerEditor::_update_player() {
|
|||||||
remove_anim->set_disabled(animlist.size()==0);
|
remove_anim->set_disabled(animlist.size()==0);
|
||||||
resource_edit_anim->set_disabled(animlist.size()==0);
|
resource_edit_anim->set_disabled(animlist.size()==0);
|
||||||
save_anim->set_disabled(animlist.size() == 0);
|
save_anim->set_disabled(animlist.size() == 0);
|
||||||
|
tool_anim->set_disabled(player==NULL);
|
||||||
|
|
||||||
|
|
||||||
int active_idx=-1;
|
int active_idx=-1;
|
||||||
@ -889,9 +891,11 @@ void AnimationPlayerEditor::edit(AnimationPlayer *p_player) {
|
|||||||
return; //ignore, pinned
|
return; //ignore, pinned
|
||||||
player=p_player;
|
player=p_player;
|
||||||
|
|
||||||
if (player)
|
if (player) {
|
||||||
_update_player();
|
_update_player();
|
||||||
else {
|
key_editor->show_select_node_warning(false);
|
||||||
|
} else {
|
||||||
|
key_editor->show_select_node_warning(true);
|
||||||
|
|
||||||
// hide();
|
// hide();
|
||||||
|
|
||||||
@ -1123,6 +1127,7 @@ void AnimationPlayerEditor::_hide_anim_editors() {
|
|||||||
|
|
||||||
key_editor->set_animation(Ref<Animation>());
|
key_editor->set_animation(Ref<Animation>());
|
||||||
key_editor->set_root(NULL);
|
key_editor->set_root(NULL);
|
||||||
|
key_editor->show_select_node_warning(true);
|
||||||
// editor->animation_editor_make_visible(false);
|
// editor->animation_editor_make_visible(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1531,6 +1536,8 @@ void AnimationPlayerEditorPlugin::edit(Object *p_object) {
|
|||||||
if (!p_object)
|
if (!p_object)
|
||||||
return;
|
return;
|
||||||
anim_editor->edit(p_object->cast_to<AnimationPlayer>());
|
anim_editor->edit(p_object->cast_to<AnimationPlayer>());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AnimationPlayerEditorPlugin::handles(Object *p_object) const {
|
bool AnimationPlayerEditorPlugin::handles(Object *p_object) const {
|
||||||
|
Loading…
Reference in New Issue
Block a user