From 56718eb31e1fd5594bfc04f17050d9cea09e5de2 Mon Sep 17 00:00:00 2001 From: Dana Olson Date: Wed, 23 Apr 2014 21:43:02 -0400 Subject: use Snap / Snap (Pixels) now save to scene file Previously, only Use Pixel Snap would save to the scene. Tested and working for me, on Linux. --- tools/editor/plugins/canvas_item_editor_plugin.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'tools/editor') 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); - - } } -- cgit v1.2.3 From e1ab905bd754bf6aea04de6386859dfea05fae1e Mon Sep 17 00:00:00 2001 From: marynate Date: Thu, 1 May 2014 19:30:10 +0800 Subject: Sort projects by last modified/accessed date in project manager --- tools/editor/project_manager.cpp | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'tools/editor') 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 projects; + for(List::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::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 cf = memnew( ConfigFile ); Error err = cf->load(conf); ERR_CONTINUE(err!=OK); -- cgit v1.2.3