summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
authorjonyrock <ilms@live.ru>2014-05-01 20:15:28 +0400
committerjonyrock <ilms@live.ru>2014-05-01 20:15:28 +0400
commit209eaf6fa06eba8a05e5222bdab418cd0f20c91c (patch)
tree94eac56be6ad254a7c09e13d5e14bd843626232c /tools/editor
parent34aea718b11e105d30c938ad34e474b1bd8b5d63 (diff)
parent6572d5128856b2ec55a2c417c92e584899f4906f (diff)
Merge remote-tracking branch 'upstream/master' into pair_symbols_tool
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp15
-rw-r--r--tools/editor/project_manager.cpp39
2 files changed, 48 insertions, 6 deletions
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 1a365d7f32..7914ecfd95 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -85,8 +85,10 @@ Dictionary CanvasItemEditor::get_state() const {
Dictionary state;
state["zoom"]=zoom;
state["ofs"]=Point2(h_scroll->get_val(),v_scroll->get_val());
- state["pixel_snap"]=pixel_snap;
// state["ofs"]=-transform.get_origin();
+ state["use_snap"]=is_snap_active();
+ state["snap"]=snap;
+ state["pixel_snap"]=pixel_snap;
return state;
}
void CanvasItemEditor::set_state(const Dictionary& p_state){
@@ -103,12 +105,19 @@ void CanvasItemEditor::set_state(const Dictionary& p_state){
v_scroll->set_val(ofs.y);
}
+ if (state.has("use_snap")) {
+ int idx = edit_menu->get_popup()->get_item_index(SNAP_USE);
+ edit_menu->get_popup()->set_item_checked(idx,state["use_snap"]);
+ }
+
+ if (state.has("snap")) {
+ snap=state["snap"];
+ }
+
if (state.has("pixel_snap")) {
pixel_snap=state["pixel_snap"];
int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_PIXEL);
edit_menu->get_popup()->set_item_checked(idx,pixel_snap);
-
-
}
}
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index 9a758b50cf..c45e7441b8 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -333,9 +333,17 @@ public:
};
-
-
-
+struct ProjectItem {
+ String project;
+ String path;
+ String conf;
+ uint64_t last_modified;
+ ProjectItem() {}
+ ProjectItem(const String &p_project, const String &p_path, const String &p_conf, uint64_t p_last_modified) {
+ project = p_project; path = p_path; conf = p_conf; last_modified = p_last_modified;
+ }
+ _FORCE_INLINE_ bool operator <(const ProjectItem& l) const { return last_modified > l.last_modified; }
+};
void ProjectManager::_panel_draw(Node *p_hb) {
@@ -378,6 +386,8 @@ void ProjectManager::_load_recent_projects() {
Color font_color = get_color("font_color","Tree");
+ List<ProjectItem> projects;
+
for(List<PropertyInfo>::Element *E=properties.front();E;E=E->next()) {
String _name = E->get().name;
@@ -388,6 +398,29 @@ void ProjectManager::_load_recent_projects() {
String path = EditorSettings::get_singleton()->get(_name);
String conf=path.plus_file("engine.cfg");
+ uint64_t last_modified = 0;
+ if (FileAccess::exists(conf))
+ last_modified = FileAccess::get_modified_time(conf);
+ String fscache = path.plus_file(".fscache");
+ if (FileAccess::exists(fscache)) {
+ uint64_t cache_modified = FileAccess::get_modified_time(fscache);
+ if ( cache_modified > last_modified )
+ last_modified = cache_modified;
+ }
+
+ ProjectItem item(project, path, conf, last_modified);
+ projects.push_back(item);
+ }
+
+ projects.sort();
+
+ for(List<ProjectItem>::Element *E=projects.front();E;E=E->next()) {
+
+ ProjectItem &item = E->get();
+ String project = item.project;
+ String path = item.path;
+ String conf = item.conf;
+
Ref<ConfigFile> cf = memnew( ConfigFile );
Error err = cf->load(conf);
ERR_CONTINUE(err!=OK);