1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-29 16:16:38 +00:00

-fixed bug on focus capture, now respets line/text edit

-when playing animations, property editor is now refreshed properly, fixes #1046
This commit is contained in:
Juan Linietsky
2015-01-03 15:39:01 -03:00
parent ffd4b22e09
commit 167c1027be
5 changed files with 84 additions and 2 deletions

View File

@@ -1876,6 +1876,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) {
@@ -1982,7 +1990,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() {
@@ -3021,6 +3093,7 @@ PropertyEditor::PropertyEditor() {
keying=false;
read_only=false;
show_categories=false;
refresh_countdown=0;
}