diff options
-rw-r--r-- | core/engine.cpp | 4 | ||||
-rw-r--r-- | core/global_config.cpp | 2 | ||||
-rw-r--r-- | doc/base/classes.xml | 16 | ||||
-rw-r--r-- | editor/editor_plugin.cpp | 20 | ||||
-rw-r--r-- | editor/editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/project_manager.cpp | 6 | ||||
-rw-r--r-- | methods.py | 14 | ||||
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 2 | ||||
-rw-r--r-- | scene/gui/item_list.cpp | 2 | ||||
-rw-r--r-- | scene/gui/option_button.cpp | 4 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 2 | ||||
-rw-r--r-- | scene/resources/material.cpp | 2 | ||||
-rw-r--r-- | scene/resources/mesh_data_tool.cpp | 6 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 2 |
14 files changed, 72 insertions, 12 deletions
diff --git a/core/engine.cpp b/core/engine.cpp index 5301c4e519..42850325b4 100644 --- a/core/engine.cpp +++ b/core/engine.cpp @@ -30,6 +30,7 @@ #include "engine.h" #include "version.h" +#include "version_hash.gen.h" void Engine::set_iterations_per_second(int p_ips) { @@ -87,6 +88,9 @@ Dictionary Engine::get_version_info() const { dict["revision"] = _MKSTR(VERSION_REVISION); dict["year"] = VERSION_YEAR; + String hash = String(VERSION_HASH); + dict["hash"] = hash.length() == 0 ? String("unknown") : hash; + String stringver = String(dict["major"]) + "." + String(dict["minor"]); if ((int)dict["patch"] != 0) stringver += "." + String(dict["patch"]); diff --git a/core/global_config.cpp b/core/global_config.cpp index ba0a7f3e31..caae73ee2e 100644 --- a/core/global_config.cpp +++ b/core/global_config.cpp @@ -835,7 +835,7 @@ void GlobalConfig::_bind_methods() { ClassDB::bind_method(D_METHOD("get_singleton", "name"), &GlobalConfig::get_singleton_object); ClassDB::bind_method(D_METHOD("load_resource_pack", "pack"), &GlobalConfig::_load_resource_pack); ClassDB::bind_method(D_METHOD("property_can_revert", "name"), &GlobalConfig::property_can_revert); - ClassDB::bind_method(D_METHOD("property_get_revert", "name"), &GlobalConfig::property_get_revert); + ClassDB::bind_method(D_METHOD("property_get_revert:Variant", "name"), &GlobalConfig::property_get_revert); ClassDB::bind_method(D_METHOD("save_custom", "file"), &GlobalConfig::_save_custom_bnd); } diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 6ff3e0fa29..7a81eddd92 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -13313,6 +13313,22 @@ <description> </description> </method> + <method name="open_scene_from_path"> + <argument index="0" name="scene_filepath" type="String"> + </argument> + </return> + <description> + Opens scene in editor. Do not use during plugin initialization. If you need, then use it together with [method Object.call_deferred]. + </description> + </method> + <method name="reload_scene_from_path"> + <argument index="0" name="scene_filepath" type="String"> + </argument> + </return> + <description> + Reloads already loaded editor scene. + </description> + </method> <method name="forward_canvas_gui_input" qualifiers="virtual"> <return type="bool"> </return> diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index e4b055a9e2..606fd8ee5e 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -80,6 +80,24 @@ void EditorPlugin::edit_resource(const Ref<Resource> &p_resource) { EditorNode::get_singleton()->edit_resource(p_resource); } +void EditorPlugin::open_scene_from_path(const String &scene_path) { + + if (EditorNode::get_singleton()->is_changing_scene()) { + return; + } + + EditorNode::get_singleton()->open_request(scene_path); +} + +void EditorPlugin::reload_scene_from_path(const String &scene_path) { + + if (EditorNode::get_singleton()->is_changing_scene()) { + return; + } + + EditorNode::get_singleton()->reload_scene(scene_path); +} + void EditorPlugin::add_control_to_container(CustomControlContainer p_location, Control *p_control) { switch (p_location) { @@ -376,6 +394,8 @@ void EditorPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("get_editor_settings:EditorSettings"), &EditorPlugin::get_editor_settings); ClassDB::bind_method(D_METHOD("queue_save_layout"), &EditorPlugin::queue_save_layout); ClassDB::bind_method(D_METHOD("edit_resource"), &EditorPlugin::edit_resource); + ClassDB::bind_method(D_METHOD("open_scene_from_path", "scene_filepath"), &EditorPlugin::open_scene_from_path); + ClassDB::bind_method(D_METHOD("reload_scene_from_path", "scene_filepath"), &EditorPlugin::reload_scene_from_path); ClassDB::bind_method(D_METHOD("add_import_plugin"), &EditorPlugin::add_import_plugin); ClassDB::bind_method(D_METHOD("remove_import_plugin"), &EditorPlugin::remove_import_plugin); ClassDB::bind_method(D_METHOD("set_input_event_forwarding_always_enabled"), &EditorPlugin::set_input_event_forwarding_always_enabled); diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 57a22a8b2f..3653851d5a 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -103,6 +103,8 @@ public: void remove_control_from_bottom_panel(Control *p_control); Control *get_editor_viewport(); void edit_resource(const Ref<Resource> &p_resource); + void open_scene_from_path(const String &scene_path); + void reload_scene_from_path(const String &scene_path); void add_tool_menu_item(const String &p_name, Object *p_handler, const String &p_callback, const Variant &p_ud = Variant()); void add_tool_submenu_item(const String &p_name, Object *p_submenu); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index a3d3d42110..e3f22c833e 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -49,6 +49,7 @@ #include "scene/gui/texture_rect.h" #include "scene/gui/tool_button.h" #include "version.h" +#include "version_hash.gen.h" class NewProjectDialog : public ConfirmationDialog { @@ -1244,7 +1245,10 @@ ProjectManager::ProjectManager() { top_hb->add_child(ccl); top_hb->add_spacer(); l = memnew(Label); - l->set_text("v" VERSION_MKSTRING); + String hash = String(VERSION_HASH); + if (hash.length() != 0) + hash = "." + hash.left(7); + l->set_text("v" VERSION_MKSTRING "" + hash); //l->add_font_override("font",get_font("bold","Fonts")); l->set_align(Label::ALIGN_CENTER); top_hb->add_child(l); diff --git a/methods.py b/methods.py index 4d3d5ae343..abd87c07d7 100644 --- a/methods.py +++ b/methods.py @@ -1176,6 +1176,20 @@ def update_version(): f.write("#define VERSION_STATUS " + str(version.status) + "\n") import datetime f.write("#define VERSION_YEAR " + str(datetime.datetime.now().year) + "\n") + f.close() + + fhash = open("core/version_hash.gen.h", "wb") + githash = "" + if os.path.isfile(".git/HEAD"): + head = open(".git/HEAD", "rb").readline().strip() + if head.startswith("ref: "): + head = ".git/" + head[5:] + if os.path.isfile(head): + githash = open(head, "rb").readline().strip() + else: + githash = head + fhash.write("#define VERSION_HASH \"" + githash + "\"") + fhash.close() def parse_cg_file(fname, uniforms, sizes, conditionals): diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index f707471405..5f24bcc2c3 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -1076,7 +1076,7 @@ void VisualScriptConstant::_bind_methods() { ClassDB::bind_method(D_METHOD("get_constant_type"), &VisualScriptConstant::get_constant_type); ClassDB::bind_method(D_METHOD("set_constant_value", "value"), &VisualScriptConstant::set_constant_value); - ClassDB::bind_method(D_METHOD("get_constant_value"), &VisualScriptConstant::get_constant_value); + ClassDB::bind_method(D_METHOD("get_constant_value:Variant"), &VisualScriptConstant::get_constant_value); String argt = "Null"; for (int i = 1; i < Variant::VARIANT_MAX; i++) { diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 160b7b151a..19768d344a 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1274,7 +1274,7 @@ void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("is_item_disabled", "idx"), &ItemList::is_item_disabled); ClassDB::bind_method(D_METHOD("set_item_metadata", "idx", "metadata"), &ItemList::set_item_metadata); - ClassDB::bind_method(D_METHOD("get_item_metadata", "idx"), &ItemList::get_item_metadata); + ClassDB::bind_method(D_METHOD("get_item_metadata:Variant", "idx"), &ItemList::get_item_metadata); ClassDB::bind_method(D_METHOD("set_item_custom_bg_color", "idx", "custom_bg_color"), &ItemList::set_item_custom_bg_color); ClassDB::bind_method(D_METHOD("get_item_custom_bg_color", "idx"), &ItemList::get_item_custom_bg_color); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 0806d35d48..f75e0986c1 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -283,7 +283,7 @@ void OptionButton::_bind_methods() { ClassDB::bind_method(D_METHOD("get_item_text", "idx"), &OptionButton::get_item_text); ClassDB::bind_method(D_METHOD("get_item_icon:Texture", "idx"), &OptionButton::get_item_icon); ClassDB::bind_method(D_METHOD("get_item_ID", "idx"), &OptionButton::get_item_ID); - ClassDB::bind_method(D_METHOD("get_item_metadata", "idx"), &OptionButton::get_item_metadata); + ClassDB::bind_method(D_METHOD("get_item_metadata:Variant", "idx"), &OptionButton::get_item_metadata); ClassDB::bind_method(D_METHOD("is_item_disabled", "idx"), &OptionButton::is_item_disabled); ClassDB::bind_method(D_METHOD("get_item_count"), &OptionButton::get_item_count); ClassDB::bind_method(D_METHOD("add_separator"), &OptionButton::add_separator); @@ -291,7 +291,7 @@ void OptionButton::_bind_methods() { ClassDB::bind_method(D_METHOD("select", "idx"), &OptionButton::select); ClassDB::bind_method(D_METHOD("get_selected"), &OptionButton::get_selected); ClassDB::bind_method(D_METHOD("get_selected_ID"), &OptionButton::get_selected_ID); - ClassDB::bind_method(D_METHOD("get_selected_metadata"), &OptionButton::get_selected_metadata); + ClassDB::bind_method(D_METHOD("get_selected_metadata:Variant"), &OptionButton::get_selected_metadata); ClassDB::bind_method(D_METHOD("remove_item", "idx"), &OptionButton::remove_item); ClassDB::bind_method(D_METHOD("_select_int"), &OptionButton::_select_int); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 74b26da580..072e90df3a 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1096,7 +1096,7 @@ void PopupMenu::_bind_methods() { ClassDB::bind_method(D_METHOD("get_item_ID", "idx"), &PopupMenu::get_item_ID); ClassDB::bind_method(D_METHOD("get_item_index", "id"), &PopupMenu::get_item_index); ClassDB::bind_method(D_METHOD("get_item_accelerator", "idx"), &PopupMenu::get_item_accelerator); - ClassDB::bind_method(D_METHOD("get_item_metadata", "idx"), &PopupMenu::get_item_metadata); + ClassDB::bind_method(D_METHOD("get_item_metadata:Variant", "idx"), &PopupMenu::get_item_metadata); ClassDB::bind_method(D_METHOD("is_item_disabled", "idx"), &PopupMenu::is_item_disabled); ClassDB::bind_method(D_METHOD("get_item_submenu", "idx"), &PopupMenu::get_item_submenu); ClassDB::bind_method(D_METHOD("is_item_separator", "idx"), &PopupMenu::is_item_separator); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 705702b8be..a0b192259b 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -163,7 +163,7 @@ void ShaderMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_shader", "shader:Shader"), &ShaderMaterial::set_shader); ClassDB::bind_method(D_METHOD("get_shader:Shader"), &ShaderMaterial::get_shader); ClassDB::bind_method(D_METHOD("set_shader_param", "param", "value"), &ShaderMaterial::set_shader_param); - ClassDB::bind_method(D_METHOD("get_shader_param", "param"), &ShaderMaterial::get_shader_param); + ClassDB::bind_method(D_METHOD("get_shader_param:Variant", "param"), &ShaderMaterial::get_shader_param); } void ShaderMaterial::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const { diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index dc3713fb57..bf1b3d40be 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -554,7 +554,7 @@ void MeshDataTool::_bind_methods() { ClassDB::bind_method(D_METHOD("get_vertex_weights", "idx"), &MeshDataTool::get_vertex_weights); ClassDB::bind_method(D_METHOD("set_vertex_meta", "idx", "meta"), &MeshDataTool::set_vertex_meta); - ClassDB::bind_method(D_METHOD("get_vertex_meta", "idx"), &MeshDataTool::get_vertex_meta); + ClassDB::bind_method(D_METHOD("get_vertex_meta:Variant", "idx"), &MeshDataTool::get_vertex_meta); ClassDB::bind_method(D_METHOD("get_vertex_edges", "idx"), &MeshDataTool::get_vertex_edges); ClassDB::bind_method(D_METHOD("get_vertex_faces", "idx"), &MeshDataTool::get_vertex_faces); @@ -563,13 +563,13 @@ void MeshDataTool::_bind_methods() { ClassDB::bind_method(D_METHOD("get_edge_faces", "idx", "faces"), &MeshDataTool::get_edge_faces); ClassDB::bind_method(D_METHOD("set_edge_meta", "idx", "meta"), &MeshDataTool::set_edge_meta); - ClassDB::bind_method(D_METHOD("get_edge_meta", "idx"), &MeshDataTool::get_edge_meta); + ClassDB::bind_method(D_METHOD("get_edge_meta:Variant", "idx"), &MeshDataTool::get_edge_meta); ClassDB::bind_method(D_METHOD("get_face_vertex", "idx", "vertex"), &MeshDataTool::get_face_vertex); ClassDB::bind_method(D_METHOD("get_face_edge", "idx", "edge"), &MeshDataTool::get_face_edge); ClassDB::bind_method(D_METHOD("set_face_meta", "idx", "meta"), &MeshDataTool::set_face_meta); - ClassDB::bind_method(D_METHOD("get_face_meta", "idx"), &MeshDataTool::get_face_meta); + ClassDB::bind_method(D_METHOD("get_face_meta:Variant", "idx"), &MeshDataTool::get_face_meta); ClassDB::bind_method(D_METHOD("get_face_normal", "idx"), &MeshDataTool::get_face_normal); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 50fbb6a162..1afaed2284 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1671,7 +1671,7 @@ void SceneState::_bind_methods() { ClassDB::bind_method(D_METHOD("get_node_groups", "idx"), &SceneState::_get_node_groups); ClassDB::bind_method(D_METHOD("get_node_property_count", "idx"), &SceneState::get_node_property_count); ClassDB::bind_method(D_METHOD("get_node_property_name", "idx", "prop_idx"), &SceneState::get_node_property_name); - ClassDB::bind_method(D_METHOD("get_node_property_value", "idx", "prop_idx"), &SceneState::get_node_property_value); + ClassDB::bind_method(D_METHOD("get_node_property_value:Variant", "idx", "prop_idx"), &SceneState::get_node_property_value); ClassDB::bind_method(D_METHOD("get_connection_count"), &SceneState::get_connection_count); ClassDB::bind_method(D_METHOD("get_connection_source", "idx"), &SceneState::get_connection_source); ClassDB::bind_method(D_METHOD("get_connection_signal", "idx"), &SceneState::get_connection_signal); |