summaryrefslogtreecommitdiff
path: root/tools/editor/animation_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/animation_editor.cpp')
-rw-r--r--tools/editor/animation_editor.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index 9a0dde783b..fbe50d6d96 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -1085,6 +1085,7 @@ void AnimationKeyEditor::_track_editor_draw() {
move_up_button->set_disabled(true);
move_down_button->set_disabled(true);
remove_button->set_disabled(true);
+
return;
}
@@ -2806,6 +2807,10 @@ void AnimationKeyEditor::_notification(int p_what) {
switch(p_what) {
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+
+ EditorNode::get_singleton()->update_keying();
+ } break;
case NOTIFICATION_ENTER_TREE: {
@@ -2988,6 +2993,8 @@ void AnimationKeyEditor::set_animation(const Ref<Animation>& p_anim) {
_update_menu();
selected_track=-1;
_edit_if_single_selection();
+
+ EditorNode::get_singleton()->update_keying();
}
void AnimationKeyEditor::set_root(Node *p_root) {
@@ -3023,7 +3030,7 @@ void AnimationKeyEditor::set_keying(bool p_enabled) {
bool AnimationKeyEditor::has_keying() const {
- return keying;
+ return is_visible() && animation.is_valid();
}
void AnimationKeyEditor::_query_insert(const InsertData& p_id) {
@@ -3352,6 +3359,7 @@ Ref<Animation> AnimationKeyEditor::get_current_animation() const {
void AnimationKeyEditor::_animation_len_changed(float p_len) {
+
if (updating)
return;
@@ -3479,8 +3487,10 @@ void AnimationKeyEditor::_insert_delay() {
void AnimationKeyEditor::_step_changed(float p_len) {
updating=true;
- if (!animation.is_null())
+ if (!animation.is_null()) {
animation->set_step(p_len);
+ emit_signal("animation_step_changed",animation->get_step());
+ }
updating=false;
}
@@ -3691,21 +3701,33 @@ void AnimationKeyEditor::_bind_methods() {
ADD_SIGNAL( MethodInfo("keying_changed" ) );
ADD_SIGNAL( MethodInfo("timeline_changed", PropertyInfo(Variant::REAL,"pos") ) );
ADD_SIGNAL( MethodInfo("animation_len_changed", PropertyInfo(Variant::REAL,"len") ) );
+ ADD_SIGNAL( MethodInfo("animation_step_changed", PropertyInfo(Variant::REAL,"step") ) );
ADD_SIGNAL( MethodInfo("key_edited", PropertyInfo(Variant::INT,"track"), PropertyInfo(Variant::INT,"key") ) );
}
-AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_history,EditorSelection *p_selection) {
+AnimationKeyEditor::AnimationKeyEditor() {
alc="animation_len_changed";
- editor_selection=p_selection;
+ editor_selection=EditorNode::get_singleton()->get_editor_selection();
selected_track=-1;
updating=false;
te_drawing=false;
- undo_redo=p_undo_redo;
- history=p_history;
+ undo_redo=EditorNode::get_singleton()->get_undo_redo();
+ history=EditorNode::get_singleton()->get_editor_history();
+
+ ec = memnew (Control);
+ ec->set_custom_minimum_size(Size2(0,150));
+ add_child(ec);
+ ec->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ h_scroll = memnew( HScrollBar );
+ h_scroll->connect("value_changed",this,"_scroll_changed");
+ add_child(h_scroll);
+ h_scroll->set_val(0);
+
HBoxContainer *hb = memnew( HBoxContainer );
add_child(hb);
@@ -3863,10 +3885,6 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
// menu->get_popup()->connect("item_pressed",this,"_menu_callback");
- ec = memnew (Control);
- ec->set_custom_minimum_size(Size2(0,150));
- add_child(ec);
- ec->set_v_size_flags(SIZE_EXPAND_FILL);
hb = memnew( HBoxContainer);
hb->set_area_as_parent_rect();
@@ -3943,12 +3961,6 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
curve_edit->set_v_size_flags(SIZE_EXPAND_FILL);
key_editor_tab->add_child(curve_vb);
- h_scroll = memnew( HScrollBar );
- h_scroll->connect("value_changed",this,"_scroll_changed");
- add_child(h_scroll);
- h_scroll->set_val(0);
-
-
track_name = memnew( LineEdit );
track_name->set_as_toplevel(true);
track_name->hide();
@@ -4025,6 +4037,7 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
cleanup_dialog->connect("confirmed",this,"_menu_track",varray(TRACK_MENU_CLEAN_UP_CONFIRM));
+ add_constant_override("separation",get_constant("separation","VBoxContainer"));
}