diff options
-rw-r--r-- | doc/classes/VisualShaderNodeCustom.xml | 8 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 11 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/project_manager.cpp | 27 | ||||
-rw-r--r-- | editor/project_manager.h | 2 | ||||
-rw-r--r-- | platform/javascript/engine.js | 6 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 1 |
8 files changed, 38 insertions, 21 deletions
diff --git a/doc/classes/VisualShaderNodeCustom.xml b/doc/classes/VisualShaderNodeCustom.xml index 9ccdf0d3c4..0d1bcc754f 100644 --- a/doc/classes/VisualShaderNodeCustom.xml +++ b/doc/classes/VisualShaderNodeCustom.xml @@ -143,6 +143,14 @@ Defining this method is [b]optional[/b]. If not overridden, the node will be filed under the root of the main category (see [method _get_category]). </description> </method> + <method name="_is_highend" qualifiers="virtual"> + <return type="bool"> + </return> + <description> + Override this method to enable high-end mark in the Visual Shader Editor's members dialog. + Defining this method is [b]optional[/b]. If not overridden, it's false. + </description> + </method> </methods> <constants> </constants> diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 715ce6bea7..d81b9bbb82 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -628,7 +628,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { /* Extra config */ _initial_set("project_manager/sorting_order", 0); - hints["project_manager/sorting_order"] = PropertyInfo(Variant::INT, "project_manager/sorting_order", PROPERTY_HINT_ENUM, "Name,Path,Last Modified"); + hints["project_manager/sorting_order"] = PropertyInfo(Variant::INT, "project_manager/sorting_order", PROPERTY_HINT_ENUM, "Name,Path,Last Edited"); if (p_extra_config.is_valid()) { diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 438c640bab..ebd7b4edf6 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -116,7 +116,7 @@ void VisualShaderEditor::clear_custom_types() { } } -void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory) { +void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory, bool p_highend) { ERR_FAIL_COND(!p_name.is_valid_identifier()); ERR_FAIL_COND(!p_script.is_valid()); @@ -135,6 +135,7 @@ void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> ao.description = p_description; ao.category = p_category; ao.sub_category = p_subcategory; + ao.highend = p_highend; ao.is_custom = true; bool begin = false; @@ -247,6 +248,11 @@ void VisualShaderEditor::update_custom_nodes() { subcategory = (String)ref->call("_get_subcategory"); } + bool highend = false; + if (ref->has_method("_is_highend")) { + highend = (bool)ref->call("_is_highend"); + } + Dictionary dict; dict["name"] = name; dict["script"] = script; @@ -254,6 +260,7 @@ void VisualShaderEditor::update_custom_nodes() { dict["return_icon_type"] = return_icon_type; dict["category"] = category; dict["subcategory"] = subcategory; + dict["highend"] = highend; String key; key = category; @@ -277,7 +284,7 @@ void VisualShaderEditor::update_custom_nodes() { const Dictionary &value = (Dictionary)added[key]; - add_custom_type(value["name"], value["script"], value["description"], value["return_icon_type"], value["category"], value["subcategory"]); + add_custom_type(value["name"], value["script"], value["description"], value["return_icon_type"], value["category"], value["subcategory"], value["highend"]); } _update_options_menu(); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index f4971ae36d..150cf16167 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -265,7 +265,7 @@ public: static VisualShaderEditor *get_singleton() { return singleton; } void clear_custom_types(); - void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory); + void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory, bool p_highend); virtual Size2 get_minimum_size() const; void edit(VisualShader *p_visual_shader); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index a91e14dd1d..d90e76fe39 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1001,7 +1001,7 @@ public: String path; String icon; String main_scene; - uint64_t last_modified; + uint64_t last_edited; bool favorite; bool grayed; bool missing; @@ -1017,7 +1017,7 @@ public: const String &p_path, const String &p_icon, const String &p_main_scene, - uint64_t p_last_modified, + uint64_t p_last_edited, bool p_favorite, bool p_grayed, bool p_missing, @@ -1029,7 +1029,7 @@ public: path = p_path; icon = p_icon; main_scene = p_main_scene; - last_modified = p_last_modified; + last_edited = p_last_edited; favorite = p_favorite; grayed = p_grayed; missing = p_missing; @@ -1104,8 +1104,8 @@ struct ProjectListComparator { switch (order_option) { case ProjectListFilter::FILTER_PATH: return a.project_key < b.project_key; - case ProjectListFilter::FILTER_MODIFIED: - return a.last_modified > b.last_modified; + case ProjectListFilter::FILTER_EDIT_DATE: + return a.last_edited > b.last_edited; default: return a.project_name < b.project_name; } @@ -1113,7 +1113,7 @@ struct ProjectListComparator { }; ProjectList::ProjectList() { - _order_option = ProjectListFilter::FILTER_MODIFIED; + _order_option = ProjectListFilter::FILTER_EDIT_DATE; _scroll_children = memnew(VBoxContainer); _scroll_children->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1200,15 +1200,18 @@ void ProjectList::load_project_data(const String &p_property_key, Item &p_item, String icon = cf->get_value("application", "config/icon", ""); String main_scene = cf->get_value("application", "run/main_scene", ""); - uint64_t last_modified = 0; + uint64_t last_edited = 0; if (FileAccess::exists(conf)) { - last_modified = FileAccess::get_modified_time(conf); + // The modification date marks the date the project was last edited. + // This is because the `project.godot` file will always be modified + // when editing a project (but not when running it). + last_edited = 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; + if (cache_modified > last_edited) + last_edited = cache_modified; } } else { grayed = true; @@ -1218,7 +1221,7 @@ void ProjectList::load_project_data(const String &p_property_key, Item &p_item, String project_key = p_property_key.get_slice("/", 1); - p_item = Item(project_key, project_name, description, path, icon, main_scene, last_modified, p_favorite, grayed, missing, config_version); + p_item = Item(project_key, project_name, description, path, icon, main_scene, last_edited, p_favorite, grayed, missing, config_version); } void ProjectList::load_projects() { @@ -2515,7 +2518,7 @@ ProjectManager::ProjectManager() { Vector<String> sort_filter_titles; sort_filter_titles.push_back(TTR("Name")); sort_filter_titles.push_back(TTR("Path")); - sort_filter_titles.push_back(TTR("Last Modified")); + sort_filter_titles.push_back(TTR("Last Edited")); project_order_filter = memnew(ProjectListFilter); project_order_filter->add_filter_option(); project_order_filter->_setup_filters(sort_filter_titles); diff --git a/editor/project_manager.h b/editor/project_manager.h index b8f7403e27..feeea9695d 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -134,7 +134,7 @@ public: enum FilterOption { FILTER_NAME, FILTER_PATH, - FILTER_MODIFIED, + FILTER_EDIT_DATE, }; private: diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js index 1f78aa672d..227accadb0 100644 --- a/platform/javascript/engine.js +++ b/platform/javascript/engine.js @@ -134,12 +134,10 @@ this.startGame = function(execName, mainPack) { executableName = execName; - var mainArgs = [ '--main-pack', mainPack ]; + var mainArgs = [ '--main-pack', getPathLeaf(mainPack) ]; return Promise.all([ - // Load from directory, - this.init(getBasePath(mainPack)), - // ...but write to root where the engine expects it. + this.init(getBasePath(execName)), this.preloadFile(mainPack, getPathLeaf(mainPack)) ]).then( Function.prototype.apply.bind(synchronousStart, this, mainArgs) diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index b3a72ea7b6..f80fe9f791 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -276,6 +276,7 @@ void VisualShaderNodeCustom::_bind_methods() { BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_output_port_name", PropertyInfo(Variant::INT, "port"))); BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_code", PropertyInfo(Variant::ARRAY, "input_vars"), PropertyInfo(Variant::ARRAY, "output_vars"), PropertyInfo(Variant::INT, "mode"), PropertyInfo(Variant::INT, "type"))); BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_global_code", PropertyInfo(Variant::INT, "mode"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_highend")); } VisualShaderNodeCustom::VisualShaderNodeCustom() { |