diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-01-03 16:53:39 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-01-03 16:53:39 -0300 |
commit | ddf7457894abf4678727b8a751575fee3e0e55ac (patch) | |
tree | 33cc7904f0e8bd6bf1671f80481d759c9552f1e1 /tools/editor/property_editor.cpp | |
parent | fbdd925d9be1c4c96d05089d7d5a58cd938b002c (diff) | |
parent | 507736690de2f4125aec25ecb0339196fb89ba56 (diff) |
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'tools/editor/property_editor.cpp')
-rw-r--r-- | tools/editor/property_editor.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 195d3c01a5..a600683097 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -1880,6 +1880,14 @@ void PropertyEditor::_notification(int p_what) { if (p_what==NOTIFICATION_FIXED_PROCESS) { + if (refresh_countdown>0) { + refresh_countdown-=get_fixed_process_delta_time(); + if (refresh_countdown<=0) { + TreeItem *root = tree->get_root(); + _refresh_item(root); + } + } + changing=true; if (update_tree_pending) { @@ -1986,7 +1994,71 @@ TreeItem *PropertyEditor::get_parent_node(String p_path,HashMap<String,TreeItem* } +void PropertyEditor::_refresh_item(TreeItem *p_item) { + + if (!p_item) + return; + + String name = p_item->get_metadata(1); + + if (name!=String()) { + + if (get_instanced_node()) { + + Dictionary d = get_instanced_node()->get_instance_state(); + if (d.has(name)) { + Variant v = obj->get(name); + Variant vorig = d[name]; + + int found=-1; + for(int i=0;i<p_item->get_button_count(1);i++) { + + if (p_item->get_button_id(1,i)==3) { + found=i; + break; + } + } + + bool changed = ! (v==vorig); + + if ((found!=-1)!=changed) { + + if (changed) { + p_item->add_button(1,get_icon("Reload","EditorIcons"),3); + } else { + + p_item->erase_button(1,found); + } + + } + + } + + } + + Dictionary d=p_item->get_metadata(0); + set_item_text(p_item,d["type"],d["name"],d["hint"],d["hint_text"]); + } + + TreeItem *c=p_item->get_children(); + + while (c) { + + _refresh_item(c); + + c=c->get_next(); + } + +} + +void PropertyEditor::refresh() { + + if (refresh_countdown>0) + return; + refresh_countdown=EditorSettings::get_singleton()->get("property_editor/auto_refresh_interval"); + +} void PropertyEditor::update_tree() { @@ -3025,6 +3097,7 @@ PropertyEditor::PropertyEditor() { keying=false; read_only=false; show_categories=false; + refresh_countdown=0; } |