diff options
44 files changed, 184 insertions, 59 deletions
diff --git a/SConstruct b/SConstruct index 628aac42af..8b7b95a600 100644 --- a/SConstruct +++ b/SConstruct @@ -425,8 +425,13 @@ if selected_platform in platform_list: # (SH)LIBSUFFIX will be used for our own built libraries # LIBSUFFIXES contains LIBSUFFIX and SHLIBSUFFIX by default, # so we need to append the default suffixes to keep the ability - # to link against thirdparty libraries (.a, .so, .dll, etc.). - env["LIBSUFFIXES"] += [env["LIBSUFFIX"], env["SHLIBSUFFIX"]] + # to link against thirdparty libraries (.a, .so, .lib, etc.). + if os.name == "nt": + # On Windows, only static libraries and import libraries can be + # statically linked - both using .lib extension + env["LIBSUFFIXES"] += [env["LIBSUFFIX"]] + else: + env["LIBSUFFIXES"] += [env["LIBSUFFIX"], env["SHLIBSUFFIX"]] env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"] env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"] diff --git a/core/class_db.cpp b/core/class_db.cpp index 6565d242a2..052a4586fe 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -936,9 +936,8 @@ void ClassDB::add_property(StringName p_class, const PropertyInfo &p_pinfo, cons } #ifdef DEBUG_METHODS_ENABLED - if (type->property_setget.has(p_pinfo.name)) { - ERR_EXPLAIN("Object already has property: " + p_class); + ERR_EXPLAIN("Object " + p_class + " already has property: " + p_pinfo.name); ERR_FAIL(); } #endif diff --git a/core/dictionary.cpp b/core/dictionary.cpp index ccbdff3816..6a3ab82879 100644 --- a/core/dictionary.cpp +++ b/core/dictionary.cpp @@ -112,6 +112,15 @@ Variant Dictionary::get_valid(const Variant &p_key) const { return E.get(); } +Variant Dictionary::get(const Variant &p_key, const Variant &p_default) const { + const Variant *result = getptr(p_key); + if (!result) { + return p_default; + } + + return *result; +} + int Dictionary::size() const { return _p->variant_map.size(); diff --git a/core/dictionary.h b/core/dictionary.h index d3b98c2f63..b77cc55254 100644 --- a/core/dictionary.h +++ b/core/dictionary.h @@ -58,6 +58,7 @@ public: Variant *getptr(const Variant &p_key); Variant get_valid(const Variant &p_key) const; + Variant get(const Variant &p_key, const Variant &p_default) const; int size() const; bool empty() const; 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/variant_call.cpp b/core/variant_call.cpp index 8e363cd535..0c6e43fe36 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -484,6 +484,7 @@ struct _VariantCall { VCALL_LOCALMEM0R(Dictionary, keys); VCALL_LOCALMEM0R(Dictionary, values); VCALL_LOCALMEM1R(Dictionary, duplicate); + VCALL_LOCALMEM2R(Dictionary, get); VCALL_LOCALMEM2(Array, set); VCALL_LOCALMEM1R(Array, get); @@ -1677,6 +1678,7 @@ void register_variant_methods() { ADDFUNC0R(DICTIONARY, ARRAY, Dictionary, keys, varray()); ADDFUNC0R(DICTIONARY, ARRAY, Dictionary, values, varray()); ADDFUNC1R(DICTIONARY, DICTIONARY, Dictionary, duplicate, BOOL, "deep", varray(false)); + ADDFUNC2R(DICTIONARY, NIL, Dictionary, get, NIL, "key", NIL, "default", varray(Variant())); ADDFUNC0R(ARRAY, INT, Array, size, varray()); ADDFUNC0R(ARRAY, BOOL, Array, empty, varray()); diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index 06c996e13e..cc58c56404 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -87,6 +87,17 @@ Return the list of values in the [code]Dictionary[/code]. </description> </method> + <method name="get"> + <return type="Variant"> + </return> + <argument index="0" name="key" type="Variant"> + </argument> + <argument index="1" name="default" type="Variant" default="null"> + </argument> + <description> + Returns the current value for the specified key in the [code]Dictionary[/code]. If the key does not exist, the method returns the value of the optional default argument, or Null if it is omitted. + </description> + </method> </methods> <constants> </constants> diff --git a/doc/classes/PHashTranslation.xml b/doc/classes/PHashTranslation.xml index 18c72a0576..e5745375b0 100644 --- a/doc/classes/PHashTranslation.xml +++ b/doc/classes/PHashTranslation.xml @@ -17,6 +17,7 @@ <argument index="0" name="from" type="Translation"> </argument> <description> + Generates and sets an optimized translation from the given [Translation] resource. </description> </method> </methods> diff --git a/doc/classes/Translation.xml b/doc/classes/Translation.xml index c4e9dbfb70..b57f8f3556 100644 --- a/doc/classes/Translation.xml +++ b/doc/classes/Translation.xml @@ -7,6 +7,8 @@ Translations are resources that can be loaded/unloaded on demand. They map a string to another string. </description> <tutorials> + <link>https://docs.godotengine.org/en/stable/tutorials/i18n/internationalizing_games.html</link> + <link>https://docs.godotengine.org/en/stable/tutorials/i18n/locales.html</link> </tutorials> <demos> </demos> @@ -19,7 +21,7 @@ <argument index="1" name="xlated_message" type="String"> </argument> <description> - Add a message for translation. + Adds a message if nonexistent, followed by its translation. </description> </method> <method name="erase_message"> @@ -28,7 +30,7 @@ <argument index="0" name="src_message" type="String"> </argument> <description> - Erase a message. + Erases a message. </description> </method> <method name="get_message" qualifiers="const"> @@ -37,25 +39,27 @@ <argument index="0" name="src_message" type="String"> </argument> <description> - Return a message for translation. + Returns a message's translation. </description> </method> <method name="get_message_count" qualifiers="const"> <return type="int"> </return> <description> + Returns the number of existing messages. </description> </method> <method name="get_message_list" qualifiers="const"> <return type="PoolStringArray"> </return> <description> - Return all the messages (keys). + Returns all the messages (keys). </description> </method> </methods> <members> <member name="locale" type="String" setter="set_locale" getter="get_locale"> + The locale of the translation. </member> </members> <constants> diff --git a/doc/classes/TranslationServer.xml b/doc/classes/TranslationServer.xml index 52d2b2cc47..c2c400ccd5 100644 --- a/doc/classes/TranslationServer.xml +++ b/doc/classes/TranslationServer.xml @@ -1,11 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="TranslationServer" inherits="Object" category="Core" version="3.1"> <brief_description> - Server that manages all translations. Translations can be set to it and removed from it. + Server that manages all translations. </brief_description> <description> + Server that manages all translations. Translations can be set to it and removed from it. </description> <tutorials> + <link>https://docs.godotengine.org/en/stable/tutorials/i18n/internationalizing_games.html</link> + <link>https://docs.godotengine.org/en/stable/tutorials/i18n/locales.html</link> </tutorials> <demos> </demos> @@ -16,18 +19,21 @@ <argument index="0" name="translation" type="Translation"> </argument> <description> + Adds a [Translation] resource. </description> </method> <method name="clear"> <return type="void"> </return> <description> + Clears the server from all translations. </description> </method> <method name="get_locale" qualifiers="const"> <return type="String"> </return> <description> + Returns the current locale of the game. </description> </method> <method name="get_locale_name" qualifiers="const"> @@ -36,6 +42,7 @@ <argument index="0" name="locale" type="String"> </argument> <description> + Returns a locale's language and its variant (e.g. "en_US" would return "English (United States)"). </description> </method> <method name="remove_translation"> @@ -44,6 +51,7 @@ <argument index="0" name="translation" type="Translation"> </argument> <description> + Removes the given translation from the server. </description> </method> <method name="set_locale"> @@ -52,6 +60,7 @@ <argument index="0" name="locale" type="String"> </argument> <description> + Sets the locale of the game. </description> </method> <method name="translate" qualifiers="const"> @@ -60,6 +69,7 @@ <argument index="0" name="message" type="String"> </argument> <description> + Returns the current locale's translation for the given message (key). </description> </method> </methods> diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index bd3a36feef..7c095e3798 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -681,6 +681,8 @@ public: int particles_get_draw_passes(RID p_particles) const { return 0; } RID particles_get_draw_pass_mesh(RID p_particles, int p_pass) const { return RID(); } + virtual bool particles_is_inactive(RID p_particles) const { return false; } + /* RENDER TARGET */ RID render_target_create() { return RID(); } diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index d646500a23..3beb8eac33 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -3842,6 +3842,10 @@ RID RasterizerStorageGLES2::particles_get_draw_pass_mesh(RID p_particles, int p_ void RasterizerStorageGLES2::update_particles() { } +bool RasterizerStorageGLES2::particles_is_inactive(RID p_particles) const { + return true; +} + //////// void RasterizerStorageGLES2::instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) { diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h index 59f911e880..5bdc65a0b5 100644 --- a/drivers/gles2/rasterizer_storage_gles2.h +++ b/drivers/gles2/rasterizer_storage_gles2.h @@ -1090,6 +1090,8 @@ public: virtual int particles_get_draw_passes(RID p_particles) const; virtual RID particles_get_draw_pass_mesh(RID p_particles, int p_pass) const; + virtual bool particles_is_inactive(RID p_particles) const; + /* INSTANCE */ virtual void instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance); diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 28c0274afa..d52be09cac 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -86,10 +86,11 @@ static String _mkid(const String &p_id) { static String f2sp0(float p_float) { - if (int(p_float) == p_float) - return itos(p_float) + ".0"; - else - return rtoss(p_float); + String num = rtoss(p_float); + if (num.find(".") == -1 && num.find("e") == -1) { + num += ".0"; + } + return num; } static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNode::Value> &p_values) { diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 0951b8f798..b707189d74 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -3599,7 +3599,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); } - if (!env || storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + if (!env || storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT] || storage->frame.current_rt->width < 4 || storage->frame.current_rt->height < 4) { //no post process on small render targets //no environment or transparent render, simply return and convert to SRGB glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo); glActiveTexture(GL_TEXTURE0); @@ -4297,8 +4297,10 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const glClearBufferfv(GL_COLOR, 0, clear_color.components); // specular } + VS::EnvironmentBG bg_mode = (!env || (probe && env->bg_mode == VS::ENV_BG_CANVAS)) ? VS::ENV_BG_CLEAR_COLOR : env->bg_mode; //if no environment, or canvas while rendering a probe (invalid use case), use color. + if (env) { - switch (env->bg_mode) { + switch (bg_mode) { case VS::ENV_BG_COLOR_SKY: case VS::ENV_BG_SKY: diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 64e04eec71..235c799a55 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -874,8 +874,6 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref<Image> &p int size, ofs; img->get_mipmap_offset_and_size(i, ofs, size); - //print_line("mipmap: "+itos(i)+" size: "+itos(size)+" w: "+itos(mm_w)+", h: "+itos(mm_h)); - if (texture->type == VS::TEXTURE_TYPE_2D || texture->type == VS::TEXTURE_TYPE_CUBEMAP) { if (texture->compressed) { @@ -1062,8 +1060,6 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer) glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - //print_line("GET FORMAT: " + Image::get_format_name(texture->format) + " mipmaps: " + itos(texture->mipmaps)); - for (int i = 0; i < texture->mipmaps; i++) { int ofs = 0; @@ -1142,8 +1138,6 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer) glBindTexture(GL_TEXTURE_2D, temp_color_texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - print_line(itos(texture->alloc_width) + " xx " + itos(texture->alloc_height) + " -> " + itos(real_format)); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, temp_color_texture, 0); @@ -2892,9 +2886,6 @@ void RasterizerStorageGLES3::_update_material(Material *material) { if (E->get().order < 0) continue; // texture, does not go here - //if (material->shader->mode == VS::SHADER_PARTICLES) { - // print_line("uniform " + String(E->key()) + " order " + itos(E->get().order) + " offset " + itos(material->shader->ubo_offsets[E->get().order])); - //} //regular uniform uint8_t *data = &local_ubo[material->shader->ubo_offsets[E->get().order]]; @@ -3787,12 +3778,14 @@ AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const { Mesh *mesh = mesh_owner.get(p_mesh); ERR_FAIL_COND_V(!mesh, AABB()); - if (mesh->custom_aabb != AABB()) + if (mesh->custom_aabb != AABB()) { return mesh->custom_aabb; + } Skeleton *sk = NULL; - if (p_skeleton.is_valid()) + if (p_skeleton.is_valid()) { sk = skeleton_owner.get(p_skeleton); + } AABB aabb; @@ -3831,6 +3824,7 @@ AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const { mtx.origin.y = texture[base_ofs + 3]; AABB baabb = mtx.xform(skbones[j]); + if (first) { laabb = baabb; first = false; @@ -6450,6 +6444,13 @@ void RasterizerStorageGLES3::update_particles() { glDisable(GL_RASTERIZER_DISCARD); } +bool RasterizerStorageGLES3::particles_is_inactive(RID p_particles) const { + + const Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND_V(!particles, false); + return !particles->emitting && particles->inactive; +} + //////// void RasterizerStorageGLES3::instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 8c843e4d96..398ffdeb82 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -1261,6 +1261,8 @@ public: virtual int particles_get_draw_passes(RID p_particles) const; virtual RID particles_get_draw_pass_mesh(RID p_particles, int p_pass) const; + virtual bool particles_is_inactive(RID p_particles) const; + /* INSTANCE */ virtual void instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance); diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index fb6e168327..6cc27bd77a 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -173,10 +173,11 @@ static String _mkid(const String &p_id) { static String f2sp0(float p_float) { - if (int(p_float) == p_float) - return itos(p_float) + ".0"; - else - return rtoss(p_float); + String num = rtoss(p_float); + if (num.find(".") == -1 && num.find("e") == -1) { + num += ".0"; + } + return num; } static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNode::Value> &p_values) { @@ -229,7 +230,7 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo text += ")"; return text; } break; - case SL::TYPE_FLOAT: return f2sp0(p_values[0].real) + "f"; + case SL::TYPE_FLOAT: return f2sp0(p_values[0].real); case SL::TYPE_VEC2: case SL::TYPE_VEC3: case SL::TYPE_VEC4: { 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_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/mono/glue/Managed/Files/Basis.cs b/modules/mono/glue/Managed/Files/Basis.cs index a5618cb28d..54d2813abf 100644 --- a/modules/mono/glue/Managed/Files/Basis.cs +++ b/modules/mono/glue/Managed/Files/Basis.cs @@ -410,10 +410,12 @@ namespace Godot ); } - public Quat Quat() { + public Quat Quat() + { real_t trace = _x[0] + _y[1] + _z[2]; - if (trace > 0.0f) { + if (trace > 0.0f) + { real_t s = Mathf.Sqrt(trace + 1.0f) * 2f; real_t inv_s = 1f / s; return new Quat( @@ -424,7 +426,8 @@ namespace Godot ); } - if (_x[0] > _y[1] && _x[0] > _z[2]) { + if (_x[0] > _y[1] && _x[0] > _z[2]) + { real_t s = Mathf.Sqrt(_x[0] - _y[1] - _z[2] + 1.0f) * 2f; real_t inv_s = 1f / s; return new Quat( @@ -435,7 +438,8 @@ namespace Godot ); } - if (_y[1] > _z[2]) { + if (_y[1] > _z[2]) + { real_t s = Mathf.Sqrt(-_x[0] + _y[1] - _z[2] + 1.0f) * 2f; real_t inv_s = 1f / s; return new Quat( @@ -444,7 +448,9 @@ namespace Godot (_y[2] + _z[1]) * inv_s, (_x[2] - _z[0]) * inv_s ); - } else { + } + else + { real_t s = Mathf.Sqrt(-_x[0] - _y[1] + _z[2] + 1.0f) * 2f; real_t inv_s = 1f / s; return new Quat( @@ -502,8 +508,8 @@ namespace Godot { var axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z); - real_t cosine = Mathf.Cos( phi); - real_t sine = Mathf.Sin( phi); + real_t cosine = Mathf.Cos(phi); + real_t sine = Mathf.Sin(phi); _x = new Vector3 ( @@ -529,9 +535,9 @@ namespace Godot public Basis(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis) { - _x = xAxis; - _y = yAxis; - _z = zAxis; + x = xAxis; + y = yAxis; + z = zAxis; } public Basis(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz) diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 2ab7b835b6..04854e93b6 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -369,7 +369,7 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a } // disable resizable window - if (!current_videomode.resizable) { + if (!current_videomode.resizable && !current_videomode.fullscreen) { XSizeHints *xsh; xsh = XAllocSizeHints(); xsh->flags = PMinSize | PMaxSize; diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index a1b624a246..4fc2282ae7 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -1313,7 +1313,7 @@ void CPUParticles2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "GradientTexture"), "set_color_ramp", "get_color_ramp"); ADD_GROUP("Hue Variation", "hue_"); - ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation", PROPERTY_HINT_RANGE, "-1,1,0.1"), "set_param", "get_param", PARAM_HUE_VARIATION); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_param", "get_param", PARAM_HUE_VARIATION); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_HUE_VARIATION); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "hue_variation_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_param_curve", "get_param_curve", PARAM_HUE_VARIATION); ADD_GROUP("Animation", "anim_"); diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index 7d7c47619a..d656ba0f64 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -190,7 +190,7 @@ void VisibilityEnabler2D::_find_nodes(Node *p_node) { if (enabler[ENABLER_FREEZE_BODIES]) { RigidBody2D *rb2d = Object::cast_to<RigidBody2D>(p_node); - if (rb2d && ((rb2d->get_mode() == RigidBody2D::MODE_CHARACTER || (rb2d->get_mode() == RigidBody2D::MODE_RIGID && !rb2d->is_able_to_sleep())))) { + if (rb2d && ((rb2d->get_mode() == RigidBody2D::MODE_CHARACTER || rb2d->get_mode() == RigidBody2D::MODE_RIGID))) { add = true; meta = rb2d->get_mode(); diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index a22708ac99..69839a0087 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -1369,7 +1369,7 @@ void CPUParticles::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "GradientTexture"), "set_color_ramp", "get_color_ramp"); ADD_GROUP("Hue Variation", "hue_"); - ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation", PROPERTY_HINT_RANGE, "-1,1,0.1"), "set_param", "get_param", PARAM_HUE_VARIATION); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_param", "get_param", PARAM_HUE_VARIATION); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_HUE_VARIATION); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "hue_variation_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_param_curve", "get_param_curve", PARAM_HUE_VARIATION); ADD_GROUP("Animation", "anim_"); diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp index 1adf1c5d79..02c6b1d969 100644 --- a/scene/3d/physics_joint.cpp +++ b/scene/3d/physics_joint.cpp @@ -776,7 +776,6 @@ void Generic6DOFJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_motor_z/target_velocity"), "set_param_z", "get_param_z", PARAM_LINEAR_MOTOR_TARGET_VELOCITY); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_motor_z/force_limit"), "set_param_z", "get_param_z", PARAM_LINEAR_MOTOR_FORCE_LIMIT); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "linear_spring_z/enabled"), "set_flag_z", "get_flag_z", FLAG_ENABLE_LINEAR_SPRING); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "linear_spring_z/enabled"), "set_flag_z", "get_flag_z", FLAG_ENABLE_LINEAR_SPRING); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_spring_z/stiffness"), "set_param_z", "get_param_z", PARAM_LINEAR_SPRING_STIFFNESS); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_spring_z/damping"), "set_param_z", "get_param_z", PARAM_LINEAR_SPRING_DAMPING); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_spring_z/equilibrium_point"), "set_param_z", "get_param_z", PARAM_LINEAR_SPRING_EQUILIBRIUM_POINT); diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index c69387d082..9a0832b27a 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -153,7 +153,7 @@ void VisibilityEnabler::_find_nodes(Node *p_node) { if (enabler[ENABLER_FREEZE_BODIES]) { RigidBody *rb = Object::cast_to<RigidBody>(p_node); - if (rb && ((rb->get_mode() == RigidBody::MODE_CHARACTER || (rb->get_mode() == RigidBody::MODE_RIGID && !rb->is_able_to_sleep())))) { + if (rb && ((rb->get_mode() == RigidBody::MODE_CHARACTER || rb->get_mode() == RigidBody::MODE_RIGID))) { add = true; meta = rb->get_mode(); diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 102f05a146..64202ba0e3 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1348,6 +1348,9 @@ void AnimationPlayer::_animation_changed() { clear_caches(); emit_signal("caches_cleared"); + if (is_playing()) { + playback.seeked = true; //need to restart stuff, like audio + } } void AnimationPlayer::_stop_playing_caches() { 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/viewport.cpp b/scene/main/viewport.cpp index 86992c38f0..8545efb966 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1900,7 +1900,13 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { if (gui.drag_data.get_type() != Variant::NIL) { gui.mouse_focus = NULL; + break; } else { + if (gui.drag_preview != NULL) { + ERR_PRINT("Don't set a drag preview and return null data. Preview was deleted and drag request ignored."); + memdelete(gui.drag_preview); + gui.drag_preview = NULL; + } gui.dragging = false; } 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/mesh.cpp b/scene/resources/mesh.cpp index 838d73edb3..80191367ce 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -706,6 +706,7 @@ bool ArrayMesh::_get(const StringName &p_name, Variant &r_ret) const { Vector<AABB> skel_aabb = VS::get_singleton()->mesh_surface_get_skeleton_aabb(mesh, idx); Array arr; + arr.resize(skel_aabb.size()); for (int i = 0; i < skel_aabb.size(); i++) { arr[i] = skel_aabb[i]; } diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp index b3fc13b79e..dae01e8d96 100644 --- a/scene/resources/particles_material.cpp +++ b/scene/resources/particles_material.cpp @@ -1154,7 +1154,7 @@ void ParticlesMaterial::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "GradientTexture"), "set_color_ramp", "get_color_ramp"); ADD_GROUP("Hue Variation", "hue_"); - ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation", PROPERTY_HINT_RANGE, "-1,1,0.1"), "set_param", "get_param", PARAM_HUE_VARIATION); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_param", "get_param", PARAM_HUE_VARIATION); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_HUE_VARIATION); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "hue_variation_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_HUE_VARIATION); ADD_GROUP("Animation", "anim_"); diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index f9beeb226c..4329203ccb 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -518,6 +518,8 @@ public: virtual void particles_set_fractional_delta(RID p_particles, bool p_enable) = 0; virtual void particles_restart(RID p_particles) = 0; + virtual bool particles_is_inactive(RID p_particles) const = 0; + virtual void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order) = 0; virtual void particles_set_draw_passes(RID p_particles, int p_count) = 0; diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 13de92f226..1deca7bc66 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1912,9 +1912,14 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca if (ins->base_type == VS::INSTANCE_PARTICLES) { //particles visible? process them - VSG::storage->particles_request_process(ins->base); - //particles visible? request redraw - VisualServerRaster::redraw_request(); + if (VSG::storage->particles_is_inactive(ins->base)) { + //but if nothing is going on, don't do it. + keep = false; + } else { + VSG::storage->particles_request_process(ins->base); + //particles visible? request redraw + VisualServerRaster::redraw_request(); + } } if (geom->lighting_dirty) { diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index ca5271190c..e1db123f58 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -343,7 +343,7 @@ RID VisualServer::get_white_texture() { #define SMALL_VEC2 Vector2(0.00001, 0.00001) #define SMALL_VEC3 Vector3(0.00001, 0.00001, 0.00001) -Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> r_bone_aabb) { +Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb) { PoolVector<uint8_t>::Write vw = r_vertex_array.write(); diff --git a/servers/visual_server.h b/servers/visual_server.h index 59eb43da97..743e010034 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -61,7 +61,7 @@ protected: RID white_texture; RID test_material; - Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> r_bone_aabb); + Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb); static VisualServer *(*create_func)(); static void _bind_methods(); |