summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.cpp33
-rw-r--r--editor/array_property_edit.cpp5
-rw-r--r--editor/array_property_edit.h2
-rw-r--r--editor/dictionary_property_edit.cpp5
-rw-r--r--editor/dictionary_property_edit.h2
-rw-r--r--editor/editor_inspector.cpp2
6 files changed, 42 insertions, 7 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 662137d60d..929d6c7642 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -45,18 +45,22 @@ class AnimationTrackKeyEdit : public Object {
public:
bool setting;
- bool hidden;
bool _hide_script_from_inspector() {
return true;
}
+ bool _dont_undo_redo() {
+ return true;
+ }
+
static void _bind_methods() {
ClassDB::bind_method("_update_obj", &AnimationTrackKeyEdit::_update_obj);
ClassDB::bind_method("_key_ofs_changed", &AnimationTrackKeyEdit::_key_ofs_changed);
ClassDB::bind_method("_hide_script_from_inspector", &AnimationTrackKeyEdit::_hide_script_from_inspector);
ClassDB::bind_method("get_root_path", &AnimationTrackKeyEdit::get_root_path);
+ ClassDB::bind_method("_dont_undo_redo", &AnimationTrackKeyEdit::_dont_undo_redo);
}
//PopupDialog *ke_dialog;
@@ -82,16 +86,13 @@ public:
void _update_obj(const Ref<Animation> &p_anim) {
if (setting)
return;
- if (hidden)
- return;
if (!(animation == p_anim))
return;
+
notify_change();
}
void _key_ofs_changed(const Ref<Animation> &p_anim, float from, float to) {
- if (hidden)
- return;
if (!(animation == p_anim))
return;
if (from != key_ofs)
@@ -168,6 +169,7 @@ public:
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
+
setting = false;
return true;
@@ -191,6 +193,7 @@ public:
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
+
setting = false;
return true;
}
@@ -267,6 +270,7 @@ public:
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
+
setting = false;
if (change_notify_deserved)
notify_change();
@@ -286,6 +290,7 @@ public:
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
+
setting = false;
return true;
}
@@ -301,6 +306,7 @@ public:
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
+
setting = false;
return true;
}
@@ -316,6 +322,7 @@ public:
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
+
setting = false;
return true;
}
@@ -335,6 +342,7 @@ public:
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
+
setting = false;
return true;
}
@@ -350,6 +358,7 @@ public:
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
+
setting = false;
return true;
}
@@ -365,6 +374,7 @@ public:
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
+
setting = false;
return true;
}
@@ -639,6 +649,8 @@ public:
PropertyInfo hint;
NodePath base;
+ AnimationTrackEditor *track_editor;
+
void notify_change() {
_change_notify();
@@ -649,11 +661,11 @@ public:
}
AnimationTrackKeyEdit() {
- hidden = true;
key_ofs = 0;
track = -1;
setting = false;
root_path = NULL;
+ track_editor = NULL;
}
};
@@ -3414,6 +3426,14 @@ void AnimationTrackEditor::_update_tracks() {
void AnimationTrackEditor::_animation_changed() {
+ if (key_edit && key_edit->setting) {
+ //if editing a key, just update the edited track, makes refresh less costly
+ if (key_edit->track < track_edits.size()) {
+ track_edits[key_edit->track]->update();
+ }
+ return;
+ }
+
timeline->update();
timeline->update_values();
if (block_animation_update) {
@@ -3944,6 +3964,7 @@ void AnimationTrackEditor::_update_key_edit() {
key_edit = memnew(AnimationTrackKeyEdit);
key_edit->animation = animation;
key_edit->track = selection.front()->key().track;
+ key_edit->track_editor = this;
float ofs = animation->track_get_key_time(key_edit->track, selection.front()->key().key);
key_edit->key_ofs = ofs;
diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp
index 7a3edfde50..72beeaaf45 100644
--- a/editor/array_property_edit.cpp
+++ b/editor/array_property_edit.cpp
@@ -288,12 +288,17 @@ Node *ArrayPropertyEdit::get_node() {
return Object::cast_to<Node>(ObjectDB::get_instance(obj));
}
+bool ArrayPropertyEdit::_dont_undo_redo() {
+ return true;
+}
+
void ArrayPropertyEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_size"), &ArrayPropertyEdit::_set_size);
ClassDB::bind_method(D_METHOD("_set_value"), &ArrayPropertyEdit::_set_value);
ClassDB::bind_method(D_METHOD("_notif_change"), &ArrayPropertyEdit::_notif_change);
ClassDB::bind_method(D_METHOD("_notif_changev"), &ArrayPropertyEdit::_notif_changev);
+ ClassDB::bind_method(D_METHOD("_dont_undo_redo"), &ArrayPropertyEdit::_dont_undo_redo);
}
ArrayPropertyEdit::ArrayPropertyEdit() {
diff --git a/editor/array_property_edit.h b/editor/array_property_edit.h
index b2a3564c8c..fd17ebe9f8 100644
--- a/editor/array_property_edit.h
+++ b/editor/array_property_edit.h
@@ -52,6 +52,8 @@ class ArrayPropertyEdit : public Reference {
void _set_size(int p_size);
void _set_value(int p_idx, const Variant &p_value);
+ bool _dont_undo_redo();
+
protected:
static void _bind_methods();
bool _set(const StringName &p_name, const Variant &p_value);
diff --git a/editor/dictionary_property_edit.cpp b/editor/dictionary_property_edit.cpp
index 483f5ae2d0..9f4096ca02 100644
--- a/editor/dictionary_property_edit.cpp
+++ b/editor/dictionary_property_edit.cpp
@@ -102,12 +102,17 @@ Node *DictionaryPropertyEdit::get_node() {
return cast_to<Node>(o);
}
+bool DictionaryPropertyEdit::_dont_undo_redo() {
+ return true;
+}
+
void DictionaryPropertyEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_key"), &DictionaryPropertyEdit::_set_key);
ClassDB::bind_method(D_METHOD("_set_value"), &DictionaryPropertyEdit::_set_value);
ClassDB::bind_method(D_METHOD("_notif_change"), &DictionaryPropertyEdit::_notif_change);
ClassDB::bind_method(D_METHOD("_notif_changev"), &DictionaryPropertyEdit::_notif_changev);
+ ClassDB::bind_method(D_METHOD("_dont_undo_redo"), &DictionaryPropertyEdit::_dont_undo_redo);
}
bool DictionaryPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
diff --git a/editor/dictionary_property_edit.h b/editor/dictionary_property_edit.h
index f6bd13785a..a2a81c261c 100644
--- a/editor/dictionary_property_edit.h
+++ b/editor/dictionary_property_edit.h
@@ -46,6 +46,8 @@ class DictionaryPropertyEdit : public Reference {
Variant get_dictionary() const;
+ bool _dont_undo_redo();
+
protected:
static void _bind_methods();
bool _set(const StringName &p_name, const Variant &p_value);
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 1078fabc2e..94761cadef 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -1937,7 +1937,7 @@ void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bo
}
}
- if (!undo_redo || Object::cast_to<ArrayPropertyEdit>(object) || Object::cast_to<DictionaryPropertyEdit>(object)) { //kind of hacky
+ if (!undo_redo || bool(object->call("_dont_undo_redo"))) {
object->set(p_name, p_value);
if (p_refresh_all)