summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/animation_editor.cpp3
-rw-r--r--tools/editor/icons/icon_reload_small.pngbin0 -> 447 bytes
-rw-r--r--tools/editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp17
-rw-r--r--tools/editor/plugins/script_editor_plugin.h2
-rw-r--r--tools/editor/project_settings.cpp2
-rw-r--r--tools/editor/property_editor.cpp41
7 files changed, 46 insertions, 21 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index 79a9677edd..dfb09e38fc 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -262,6 +262,9 @@ public:
NodePath np=value;
+ if (np==NodePath())
+ return;
+
Node* root = EditorNode::get_singleton()->get_tree()->get_root();
Node* np_node = root->get_node(np);
diff --git a/tools/editor/icons/icon_reload_small.png b/tools/editor/icons/icon_reload_small.png
new file mode 100644
index 0000000000..957cdfcf4f
--- /dev/null
+++ b/tools/editor/icons/icon_reload_small.png
Binary files differ
diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp
index 0e2977c5a1..32afd86970 100644
--- a/tools/editor/plugins/animation_player_editor_plugin.cpp
+++ b/tools/editor/plugins/animation_player_editor_plugin.cpp
@@ -1298,7 +1298,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
frame = memnew( SpinBox );
hb->add_child(frame);
- frame->set_custom_minimum_size(Size2(80,0));
+ frame->set_custom_minimum_size(Size2(60,0));
frame->set_stretch_ratio(2);
frame->set_tooltip("Animation position (in seconds).");
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index e6e90eb0db..5b1dd37a61 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -935,6 +935,9 @@ void ScriptEditor::_menu_option(int p_option) {
if (!_test_script_times_on_disk())
return;
+ save_all_scripts();
+
+#if 0
for(int i=0;i<tab_container->get_child_count();i++) {
ScriptTextEditor *ste = tab_container->get_child(i)->cast_to<ScriptTextEditor>();
@@ -951,7 +954,7 @@ void ScriptEditor::_menu_option(int p_option) {
editor->save_resource( script );
}
-
+#endif
} break;
case SEARCH_HELP: {
@@ -1938,9 +1941,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script) {
}
}
-void ScriptEditor::save_external_data() {
-
- apply_scripts();
+void ScriptEditor::save_all_scripts() {
for(int i=0;i<tab_container->get_child_count();i++) {
@@ -1949,9 +1950,13 @@ void ScriptEditor::save_external_data() {
if (!ste)
continue;
+ if (ste->get_text_edit()->get_version()==ste->get_text_edit()->get_saved_version())
+ continue;
+
Ref<Script> script = ste->get_edited_script();
if (script->get_path()!="" && script->get_path().find("local://")==-1 &&script->get_path().find("::")==-1) {
//external script, save it
+ ste->apply_code();
editor->save_resource(script);
//ResourceSaver::save(script->get_path(),script);
}
@@ -2063,7 +2068,7 @@ void ScriptEditor::_editor_settings_changed() {
void ScriptEditor::_autosave_scripts() {
print_line("autosaving");
- save_external_data();
+ save_all_scripts();
}
void ScriptEditor::_tree_changed() {
@@ -2628,7 +2633,7 @@ void ScriptEditorPlugin::clear() {
void ScriptEditorPlugin::save_external_data() {
- script_editor->save_external_data();
+ script_editor->save_all_scripts();
}
void ScriptEditorPlugin::apply_changes() {
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index c52da41a43..5664b26580 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -295,7 +295,7 @@ public:
void swap_lines(TextEdit *tx, int line1, int line2);
- void save_external_data();
+ void save_all_scripts();
void set_window_layout(Ref<ConfigFile> p_layout);
void get_window_layout(Ref<ConfigFile> p_layout);
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index 9fe9b60ee5..873e397010 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -857,7 +857,7 @@ void ProjectSettings::_autoload_edited() {
undo_redo->create_action("Toggle Autoload GlobalVar");
undo_redo->add_do_property(Globals::get_singleton(),base,path);
undo_redo->add_undo_property(Globals::get_singleton(),base,Globals::get_singleton()->get(base));
- undo_redo->add_do_method(Globals::get_singleton(),"set_order",base,order);
+ undo_redo->add_do_method(Globals::get_singleton(),"set_order",base,order); // keep order, as config order matters for these
undo_redo->add_undo_method(Globals::get_singleton(),"set_order",base,order);
undo_redo->add_do_method(this,"_update_autoload");
undo_redo->add_undo_method(this,"_update_autoload");
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 3dfc461bfe..efc821b874 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -714,7 +714,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
RES r = v;
if (r.is_valid() && r->get_path().is_resource_file() && r->get_import_metadata().is_valid()) {
menu->add_separator();
- menu->add_icon_item(get_icon("Reload","EditorIcons"),"Re-Import",OBJ_MENU_REIMPORT);
+ menu->add_icon_item(get_icon("ReloadSmall","EditorIcons"),"Re-Import",OBJ_MENU_REIMPORT);
}
/*if (r.is_valid() && r->get_path().is_resource_file()) {
menu->set_item_tooltip(1,r->get_path());
@@ -2127,11 +2127,13 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) {
bool has_reload=false;
int found=-1;
+ bool is_disabled=false;
for(int i=0;i<item->get_button_count(1);i++) {
if (item->get_button_id(1,i)==3) {
found=i;
+ is_disabled=item->is_button_disabled(1,i);
break;
}
}
@@ -2149,7 +2151,7 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) {
bool changed = _is_property_different(v,vorig,usage);
- if ((found!=-1)!=changed) {
+ //if ((found!=-1 && !is_disabled)!=changed) {
if (changed) {
@@ -2158,11 +2160,9 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) {
}
- }
-
- }
-
+ //}
+ }
}
@@ -2176,10 +2176,20 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) {
}
}
+ //print_line("found: "+itos(found)+" has reload: "+itos(has_reload)+" is_disabled "+itos(is_disabled));
if (found!=-1 && !has_reload) {
- item->erase_button(1,found);
+
+ if (!is_disabled) {
+ item->erase_button(1,found);
+ if (item->get_cell_mode(1)==TreeItem::CELL_MODE_RANGE && item->get_text(1)==String()) {
+ item->add_button(1,get_icon("ReloadEmpty","EditorIcons"),3,true);
+ }
+ }
} else if (found==-1 && has_reload) {
- item->add_button(1,get_icon("Reload","EditorIcons"),3);
+ item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3);
+ } else if (found!=-1 && has_reload && is_disabled) {
+ item->erase_button(1,found);
+ item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3);
}
}
@@ -2348,7 +2358,7 @@ void PropertyEditor::_refresh_item(TreeItem *p_item) {
if (!has_reload && found!=-1) {
p_item->erase_button(1,found);
} else if (has_reload && found==-1) {
- p_item->add_button(1,get_icon("Reload","EditorIcons"),3);
+ p_item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3);
}
#endif
Dictionary d=p_item->get_metadata(0);
@@ -3092,7 +3102,9 @@ void PropertyEditor::update_tree() {
}
bool has_reload=false;
- if (_might_be_in_instance()) {
+
+ bool mbi = _might_be_in_instance();
+ if (mbi) {
Variant vorig;
Dictionary d=item->get_metadata(0);
@@ -3103,7 +3115,7 @@ void PropertyEditor::update_tree() {
if (_is_property_different(v,vorig,usage)) {
//print_line("FOR "+String(p.name)+" RELOAD WITH: "+String(v)+"("+Variant::get_type_name(v.get_type())+")=="+String(vorig)+"("+Variant::get_type_name(vorig.get_type())+")");
- item->add_button(1,get_icon("Reload","EditorIcons"),3);
+ item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3);
has_reload=true;
}
}
@@ -3115,11 +3127,16 @@ void PropertyEditor::update_tree() {
Variant orig_value;
if (scr->get_property_default_value(p.name,orig_value)) {
if (orig_value!=obj->get(p.name)) {
- item->add_button(1,get_icon("Reload","EditorIcons"),3);
+ item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3);
+ has_reload=true;
}
}
}
+ if (mbi && !has_reload && item->get_cell_mode(1)==TreeItem::CELL_MODE_RANGE && item->get_text(1)==String()) {
+ item->add_button(1,get_icon("ReloadEmpty","EditorIcons"),3,true);
+ }
+
}