diff options
36 files changed, 189 insertions, 101 deletions
diff --git a/core/io/image_loader.h b/core/io/image_loader.h index 561f275e0c..d95a483c0d 100644 --- a/core/io/image_loader.h +++ b/core/io/image_loader.h @@ -71,7 +71,7 @@ public: class ImageLoader { enum { - MAX_LOADERS = 8 + MAX_LOADERS = 32 }; friend class ResourceFormatLoaderImage; static ImageFormatLoader *loader[MAX_LOADERS]; diff --git a/core/io/ip_address.cpp b/core/io/ip_address.cpp index 6d979d10eb..194d1af6bf 100644 --- a/core/io/ip_address.cpp +++ b/core/io/ip_address.cpp @@ -184,7 +184,7 @@ bool IP_Address::is_ipv4() const { } const uint8_t *IP_Address::get_ipv4() const { - ERR_FAIL_COND_V(!is_ipv4(), 0); + ERR_FAIL_COND_V(!is_ipv4(), &(field8[12])); // Not the correct IPv4 (it's an IPv6), but we don't want to return a null pointer risking an engine crash. return &(field8[12]); } diff --git a/core/object.cpp b/core/object.cpp index 1eff56f026..ea77090a45 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1941,30 +1941,30 @@ Object::~Object() { memdelete(script_instance); script_instance = NULL; - List<Connection> sconnections; const StringName *S = NULL; - while ((S = signal_map.next(S))) { + while ((S = signal_map.next(NULL))) { Signal *s = &signal_map[*S]; - ERR_EXPLAIN("Attempt to delete an object in the middle of a signal emission from it"); - ERR_CONTINUE(s->lock > 0); - - for (int i = 0; i < s->slot_map.size(); i++) { - - sconnections.push_back(s->slot_map.getv(i).conn); + if (s->lock) { + ERR_EXPLAIN("Attempt to delete an object in the middle of a signal emission from it"); + ERR_CONTINUE(s->lock > 0); } - } - for (List<Connection>::Element *E = sconnections.front(); E; E = E->next()) { + //brute force disconnect for performance + int slot_count = s->slot_map.size(); + const VMap<Signal::Target, Signal::Slot>::Pair *slot_list = s->slot_map.get_array(); - Connection &c = E->get(); - ERR_CONTINUE(c.source != this); //bug? + for (int i = 0; i < slot_count; i++) { + + slot_list[i].value.conn.target->connections.erase(slot_list[i].value.cE); + } - this->_disconnect(c.signal, c.target, c.method, true); + signal_map.erase(*S); } + //signals from nodes that connect to this node while (connections.size()) { Connection c = connections.front()->get(); diff --git a/core/os/input.cpp b/core/os/input.cpp index 1a24258a10..3b895b16b4 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -86,7 +86,7 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("set_mouse_mode", "mode"), &Input::set_mouse_mode); ClassDB::bind_method(D_METHOD("get_mouse_mode"), &Input::get_mouse_mode); ClassDB::bind_method(D_METHOD("warp_mouse_position", "to"), &Input::warp_mouse_position); - ClassDB::bind_method(D_METHOD("action_press", "action", "strength"), &Input::action_press); + ClassDB::bind_method(D_METHOD("action_press", "action", "strength"), &Input::action_press, DEFVAL(1.f)); ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release); ClassDB::bind_method(D_METHOD("set_default_cursor_shape", "shape"), &Input::set_default_cursor_shape, DEFVAL(CURSOR_ARROW)); ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "shape", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2())); diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 8693a584f2..8e363cd535 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -155,9 +155,7 @@ struct _VariantCall { funcdata.default_args = p_defaultarg; funcdata._const = p_const; funcdata.returns = p_has_return; -#ifdef DEBUG_ENABLED funcdata.return_type = p_return; -#endif if (p_argtype1.name) { funcdata.arg_types.push_back(p_argtype1.type); diff --git a/core/vmap.h b/core/vmap.h index 9fc99e636d..5f6d8190c6 100644 --- a/core/vmap.h +++ b/core/vmap.h @@ -36,22 +36,23 @@ template <class T, class V> class VMap { - - struct _Pair { +public: + struct Pair { T key; V value; - _FORCE_INLINE_ _Pair() {} + _FORCE_INLINE_ Pair() {} - _FORCE_INLINE_ _Pair(const T &p_key, const V &p_value) { + _FORCE_INLINE_ Pair(const T &p_key, const V &p_value) { key = p_key; value = p_value; } }; - CowData<_Pair> _cowdata; +private: + CowData<Pair> _cowdata; _FORCE_INLINE_ int _find(const T &p_val, bool &r_exact) const { @@ -61,7 +62,7 @@ class VMap { int low = 0; int high = _cowdata.size() - 1; - const _Pair *a = _cowdata.ptr(); + const Pair *a = _cowdata.ptr(); int middle = 0; #if DEBUG_ENABLED @@ -95,7 +96,7 @@ class VMap { int low = 0; int high = _cowdata.size() - 1; int middle; - const _Pair *a = _cowdata.ptr(); + const Pair *a = _cowdata.ptr(); while (low <= high) { middle = (low + high) / 2; @@ -121,7 +122,7 @@ public: _cowdata.get_m(pos).value = p_val; return pos; } - _cowdata.insert(pos, _Pair(p_key, p_val)); + _cowdata.insert(pos, Pair(p_key, p_val)); return pos; } @@ -152,12 +153,12 @@ public: _FORCE_INLINE_ int size() const { return _cowdata.size(); } _FORCE_INLINE_ bool empty() const { return _cowdata.empty(); } - const _Pair *get_array() const { + const Pair *get_array() const { return _cowdata.ptr(); } - _Pair *get_array() { + Pair *get_array() { return _cowdata.ptrw(); } diff --git a/doc/classes/ConfigFile.xml b/doc/classes/ConfigFile.xml index a4709c1c86..703043294b 100644 --- a/doc/classes/ConfigFile.xml +++ b/doc/classes/ConfigFile.xml @@ -25,6 +25,7 @@ # Save the changes by overwriting the previous file config.save("user://settings.cfg") [/codeblock] + Keep in mind that section and property names can't contain spaces. Anything after a space will be ignored on save and on load. </description> <tutorials> </tutorials> diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index bf395ee513..724e6a078d 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -17,10 +17,11 @@ </return> <argument index="0" name="action" type="String"> </argument> - <argument index="1" name="strength" type="float"> + <argument index="1" name="strength" type="float" default="1.0"> </argument> <description> - This will simulate pressing the specified action. The strength can be used for non-boolean actions. + This will simulate pressing the specified action. + The strength can be used for non-boolean actions, it's ranged between 0 and 1 representing the intensity of the given action. </description> </method> <method name="action_release"> diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index 0c0bf56793..6eafdb0e1c 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -605,7 +605,6 @@ bool RasterizerSceneGLES2::reflection_probe_instance_postprocess_step(RID p_inst size >>= 1; int mipmaps = 6; - int mm_level = mipmaps - 1; storage->shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES2::USE_SOURCE_PANORAMA, false); storage->shaders.cubemap_filter.bind(); @@ -628,8 +627,6 @@ bool RasterizerSceneGLES2::reflection_probe_instance_postprocess_step(RID p_inst size >>= 1; - mm_level--; - lod++; } diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 060988fbea..d646500a23 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -1497,8 +1497,9 @@ Variant RasterizerStorageGLES2::material_get_param_default(RID p_material, const if (material->shader) { if (material->shader->uniforms.has(p_param)) { - Vector<ShaderLanguage::ConstantNode::Value> default_value = material->shader->uniforms[p_param].default_value; - return ShaderLanguage::constant_value_to_variant(default_value, material->shader->uniforms[p_param].type); + ShaderLanguage::ShaderNode::Uniform uniform = material->shader->uniforms[p_param]; + Vector<ShaderLanguage::ConstantNode::Value> default_value = uniform.default_value; + return ShaderLanguage::constant_value_to_variant(default_value, uniform.type, uniform.hint); } } return Variant(); diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index c76db83c0c..4166cb8361 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1221,8 +1221,6 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons bool rebind_shader = true; - state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_DISTANCE_FIELD, false); - glBindBuffer(GL_UNIFORM_BUFFER, state.canvas_item_ubo); glBufferData(GL_UNIFORM_BUFFER, sizeof(CanvasItemUBO), &state.canvas_item_ubo_data, GL_DYNAMIC_DRAW); glBindBuffer(GL_UNIFORM_BUFFER, 0); @@ -1340,7 +1338,7 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons last_blend_mode = last_blend_mode != RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_DISABLED ? last_blend_mode : -1; } - if (shader_ptr != shader_cache) { + if (shader_ptr != shader_cache || rebind_shader) { if (shader_ptr->canvas_item.uses_time) { VisualServerRaster::redraw_request(); @@ -1657,6 +1655,14 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons if (current_clip) { glDisable(GL_SCISSOR_TEST); } + //disable states that may have been used + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_DISTANCE_FIELD, false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_SKELETON, false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_INSTANCE_CUSTOM, false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_PARTICLES, false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_INSTANCING, false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_LIGHTING, false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_SHADOWS, false); } void RasterizerCanvasGLES3::canvas_debug_viewport_shadows(Light *p_lights_with_shadow) { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 7ca7d8a471..64e04eec71 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2253,8 +2253,9 @@ Variant RasterizerStorageGLES3::material_get_param_default(RID p_material, const if (material->shader) { if (material->shader->uniforms.has(p_param)) { - Vector<ShaderLanguage::ConstantNode::Value> default_value = material->shader->uniforms[p_param].default_value; - return ShaderLanguage::constant_value_to_variant(default_value, material->shader->uniforms[p_param].type); + ShaderLanguage::ShaderNode::Uniform uniform = material->shader->uniforms[p_param]; + Vector<ShaderLanguage::ConstantNode::Value> default_value = uniform.default_value; + return ShaderLanguage::constant_value_to_variant(default_value, uniform.type, uniform.hint); } } return Variant(); diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index 799179e8d4..404a9107ab 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -219,20 +219,15 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() { strings.push_back("#version 300 es\n"); #endif - int define_line_ofs = 1; - for (int i = 0; i < custom_defines.size(); i++) { strings.push_back(custom_defines[i].get_data()); - define_line_ofs++; } for (int j = 0; j < conditional_count; j++) { bool enable = ((1 << j) & conditional_version.version); strings.push_back(enable ? conditional_defines[j] : ""); - if (enable) - define_line_ofs++; if (enable) { DEBUG_PRINT(conditional_defines[j]); @@ -253,7 +248,6 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() { ERR_FAIL_COND_V(!custom_code_map.has(conditional_version.code_version), NULL); cc = &custom_code_map[conditional_version.code_version]; v.code_version = cc->version; - define_line_ofs += 2; } /* CREATE PROGRAM */ diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index d78316945f..010f7bdb0a 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -346,9 +346,9 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { for (int j = 0; j < ad->pa_map.channels - 1; j++) { ad->samples_out.write[out_idx++] = ad->samples_in[in_idx++] >> 16; } - uint32_t l = ad->samples_in[in_idx++]; - uint32_t r = ad->samples_in[in_idx++]; - ad->samples_out.write[out_idx++] = ((l >> 1) + (r >> 1)) >> 16; + uint32_t l = ad->samples_in[in_idx++] >> 16; + uint32_t r = ad->samples_in[in_idx++] >> 16; + ad->samples_out.write[out_idx++] = (l + r) / 2; } } } diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp index f981be66ce..833b17f122 100644 --- a/drivers/unix/net_socket_posix.cpp +++ b/drivers/unix/net_socket_posix.cpp @@ -110,7 +110,7 @@ size_t NetSocketPosix::_set_addr_storage(struct sockaddr_storage *p_addr, const } else { // IPv4 socket // IPv4 socket with IPv6 address - ERR_FAIL_COND_V(!p_ip.is_ipv4(), 0); + ERR_FAIL_COND_V(!p_ip.is_wildcard() && !p_ip.is_ipv4(), 0); struct sockaddr_in *addr4 = (struct sockaddr_in *)p_addr; addr4->sin_family = AF_INET; @@ -122,7 +122,6 @@ size_t NetSocketPosix::_set_addr_storage(struct sockaddr_storage *p_addr, const addr4->sin_addr.s_addr = INADDR_ANY; } - copymem(&addr4->sin_addr.s_addr, p_ip.get_ipv4(), 4); return sizeof(sockaddr_in); } } diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index c4516c1f17..926fa37040 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -118,8 +118,10 @@ void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) { if (enable_rl) { search_options->add_constant_override("draw_relationship_lines", 1); search_options->add_color_override("relationship_line_color", rl_color); + search_options->add_constant_override("draw_guides", 0); } else { search_options->add_constant_override("draw_relationship_lines", 0); + search_options->add_constant_override("draw_guides", 1); } is_replace_mode = p_replace_mode; diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 2f2840192a..14abaa835c 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -209,7 +209,6 @@ EditorAbout::EditorAbout() { TreeItem *tpl_ti_lc = _tpl_tree->create_item(root); tpl_ti_lc->set_text(0, TTR("Licenses")); tpl_ti_lc->set_selectable(0, false); - int read_idx = 0; String long_text = ""; for (int component_index = 0; component_index < COPYRIGHT_INFO_COUNT; component_index++) { @@ -234,7 +233,6 @@ EditorAbout::EditorAbout() { String license = "\n License: " + String(part.license) + "\n"; text += license; long_text += license + "\n"; - read_idx++; } ti->set_metadata(0, text); } diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp index eec4438f96..011fe20564 100644 --- a/editor/editor_folding.cpp +++ b/editor/editor_folding.cpp @@ -165,7 +165,7 @@ void EditorFolding::load_scene_folding(Node *p_scene, const String &p_path) { } bool EditorFolding::has_folding_data(const String &p_path) { - String path = EditorSettings::get_singleton()->get_project_settings_dir(); + String file = p_path.get_file() + "-folding-" + p_path.md5_text() + ".cfg"; file = EditorSettings::get_singleton()->get_project_settings_dir().plus_file(file); return FileAccess::exists(file); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 3ee8d9c6c5..de1f856608 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -399,8 +399,10 @@ void EditorHelpIndex::_notification(int p_what) { if (enable_rl) { class_list->add_constant_override("draw_relationship_lines", 1); class_list->add_color_override("relationship_line_color", rl_color); + class_list->add_constant_override("draw_guides", 0); } else { class_list->add_constant_override("draw_relationship_lines", 0); + class_list->add_constant_override("draw_guides", 1); } } } diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index d6f337cc20..a564a2a113 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1153,6 +1153,11 @@ void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { + Ref<Font> font = get_font("font", "Tree"); + if (mb->get_position().y > font->get_height()) { //clicked outside + return; + } + _test_unfold(); bool unfold = !object->editor_is_section_unfolded(section); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 9c1d22f6ec..3730807243 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2145,7 +2145,8 @@ void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<T } } -void EditorPropertyResource::_update_menu() { +void EditorPropertyResource::_update_menu_items() { + //////////////////// UPDATE MENU ////////////////////////// RES res = get_edited_object()->get(get_edited_property()); @@ -2287,6 +2288,11 @@ void EditorPropertyResource::_update_menu() { menu->add_icon_item(icon, vformat(TTR("Convert To %s"), what), CONVERT_BASE_ID + i); } } +} + +void EditorPropertyResource::_update_menu() { + + _update_menu_items(); Rect2 gt = edit->get_global_rect(); menu->set_as_minsize(); @@ -2311,6 +2317,20 @@ void EditorPropertyResource::_sub_inspector_object_id_selected(int p_id) { emit_signal("object_id_selected", get_edited_property(), p_id); } +void EditorPropertyResource::_button_input(const Ref<InputEvent> &p_event) { + Ref<InputEventMouseButton> mb = p_event; + if (mb.is_valid()) { + if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) { + _update_menu_items(); + Vector2 pos = mb->get_global_position(); + //pos = assign->get_global_transform().xform(pos); + menu->set_as_minsize(); + menu->set_global_position(pos); + menu->popup(); + } + } +} + void EditorPropertyResource::_open_editor_pressed() { RES res = get_edited_object()->get(get_edited_property()); if (res.is_valid()) { @@ -2598,6 +2618,7 @@ void EditorPropertyResource::_bind_methods() { ClassDB::bind_method(D_METHOD("drop_data_fw"), &EditorPropertyResource::drop_data_fw); ClassDB::bind_method(D_METHOD("_button_draw"), &EditorPropertyResource::_button_draw); ClassDB::bind_method(D_METHOD("_open_editor_pressed"), &EditorPropertyResource::_open_editor_pressed); + ClassDB::bind_method(D_METHOD("_button_input"), &EditorPropertyResource::_button_input); } EditorPropertyResource::EditorPropertyResource() { @@ -2624,6 +2645,7 @@ EditorPropertyResource::EditorPropertyResource() { preview->set_margin(MARGIN_BOTTOM, -1); preview->set_margin(MARGIN_RIGHT, -1); assign->add_child(preview); + assign->connect("gui_input", this, "_button_input"); menu = memnew(PopupMenu); add_child(menu); @@ -2632,6 +2654,7 @@ EditorPropertyResource::EditorPropertyResource() { menu->connect("id_pressed", this, "_menu_option"); edit->connect("pressed", this, "_update_menu"); hbc->add_child(edit); + edit->connect("gui_input", this, "_button_input"); file = NULL; scene_tree = NULL; diff --git a/editor/editor_properties.h b/editor/editor_properties.h index 35d8f4d306..541abb1f22 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -552,6 +552,8 @@ class EditorPropertyResource : public EditorProperty { void _resource_selected(); void _viewport_selected(const NodePath &p_path); + void _update_menu_items(); + void _update_menu(); void _sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool); @@ -564,6 +566,7 @@ class EditorPropertyResource : public EditorProperty { bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); + void _button_input(const Ref<InputEvent> &p_event); void _open_editor_pressed(); protected: diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp index be4e752d55..420d8ad3cf 100644 --- a/editor/multi_node_edit.cpp +++ b/editor/multi_node_edit.cpp @@ -52,7 +52,7 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value, UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("MultiNode Set") + " " + String(name)); + ur->create_action(TTR("MultiNode Set") + " " + String(name), UndoRedo::MERGE_ENDS); for (const List<NodePath>::Element *E = nodes.front(); E; E = E->next()) { if (!es->has_node(E->get())) diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 6614e24df7..95f0c4870e 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -980,8 +980,11 @@ void SceneTreeEditor::_editor_settings_changed() { if (enable_rl) { tree->add_constant_override("draw_relationship_lines", 1); tree->add_color_override("relationship_line_color", rl_color); - } else + tree->add_constant_override("draw_guides", 0); + } else { tree->add_constant_override("draw_relationship_lines", 0); + tree->add_constant_override("draw_guides", 1); + } } void SceneTreeEditor::_bind_methods() { diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 089ffa285d..faa561ad54 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1041,8 +1041,11 @@ void ScriptEditorDebugger::_notification(int p_what) { if (enable_rl) { inspect_scene_tree->add_constant_override("draw_relationship_lines", 1); inspect_scene_tree->add_color_override("relationship_line_color", rl_color); - } else + inspect_scene_tree->add_constant_override("draw_guides", 0); + } else { inspect_scene_tree->add_constant_override("draw_relationship_lines", 0); + inspect_scene_tree->add_constant_override("draw_guides", 1); + } } break; case NOTIFICATION_PROCESS: { diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 31115a4bd9..c67cf124c0 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -477,56 +477,53 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a GET_VARIANT_PTR(dst, 3); #ifdef DEBUG_ENABLED - if (a->get_type() != Variant::OBJECT || a->operator Object *() == NULL) { - - err_text = "Left operand of 'is' is not an instance of anything."; - OPCODE_BREAK; - } if (b->get_type() != Variant::OBJECT || b->operator Object *() == NULL) { err_text = "Right operand of 'is' is not a class."; OPCODE_BREAK; } #endif - Object *obj_A = *a; - Object *obj_B = *b; - - GDScript *scr_B = Object::cast_to<GDScript>(obj_B); bool extends_ok = false; + if (a->get_type() == Variant::OBJECT && a->operator Object *() != NULL) { + Object *obj_A = *a; + Object *obj_B = *b; - if (scr_B) { - //if B is a script, the only valid condition is that A has an instance which inherits from the script - //in other situation, this shoul return false. + GDScript *scr_B = Object::cast_to<GDScript>(obj_B); - if (obj_A->get_script_instance() && obj_A->get_script_instance()->get_language() == GDScriptLanguage::get_singleton()) { + if (scr_B) { + //if B is a script, the only valid condition is that A has an instance which inherits from the script + //in other situation, this shoul return false. - GDScript *cmp = static_cast<GDScript *>(obj_A->get_script_instance()->get_script().ptr()); - //bool found=false; - while (cmp) { + if (obj_A->get_script_instance() && obj_A->get_script_instance()->get_language() == GDScriptLanguage::get_singleton()) { - if (cmp == scr_B) { - //inherits from script, all ok - extends_ok = true; - break; - } + GDScript *cmp = static_cast<GDScript *>(obj_A->get_script_instance()->get_script().ptr()); + //bool found=false; + while (cmp) { - cmp = cmp->_base; + if (cmp == scr_B) { + //inherits from script, all ok + extends_ok = true; + break; + } + + cmp = cmp->_base; + } } - } - } else { + } else { - GDScriptNativeClass *nc = Object::cast_to<GDScriptNativeClass>(obj_B); + GDScriptNativeClass *nc = Object::cast_to<GDScriptNativeClass>(obj_B); #ifdef DEBUG_ENABLED - if (!nc) { + if (!nc) { - err_text = "Right operand of 'is' is not a class (type: '" + obj_B->get_class() + "')."; - OPCODE_BREAK; - } + err_text = "Right operand of 'is' is not a class (type: '" + obj_B->get_class() + "')."; + OPCODE_BREAK; + } #endif - extends_ok = ClassDB::is_parent_class(obj_A->get_class_name(), nc->get_name()); + extends_ok = ClassDB::is_parent_class(obj_A->get_class_name(), nc->get_name()); + } } *dst = extends_ok; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 09b3a5631f..a4bda42b16 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -6432,6 +6432,10 @@ bool GDScriptParser::_get_function_signature(DataType &p_base_type, const String StringName native; if (p_base_type.kind == DataType::GDSCRIPT) { base_gdscript = p_base_type.script_type; + if (base_gdscript.is_null() || !base_gdscript->is_valid()) { + // GDScript wasn't properly compíled, don't bother trying + return false; + } } else if (p_base_type.kind == DataType::SCRIPT) { base_script = p_base_type.script_type; } else if (p_base_type.kind == DataType::NATIVE) { @@ -6472,6 +6476,12 @@ bool GDScriptParser::_get_function_signature(DataType &p_base_type, const String base_script = base_script->get_base_script(); } + if (native == StringName()) { + // Empty native class, might happen in some Script implementations + // Just ignore it + return false; + } + #ifdef DEBUG_METHODS_ENABLED // Only native remains @@ -6914,6 +6924,10 @@ bool GDScriptParser::_get_member_type(const DataType &p_base_type, const StringN Ref<GDScript> gds; if (base_type.kind == DataType::GDSCRIPT) { gds = base_type.script_type; + if (gds.is_null() || !gds->is_valid()) { + // GDScript wasn't properly compíled, don't bother trying + return false; + } } Ref<Script> scr; @@ -6976,6 +6990,12 @@ bool GDScriptParser::_get_member_type(const DataType &p_base_type, const StringN scr = scr->get_base_script(); } + if (native == StringName()) { + // Empty native class, might happen in some Script implementations + // Just ignore it + return false; + } + // Check ClassDB if (!ClassDB::class_exists(native)) { native = "_" + native.operator String(); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 81dc861f3f..8123aaa427 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1237,7 +1237,9 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a ERR_FAIL_COND_V(window_object == nil, ERR_UNAVAILABLE); window_view = [[GodotContentView alloc] init]; - [window_view setWantsLayer:TRUE]; + if (@available(macOS 10.14, *)) { + [window_view setWantsLayer:TRUE]; + } float displayScale = 1.0; if (is_hidpi_allowed()) { diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp index 2c362f1b31..1c504d00fc 100644 --- a/scene/2d/skeleton_2d.cpp +++ b/scene/2d/skeleton_2d.cpp @@ -298,6 +298,7 @@ Skeleton2D::Skeleton2D() { transform_dirty = true; skeleton = VS::get_singleton()->skeleton_create(); + set_notify_transform(true); } Skeleton2D::~Skeleton2D() { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 31f7a21114..c083e727d1 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -901,6 +901,7 @@ void Tree::update_cache() { cache.item_margin = get_constant("item_margin"); cache.button_margin = get_constant("button_margin"); cache.guide_width = get_constant("guide_width"); + cache.draw_guides = get_constant("draw_guides"); cache.draw_relationship_lines = get_constant("draw_relationship_lines"); cache.relationship_line_color = get_color("relationship_line_color"); cache.scroll_border = get_constant("scroll_border"); @@ -1132,7 +1133,9 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 cell_rect.size.x += cache.hseparation; } - VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(cell_rect.position.x, cell_rect.position.y + cell_rect.size.height), cell_rect.position + cell_rect.size, cache.guide_color, 1); + if (cache.draw_guides) { + VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(cell_rect.position.x, cell_rect.position.y + cell_rect.size.height), cell_rect.position + cell_rect.size, cache.guide_color, 1); + } if (i == 0) { diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 34138acb85..886ce66e2c 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -434,6 +434,7 @@ private: int button_margin; Point2 offset; int draw_relationship_lines; + int draw_guides; int scroll_border; int scroll_speed; diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 3242068bf7..ae2ab2af80 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -157,7 +157,7 @@ void Node::_notification(int p_notification) { // kill children as cleanly as possible while (data.children.size()) { - Node *child = data.children[0]; + Node *child = data.children[data.children.size() - 1]; //begin from the end because its faster and more consistent with creation remove_child(child); memdelete(child); } @@ -1182,13 +1182,24 @@ void Node::remove_child(Node *p_child) { ERR_FAIL_COND(data.blocked > 0); } + int child_count = data.children.size(); + Node **children = data.children.ptrw(); int idx = -1; - for (int i = 0; i < data.children.size(); i++) { - if (data.children[i] == p_child) { + if (p_child->data.pos >= 0 && p_child->data.pos < child_count) { + if (children[p_child->data.pos] == p_child) { + idx = p_child->data.pos; + } + } + + if (idx == -1) { //maybe removed while unparenting or something and index was not updated, so just in case the above fails, try this. + for (int i = 0; i < child_count; i++) { - idx = i; - break; + if (children[i] == p_child) { + + idx = i; + break; + } } } @@ -1205,10 +1216,14 @@ void Node::remove_child(Node *p_child) { data.children.remove(idx); - for (int i = idx; i < data.children.size(); i++) { + //update pointer and size + child_count = data.children.size(); + children = data.children.ptrw(); - data.children[i]->data.pos = i; - data.children[i]->notification(NOTIFICATION_MOVED_IN_PARENT); + for (int i = idx; i < child_count; i++) { + + children[i]->data.pos = i; + children[i]->notification(NOTIFICATION_MOVED_IN_PARENT); } p_child->data.parent = NULL; diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 4de47b2cb0..fff136cdc3 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -653,6 +653,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_constant("item_margin", "Tree", 12 * scale); theme->set_constant("button_margin", "Tree", 4 * scale); theme->set_constant("draw_relationship_lines", "Tree", 0); + theme->set_constant("draw_guides", "Tree", 1); theme->set_constant("scroll_border", "Tree", 4); theme->set_constant("scroll_speed", "Tree", 12); diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp index a6a52c7bba..347bca4400 100644 --- a/scene/resources/sky_box.cpp +++ b/scene/resources/sky_box.cpp @@ -190,9 +190,15 @@ Ref<Image> ProceduralSky::_generate_sky() { float c = (v_angle - (Math_PI * 0.5)) / (Math_PI * 0.5); color = ground_horizon_linear.linear_interpolate(ground_bottom_linear, Math::ease(c, ground_curve)); + color.r *= ground_energy; + color.g *= ground_energy; + color.b *= ground_energy; } else { float c = v_angle / (Math_PI * 0.5); color = sky_horizon_linear.linear_interpolate(sky_top_linear, Math::ease(1.0 - c, sky_curve)); + color.r *= sky_energy; + color.g *= sky_energy; + color.b *= sky_energy; float sun_angle = Math::rad2deg(Math::acos(CLAMP(sun.dot(normal), -1.0, 1.0))); diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 0783d91a59..358ed8ca54 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2353,7 +2353,7 @@ bool ShaderLanguage::is_sampler_type(DataType p_type) { p_type == TYPE_SAMPLERCUBE; } -Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type) { +Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type, ShaderLanguage::ShaderNode::Uniform::Hint p_hint) { if (p_value.size() > 0) { Variant value; switch (p_type) { @@ -2397,7 +2397,11 @@ Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::C value = Variant(Vector3(p_value[0].real, p_value[1].real, p_value[2].real)); break; case ShaderLanguage::TYPE_VEC4: - value = Variant(Plane(p_value[0].real, p_value[1].real, p_value[2].real, p_value[3].real)); + if (p_hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) { + value = Variant(Color(p_value[0].real, p_value[1].real, p_value[2].real, p_value[3].real)); + } else { + value = Variant(Plane(p_value[0].real, p_value[1].real, p_value[2].real, p_value[3].real)); + } break; case ShaderLanguage::TYPE_MAT2: value = Variant(Transform2D(p_value[0].real, p_value[2].real, p_value[1].real, p_value[3].real, 0.0, 0.0)); diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h index 9277dfa2cf..b51106fad7 100644 --- a/servers/visual/shader_language.h +++ b/servers/visual/shader_language.h @@ -550,7 +550,7 @@ public: static int get_cardinality(DataType p_type); static bool is_scalar_type(DataType p_type); static bool is_sampler_type(DataType p_type); - static Variant constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type); + static Variant constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type, ShaderLanguage::ShaderNode::Uniform::Hint p_hint = ShaderLanguage::ShaderNode::Uniform::HINT_NONE); static void get_keyword_list(List<String> *r_keywords); static void get_builtin_funcs(List<String> *r_keywords); |