|
@@ -1876,6 +1876,14 @@ void PropertyEditor::_notification(int p_what) {
|
|
if (p_what==NOTIFICATION_FIXED_PROCESS) {
|
|
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;
|
|
changing=true;
|
|
|
|
|
|
if (update_tree_pending) {
|
|
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() {
|
|
void PropertyEditor::update_tree() {
|
|
|
|
|
|
@@ -3021,6 +3093,7 @@ PropertyEditor::PropertyEditor() {
|
|
keying=false;
|
|
keying=false;
|
|
read_only=false;
|
|
read_only=false;
|
|
show_categories=false;
|
|
show_categories=false;
|
|
|
|
+ refresh_countdown=0;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|