diff options
30 files changed, 200 insertions, 65 deletions
diff --git a/SConstruct b/SConstruct index 2e7683d17a..e9a6bc44b6 100644 --- a/SConstruct +++ b/SConstruct @@ -73,6 +73,8 @@ env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH')) env_base.global_defaults = global_defaults env_base.android_maven_repos = [] env_base.android_dependencies = [] +env_base.android_gradle_plugins = [] +env_base.android_gradle_classpath = [] env_base.android_java_dirs = [] env_base.android_res_dirs = [] env_base.android_aidl_dirs = [] @@ -96,6 +98,8 @@ env_base.__class__.android_add_default_config = methods.android_add_default_conf env_base.__class__.android_add_to_manifest = methods.android_add_to_manifest env_base.__class__.android_add_to_permissions = methods.android_add_to_permissions env_base.__class__.android_add_to_attributes = methods.android_add_to_attributes +env_base.__class__.android_add_gradle_plugin = methods.android_add_gradle_plugin +env_base.__class__.android_add_gradle_classpath = methods.android_add_gradle_classpath env_base.__class__.disable_module = methods.disable_module env_base.__class__.add_source_files = methods.add_source_files diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index ce3d65b448..c9c74094d3 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -2078,7 +2078,7 @@ void _Marshalls::_bind_methods() { ClassDB::bind_method(D_METHOD("base64_to_variant:Variant", "base64_str"), &_Marshalls::base64_to_variant); ClassDB::bind_method(D_METHOD("raw_to_base64:String", "array"), &_Marshalls::raw_to_base64); - ClassDB::bind_method(D_METHOD("base64_to_raw:RawArray", "base64_str"), &_Marshalls::base64_to_raw); + ClassDB::bind_method(D_METHOD("base64_to_raw:PoolByteArray", "base64_str"), &_Marshalls::base64_to_raw); ClassDB::bind_method(D_METHOD("utf8_to_base64:String", "utf8_str"), &_Marshalls::utf8_to_base64); ClassDB::bind_method(D_METHOD("base64_to_utf8:String", "base64_str"), &_Marshalls::base64_to_utf8); diff --git a/core/object.cpp b/core/object.cpp index e9b332fafa..fe6f120c17 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1587,7 +1587,7 @@ void Object::_bind_methods() { ClassDB::bind_method(D_METHOD("get_class"), &Object::get_class); ClassDB::bind_method(D_METHOD("is_class", "type"), &Object::is_class); ClassDB::bind_method(D_METHOD("set", "property", "value"), &Object::_set_bind); - ClassDB::bind_method(D_METHOD("get", "property"), &Object::_get_bind); + ClassDB::bind_method(D_METHOD("get:Variant", "property"), &Object::_get_bind); ClassDB::bind_method(D_METHOD("get_property_list"), &Object::_get_property_list_bind); ClassDB::bind_method(D_METHOD("get_method_list"), &Object::_get_method_list_bind); ClassDB::bind_method(D_METHOD("notification", "what", "reversed"), &Object::notification, DEFVAL(false)); diff --git a/core/variant.cpp b/core/variant.cpp index 771d97a4eb..6d98ba7306 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -166,7 +166,7 @@ String Variant::get_type_name(Variant::Type p_type) { } break; case POOL_REAL_ARRAY: { - return "PoolFloatArray"; + return "PoolRealArray"; } break; case POOL_STRING_ARRAY: { diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 9c4eecfa1f..d3936801dd 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -4519,8 +4519,8 @@ void RasterizerSceneGLES3::initialize() { glGenTextures(1, &directional_shadow.depth); glBindTexture(GL_TEXTURE_2D, directional_shadow.depth); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, directional_shadow.size, directional_shadow.size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 526b4ab9ce..52eb8299d9 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -6280,7 +6280,10 @@ void RasterizerStorageGLES3::initialize() { shaders.cubemap_filter.init(); shaders.particles.init(); +#ifndef GLES_OVER_GL + glEnable(_EXT_TEXTURE_CUBE_MAP_SEAMLESS); +#endif frame.count = 0; frame.prev_tick = 0; diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 12934a82e7..48ca86ebe2 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -624,6 +624,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE_PIXEL_SIZE"] = "color_texpixel_size"; actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_UV"] = "screen_uv"; actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_TEXTURE"] = "screen_texture"; + actions[VS::SHADER_CANVAS_ITEM].renames["POSITION"] = "(gl_FragCoord.xy)"; actions[VS::SHADER_CANVAS_ITEM].renames["POINT_COORD"] = "gl_PointCoord"; actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_VEC"] = "light_vec"; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 00df0f337d..6a2222345a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -925,6 +925,11 @@ void EditorNode::_save_scene(String p_file, int idx) { return; } + // force creation of node path cache + // (hacky but needed for the tree to update properly) + Node *dummy_scene = sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE); + memdelete(dummy_scene); + int flg = 0; if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) flg |= ResourceSaver::FLAG_COMPRESS; @@ -4716,6 +4721,44 @@ void EditorNode::_open_imported() { load_scene(open_import_request, true, false, true, true); } +void EditorNode::dim_editor(bool p_dimming) { + static int dim_count = 0; + bool dim_ui = EditorSettings::get_singleton()->get("interface/dim_editor_on_dialog_popup"); + if (p_dimming) { + if (dim_ui && dim_count == 0) + _start_dimming(true); + dim_count++; + } else { + dim_count--; + if (dim_count < 1) + _start_dimming(false); + } +} + +void EditorNode::_start_dimming(bool p_dimming) { + _dimming = p_dimming; + _dim_time = 0.0f; + _dim_timer->start(); +} + +void EditorNode::_dim_timeout() { + + _dim_time += _dim_timer->get_wait_time(); + float wait_time = EditorSettings::get_singleton()->get("interface/dim_transition_time"); + + float c = 1.0f - (float)EditorSettings::get_singleton()->get("interface/dim_amount"); + + Color base = _dimming ? Color(1, 1, 1) : Color(c, c, c); + Color final = _dimming ? Color(c, c, c) : Color(1, 1, 1); + + if (_dim_time + _dim_timer->get_wait_time() >= wait_time) { + gui_base->set_modulate(final); + _dim_timer->stop(); + } else { + gui_base->set_modulate(base.linear_interpolate(final, _dim_time / wait_time)); + } +} + void EditorNode::_bind_methods() { ClassDB::bind_method("_menu_option", &EditorNode::_menu_option); @@ -4792,6 +4835,7 @@ void EditorNode::_bind_methods() { ClassDB::bind_method(D_METHOD("_open_imported"), &EditorNode::_open_imported); ClassDB::bind_method(D_METHOD("_inherit_imported"), &EditorNode::_inherit_imported); + ClassDB::bind_method(D_METHOD("_dim_timeout"), &EditorNode::_dim_timeout); ADD_SIGNAL(MethodInfo("play_pressed")); ADD_SIGNAL(MethodInfo("pause_pressed")); @@ -6102,6 +6146,13 @@ EditorNode::EditorNode() { FileAccess::set_file_close_fail_notify_callback(_file_access_close_error_notify); waiting_for_first_scan = true; + + _dimming = false; + _dim_time = 0.0f; + _dim_timer = memnew(Timer); + _dim_timer->set_wait_time(0.01666f); + _dim_timer->connect("timeout", this, "_dim_timeout"); + add_child(_dim_timer); } EditorNode::~EditorNode() { diff --git a/editor/editor_node.h b/editor/editor_node.h index cb165bdf21..ef8ae34475 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -598,6 +598,13 @@ private: void _tool_menu_insert_item(const ToolMenuItem &p_item); void _rebuild_tool_menu() const; + bool _dimming; + float _dim_time; + Timer *_dim_timer; + + void _start_dimming(bool p_dimming); + void _dim_timeout(); + protected: void _notification(int p_what); static void _bind_methods(); @@ -753,6 +760,8 @@ public: void add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu); void remove_tool_menu_item(const String &p_name); + void dim_editor(bool p_dimming); + EditorNode(); ~EditorNode(); void get_singleton(const char *arg1, bool arg2); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 8794a34f62..9e5021af6e 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -502,6 +502,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["interface/custom_font"] = PropertyInfo(Variant::STRING, "interface/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.fnt", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); set("interface/custom_theme", ""); hints["interface/custom_theme"] = PropertyInfo(Variant::STRING, "interface/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + set("interface/dim_editor_on_dialog_popup", true); + set("interface/dim_amount", 0.6f); + hints["interface/dim_amount"] = PropertyInfo(Variant::REAL, "interface/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT); + set("interface/dim_transition_time", 0.11f); + hints["interface/dim_transition_time"] = PropertyInfo(Variant::REAL, "interface/dim_transition_time", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_DEFAULT); set("filesystem/directories/autoscan_project_path", ""); hints["filesystem/directories/autoscan_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/autoscan_project_path", PROPERTY_HINT_GLOBAL_DIR); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index ebf2fa5a3a..7b015e484f 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3478,20 +3478,19 @@ void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) cons for (int i = 0; i < files.size(); i++) { String path = files[i]; RES res = ResourceLoader::load(path); - String type = res->get_class(); - if (type == "ImageTexture" || type == "PackedScene") { - if (type == "ImageTexture") { - Ref<ImageTexture> texture = Ref<ImageTexture>(ResourceCache::get(path)->cast_to<ImageTexture>()); + Ref<Texture> texture = Ref<Texture>(res->cast_to<Texture>()); + Ref<PackedScene> scene = Ref<PackedScene>(res->cast_to<PackedScene>()); + if (texture != NULL || scene != NULL) { + if (texture != NULL) { Sprite *sprite = memnew(Sprite); sprite->set_texture(texture); sprite->set_modulate(Color(1, 1, 1, 0.7f)); preview->add_child(sprite); label->show(); label_desc->show(); - } else if (type == "PackedScene") { - Ref<PackedScene> scn = ResourceLoader::load(path); - if (scn.is_valid()) { - Node *instance = scn->instance(); + } else { + if (scene.is_valid()) { + Node *instance = scene->instance(); if (instance) { preview->add_child(instance); } @@ -3531,7 +3530,7 @@ bool CanvasItemEditorViewport::_cyclical_dependency_exists(const String &p_targe void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &path, const Point2 &p_point) { child->set_name(path.get_file().get_basename()); - Ref<ImageTexture> texture = Ref<ImageTexture>(ResourceCache::get(path)->cast_to<ImageTexture>()); + Ref<Texture> texture = Ref<Texture>(ResourceCache::get(path)->cast_to<Texture>()); Size2 texture_size = texture->get_size(); editor_data->get_undo_redo().add_do_method(parent, "add_child", child); @@ -3584,7 +3583,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "Patch9Rect") { target_pos -= texture_size / 2; } - editor_data->get_undo_redo().add_do_method(child, "set_pos", target_pos); + editor_data->get_undo_redo().add_do_method(child, "set_position", target_pos); } bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, const Point2 &p_point) { @@ -3646,8 +3645,9 @@ void CanvasItemEditorViewport::_perform_drop_data() { if (res.is_null()) { continue; } - String type = res->get_class(); - if (type == "ImageTexture") { + Ref<Texture> texture = Ref<Texture>(res->cast_to<Texture>()); + Ref<PackedScene> scene = Ref<PackedScene>(res->cast_to<PackedScene>()); + if (texture != NULL) { Node *child; if (default_type == "Light2D") child = memnew(Light2D); @@ -3665,7 +3665,7 @@ void CanvasItemEditorViewport::_perform_drop_data() { child = memnew(Sprite); // default _create_nodes(target_node, child, path, drop_pos); - } else if (type == "PackedScene") { + } else if (scene != NULL) { bool success = _create_instance(target_node, path, drop_pos); if (!success) { error_files.push_back(path); @@ -3823,11 +3823,11 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte btn_group = memnew(VBoxContainer); btn_group->set_h_size_flags(0); - btn_group->connect("button_selected", this, "_on_select_type"); for (int i = 0; i < types.size(); i++) { CheckBox *check = memnew(CheckBox); check->set_text(types[i]); + check->connect("button_selected", this, "_on_select_type", varray(check)); btn_group->add_child(check); check->set_button_group(button_group); } @@ -3851,8 +3851,8 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte label_desc = memnew(Label); label_desc->set_text(TTR("Drag & drop + Shift : Add node as sibling\nDrag & drop + Alt : Change node type")); - label_desc->add_color_override("font_color", Color(0.6, 0.6, 0.6, 1)); - label_desc->add_color_override("font_color_shadow", Color(0.2, 0.2, 0.2, 1)); + label_desc->add_color_override("font_color", Color(0.6f, 0.6f, 0.6f, 1)); + label_desc->add_color_override("font_color_shadow", Color(0.2f, 0.2f, 0.2f, 1)); label_desc->add_constant_override("shadow_as_outline", 1 * EDSCALE); label_desc->add_constant_override("line_spacing", 0); label_desc->hide(); diff --git a/methods.py b/methods.py index 7177dcb804..a86fa1937d 100644 --- a/methods.py +++ b/methods.py @@ -1381,6 +1381,11 @@ def android_add_jni_dir(self, subpath): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath self.android_jni_dirs.append(base_path) +def android_add_gradle_plugin(self, plugin): + self.android_gradle_plugins.append(plugin) + +def android_add_gradle_classpath(self, classpath): + self.android_gradle_classpath.append(classpath) def android_add_default_config(self, config): self.android_default_config.append(config) diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index 9591740438..3f8c710674 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -1310,6 +1310,7 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl } } break; case GDParser::Node::TYPE_ASSERT: { +#ifdef DEBUG_ENABLED // try subblocks const GDParser::AssertNode *as = static_cast<const GDParser::AssertNode *>(s); @@ -1320,6 +1321,7 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl codegen.opcodes.push_back(GDFunction::OPCODE_ASSERT); codegen.opcodes.push_back(ret); +#endif } break; case GDParser::Node::TYPE_BREAKPOINT: { #ifdef DEBUG_ENABLED diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index bd428941e0..702876ecdc 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -405,7 +405,7 @@ static Ref<Reference> _get_parent_class(GDCompletionContext &context) { if (script.is_null()) { return REF(); } - if (script->is_valid()) { + if (!script->is_valid()) { return REF(); } diff --git a/platform/android/SCsub b/platform/android/SCsub index 86f8c40f83..e8536953a3 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -49,10 +49,11 @@ gradle_text = gradle_basein.read() gradle_maven_repos_text = "" if len(env.android_maven_repos) > 0: - gradle_maven_repos_text += "maven {\n" + gradle_maven_repos_text += "" for x in env.android_maven_repos: + gradle_maven_repos_text += "\tmaven {\n" gradle_maven_repos_text += "\t\t" + x + "\n" - gradle_maven_repos_text += "\t}\n" + gradle_maven_repos_text += "\t}\n" gradle_maven_dependencies_text = "" @@ -64,7 +65,14 @@ gradle_java_dirs_text = "" for x in env.android_java_dirs: gradle_java_dirs_text += ",'" + x.replace("\\", "/") + "'" +gradle_plugins = "" +for x in env.android_gradle_plugins: + gradle_plugins += "apply plugin: \"" + x + "\"\n" +gradle_classpath = "" +for x in env.android_gradle_classpath: + gradle_classpath += "\t\tclasspath \"" + x + "\"\n" + gradle_res_dirs_text = "" for x in env.android_res_dirs: @@ -95,7 +103,8 @@ gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$", gradle_asset_dirs_tex gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$", gradle_aidl_dirs_text) gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$", gradle_jni_dirs_text) gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$", gradle_default_config_text) - +gradle_text = gradle_text.replace("$$GRADLE_PLUGINS$$", gradle_plugins) +gradle_text = gradle_text.replace("$$GRADLE_CLASSPATH$$", gradle_classpath) gradle_baseout.write(gradle_text) gradle_baseout.close() diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template index c46a15bd12..24aab8e01f 100644 --- a/platform/android/build.gradle.template +++ b/platform/android/build.gradle.template @@ -4,6 +4,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:2.1.0' + $$GRADLE_CLASSPATH$$ } } @@ -83,3 +84,5 @@ android { variant.outputs.get(0).setOutputFile(new File("${projectDir}/../../../bin", "android_${variant.name}.apk")) } } + +$$GRADLE_PLUGINS$$ diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index c828045179..d4d54b1ce8 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -74,9 +74,10 @@ def configure(env): elif (env["target"] == "release_debug"): env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED']) elif (env["target"] == "debug"): - env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED']) - #env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g4', '-DDEBUG_ENABLED']) + #env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED']) + env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g3', '-DDEBUG_ENABLED']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']) + env.Append(LINKFLAGS=['--profiling-funcs']) # TODO: Move that to opus module's config if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"): diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index 9b9fa6cfa8..db822ed306 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -135,7 +135,7 @@ void TouchScreenButton::_notification(int p_what) { update(); if (!get_tree()->is_editor_hint()) - set_process_input(true); + set_process_input(is_visible_in_tree()); if (action.operator String() != "" && InputMap::get_singleton()->has_action(action)) { action_id = InputMap::get_singleton()->get_action_id(action); @@ -147,10 +147,21 @@ void TouchScreenButton::_notification(int p_what) { if (is_pressed()) _release(true); } break; + case NOTIFICATION_VISIBILITY_CHANGED: { + if (get_tree()->is_editor_hint()) + break; + if (is_visible_in_tree()) { + set_process_input(true); + } else { + set_process_input(false); + if (is_pressed()) + _release(); + } + } break; case NOTIFICATION_PAUSED: { - // So the button can be pressed again even though the release gets unhandled because of coming during pause - allow_repress = true; - } + if (is_pressed()) + _release(); + } break; } } @@ -230,7 +241,7 @@ void TouchScreenButton::_input(const InputEvent &p_event) { if (!is_visible_in_tree()) return; - const bool can_press = finger_pressed == -1 || allow_repress; + const bool can_press = finger_pressed == -1; if (!can_press) return; //already fingering @@ -276,7 +287,6 @@ void TouchScreenButton::_input(const InputEvent &p_event) { void TouchScreenButton::_press(int p_finger_pressed) { finger_pressed = p_finger_pressed; - allow_repress = false; if (action_id != -1) { @@ -394,7 +404,6 @@ void TouchScreenButton::_bind_methods() { TouchScreenButton::TouchScreenButton() { finger_pressed = -1; - allow_repress = false; action_id = -1; passby_press = false; visibility = VISIBILITY_ALWAYS; diff --git a/scene/2d/screen_button.h b/scene/2d/screen_button.h index d648920b21..201d908bf6 100644 --- a/scene/2d/screen_button.h +++ b/scene/2d/screen_button.h @@ -56,7 +56,6 @@ private: StringName action; bool passby_press; int finger_pressed; - bool allow_repress; int action_id; VisibilityMode visibility; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 7779391bae..2f40f0acec 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -692,7 +692,7 @@ Size2 Control::get_minimum_size() const { if (si) { Variant::CallError ce; - Variant s = si->call(SceneStringNames::get_singleton()->get_minimum_size, NULL, 0, ce); + Variant s = si->call(SceneStringNames::get_singleton()->_get_minimum_size, NULL, 0, ce); if (ce.error == Variant::CallError::CALL_OK) return s; } @@ -2419,7 +2419,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("_font_changed"), &Control::_font_changed); BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::INPUT_EVENT, "event"))); - BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "get_minimum_size")); + BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_get_minimum_size")); BIND_VMETHOD(MethodInfo(Variant::OBJECT, "get_drag_data", PropertyInfo(Variant::VECTOR2, "pos"))); BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data"))); BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data"))); diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index d081eda86d..a58e62f061 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -31,6 +31,10 @@ #include "print_string.h" #include "translation.h" +#ifdef TOOLS_ENABLED +#include "editor/editor_node.h" +#endif + void WindowDialog::_post_popup() { drag_type = DRAG_NONE; // just in case @@ -199,6 +203,16 @@ void WindowDialog::_notification(int p_what) { set_default_cursor_shape(CURSOR_ARROW); } } break; +#ifdef TOOLS_ENABLED + case NOTIFICATION_POST_POPUP: { + if (get_tree() && get_tree()->is_editor_hint() && EditorNode::get_singleton()) + EditorNode::get_singleton()->dim_editor(true); + } break; + case NOTIFICATION_POPUP_HIDE: { + if (get_tree() && get_tree()->is_editor_hint() && EditorNode::get_singleton()) + EditorNode::get_singleton()->dim_editor(false); + } break; +#endif } } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 20c7d8f221..600dc8737d 100755 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2499,8 +2499,11 @@ void Node::_replace_connections_target(Node *p_new_target) { Connection &c = E->get(); - c.source->disconnect(c.signal, this, c.method); - c.source->connect(c.signal, p_new_target, c.method, c.binds, c.flags); + if (c.flags & CONNECT_PERSIST) { + c.source->disconnect(c.signal, this, c.method); + ERR_CONTINUE(!p_new_target->has_method(c.method)); + c.source->connect(c.signal, p_new_target, c.method, c.binds, c.flags); + } } } diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 0c2f07aa4a..e46d9db7bc 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -995,12 +995,12 @@ int SceneState::find_node_by_path(const NodePath &p_node) const { if (_get_base_scene_state().is_valid()) { int idx = _get_base_scene_state()->find_node_by_path(p_node); if (idx >= 0) { - if (!base_scene_node_remap.has(idx)) { - int ridx = nodes.size() + base_scene_node_remap.size(); - base_scene_node_remap[ridx] = idx; + int rkey = _find_base_scene_node_remap_key(idx); + if (rkey == -1) { + rkey = nodes.size() + base_scene_node_remap.size(); + base_scene_node_remap[rkey] = idx; } - - return base_scene_node_remap[idx]; + return rkey; } } return -1; @@ -1013,11 +1013,24 @@ int SceneState::find_node_by_path(const NodePath &p_node) const { //the node in the instanced scene, as a property may be missing //from the local one int idx = _get_base_scene_state()->find_node_by_path(p_node); - base_scene_node_remap[nid] = idx; + if (idx != -1) { + base_scene_node_remap[nid] = idx; + } } return nid; } + +int SceneState::_find_base_scene_node_remap_key(int p_idx) const { + + for (Map<int, int>::Element *E = base_scene_node_remap.front(); E; E = E->next()) { + if (E->value() == p_idx) { + return E->key(); + } + } + return -1; +} + Variant SceneState::get_property_value(int p_node, const StringName &p_property, bool &found) const { found = false; diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index 5fa54413a8..b0e89205cb 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -100,6 +100,8 @@ class SceneState : public Reference { PoolVector<String> _get_node_groups(int p_idx) const; + int _find_base_scene_node_remap_key(int p_idx) const; + protected: static void _bind_methods(); diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 49e987727d..28b8490cb4 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -1469,6 +1469,7 @@ const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={ {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"PointCoord","POINT_COORD","",SLOT_TYPE_VEC,SLOT_IN}, + {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Position","POSITION","",SLOT_TYPE_VEC,SLOT_IN}, //canvas item fragment out {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, @@ -1489,6 +1490,7 @@ const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={ {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"PointCoord","POINT_COORD","",SLOT_TYPE_VEC,SLOT_IN}, + {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Position","POSITION","",SLOT_TYPE_VEC,SLOT_IN}, //canvas item light out {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightColor","LIGHT.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightAlpha","LIGHT.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index ae939ead5f..f0a33e0d3b 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -145,7 +145,7 @@ SceneStringNames::SceneStringNames() { _update_remote = StaticCString::create("_update_remote"); _update_pairs = StaticCString::create("_update_pairs"); - get_minimum_size = StaticCString::create("get_minimum_size"); + _get_minimum_size = StaticCString::create("_get_minimum_size"); area_entered = StaticCString::create("area_entered"); area_exited = StaticCString::create("area_exited"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index e16e1e04e6..8900bbe1d9 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -167,7 +167,7 @@ public: StringName area_entered; StringName area_exited; - StringName get_minimum_size; + StringName _get_minimum_size; StringName play_play; diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 5419c5cfe7..8f45d0966f 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -864,39 +864,39 @@ void AudioServer::remove_callback(AudioCallback p_callback, void *p_userdata) { unlock(); } -void AudioServer::set_bus_layout(const Ref<AudioBusLayout> &p_state) { +void AudioServer::set_bus_layout(const Ref<AudioBusLayout> &p_bus_layout) { - ERR_FAIL_COND(p_state.is_null() || p_state->buses.size() == 0); + ERR_FAIL_COND(p_bus_layout.is_null() || p_bus_layout->buses.size() == 0); lock(); for (int i = 0; i < buses.size(); i++) { memdelete(buses[i]); } - buses.resize(p_state->buses.size()); + buses.resize(p_bus_layout->buses.size()); bus_map.clear(); - for (int i = 0; i < p_state->buses.size(); i++) { + for (int i = 0; i < p_bus_layout->buses.size(); i++) { Bus *bus = memnew(Bus); if (i == 0) { bus->name = "Master"; } else { - bus->name = p_state->buses[i].name; - bus->send = p_state->buses[i].send; + bus->name = p_bus_layout->buses[i].name; + bus->send = p_bus_layout->buses[i].send; } - bus->solo = p_state->buses[i].solo; - bus->mute = p_state->buses[i].mute; - bus->bypass = p_state->buses[i].bypass; - bus->volume_db = p_state->buses[i].volume_db; + bus->solo = p_bus_layout->buses[i].solo; + bus->mute = p_bus_layout->buses[i].mute; + bus->bypass = p_bus_layout->buses[i].bypass; + bus->volume_db = p_bus_layout->buses[i].volume_db; - for (int j = 0; j < p_state->buses[i].effects.size(); j++) { + for (int j = 0; j < p_bus_layout->buses[i].effects.size(); j++) { - Ref<AudioEffect> fx = p_state->buses[i].effects[j].effect; + Ref<AudioEffect> fx = p_bus_layout->buses[i].effects[j].effect; if (fx.is_valid()) { Bus::Effect bfx; bfx.effect = fx; - bfx.enabled = p_state->buses[i].effects[j].enabled; + bfx.enabled = p_bus_layout->buses[i].effects[j].enabled; bus->effects.push_back(bfx); } } @@ -988,8 +988,8 @@ void AudioServer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_speaker_mode"), &AudioServer::get_speaker_mode); ClassDB::bind_method(D_METHOD("get_mix_rate"), &AudioServer::get_mix_rate); - ClassDB::bind_method(D_METHOD("set_state", "state:AudioServerState"), &AudioServer::set_bus_layout); - ClassDB::bind_method(D_METHOD("generate_state:AudioServerState"), &AudioServer::generate_bus_layout); + ClassDB::bind_method(D_METHOD("set_bus_layout", "bus_layout:AudioBusLayout"), &AudioServer::set_bus_layout); + ClassDB::bind_method(D_METHOD("generate_bus_layout:AudioBusLayout"), &AudioServer::generate_bus_layout); ADD_SIGNAL(MethodInfo("bus_layout_changed")); } diff --git a/servers/audio_server.h b/servers/audio_server.h index 46f845f2d4..eed0a5e4c6 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -275,7 +275,7 @@ public: void add_callback(AudioCallback p_callback, void *p_userdata); void remove_callback(AudioCallback p_callback, void *p_userdata); - void set_bus_layout(const Ref<AudioBusLayout> &p_state); + void set_bus_layout(const Ref<AudioBusLayout> &p_bus_layout); Ref<AudioBusLayout> generate_bus_layout() const; AudioServer(); diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index cd9afa7735..c5e31b235a 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -138,7 +138,7 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["TIME"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["SRC_COLOR"] = ShaderLanguage::TYPE_VEC4; - shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["POSITION"] = ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["POSITION"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["NORMAL"] = ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["NORMALMAP"] = ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["NORMALMAP_DEPTH"] = ShaderLanguage::TYPE_FLOAT; @@ -150,7 +150,7 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["POINT_COORD"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["TIME"] = ShaderLanguage::TYPE_FLOAT; - shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["POSITION"] = ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["POSITION"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["NORMAL"] = ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["UV"] = ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["COLOR"] = ShaderLanguage::TYPE_VEC4; |