diff options
-rw-r--r-- | core/input/input.cpp | 16 | ||||
-rw-r--r-- | core/io/resource_importer.cpp | 6 | ||||
-rw-r--r-- | core/io/resource_importer.h | 1 | ||||
-rw-r--r-- | editor/import_defaults_editor.cpp | 194 | ||||
-rw-r--r-- | editor/import_defaults_editor.h | 74 | ||||
-rw-r--r-- | editor/project_settings_editor.cpp | 6 | ||||
-rw-r--r-- | editor/project_settings_editor.h | 2 | ||||
-rw-r--r-- | platform/android/export/export.cpp | 1 | ||||
-rw-r--r-- | platform/android/java/app/AndroidManifest.xml | 5 | ||||
-rw-r--r-- | platform/android/java/app/build.gradle | 2 | ||||
-rw-r--r-- | platform/android/java/app/config.gradle | 49 | ||||
-rw-r--r-- | platform/android/java/build.gradle | 6 | ||||
-rw-r--r-- | platform/android/java/lib/AndroidManifest.xml | 5 | ||||
-rw-r--r-- | platform/android/java/lib/build.gradle | 2 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/Godot.java | 42 | ||||
-rw-r--r-- | scene/animation/tween.cpp | 6 | ||||
-rw-r--r-- | scene/resources/mesh_data_tool.cpp | 38 |
17 files changed, 417 insertions, 38 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp index 94a18b5b4f..f928ae7654 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -241,10 +241,18 @@ bool Input::is_joy_button_pressed(int p_device, int p_button) const { } bool Input::is_action_pressed(const StringName &p_action, bool p_exact) const { +#ifdef DEBUG_ENABLED + bool has_action = InputMap::get_singleton()->has_action(p_action); + ERR_FAIL_COND_V_MSG(!has_action, false, "Request for nonexistent InputMap action '" + String(p_action) + "'."); +#endif return action_state.has(p_action) && action_state[p_action].pressed && (p_exact ? action_state[p_action].exact : true); } bool Input::is_action_just_pressed(const StringName &p_action, bool p_exact) const { +#ifdef DEBUG_ENABLED + bool has_action = InputMap::get_singleton()->has_action(p_action); + ERR_FAIL_COND_V_MSG(!has_action, false, "Request for nonexistent InputMap action '" + String(p_action) + "'."); +#endif const Map<StringName, Action>::Element *E = action_state.find(p_action); if (!E) { return false; @@ -262,6 +270,10 @@ bool Input::is_action_just_pressed(const StringName &p_action, bool p_exact) con } bool Input::is_action_just_released(const StringName &p_action, bool p_exact) const { +#ifdef DEBUG_ENABLED + bool has_action = InputMap::get_singleton()->has_action(p_action); + ERR_FAIL_COND_V_MSG(!has_action, false, "Request for nonexistent InputMap action '" + String(p_action) + "'."); +#endif const Map<StringName, Action>::Element *E = action_state.find(p_action); if (!E) { return false; @@ -279,6 +291,10 @@ bool Input::is_action_just_released(const StringName &p_action, bool p_exact) co } float Input::get_action_strength(const StringName &p_action, bool p_exact) const { +#ifdef DEBUG_ENABLED + bool has_action = InputMap::get_singleton()->has_action(p_action); + ERR_FAIL_COND_V_MSG(!has_action, false, "Request for nonexistent InputMap action '" + String(p_action) + "'."); +#endif const Map<StringName, Action>::Element *E = action_state.find(p_action); if (!E) { return 0.0f; diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp index 3e460726f6..5ca0eb884a 100644 --- a/core/io/resource_importer.cpp +++ b/core/io/resource_importer.cpp @@ -352,6 +352,12 @@ void ResourceFormatImporter::get_importers_for_extension(const String &p_extensi } } +void ResourceFormatImporter::get_importers(List<Ref<ResourceImporter>> *r_importers) { + for (int i = 0; i < importers.size(); i++) { + r_importers->push_back(importers[i]); + } +} + Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_extension(const String &p_extension) const { Ref<ResourceImporter> importer; float priority = 0; diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h index bda8b74b73..91efec5534 100644 --- a/core/io/resource_importer.h +++ b/core/io/resource_importer.h @@ -82,6 +82,7 @@ public: Ref<ResourceImporter> get_importer_by_name(const String &p_name) const; Ref<ResourceImporter> get_importer_by_extension(const String &p_extension) const; void get_importers_for_extension(const String &p_extension, List<Ref<ResourceImporter>> *r_importers); + void get_importers(List<Ref<ResourceImporter>> *r_importers); bool are_import_settings_valid(const String &p_path) const; String get_import_settings_hash() const; diff --git a/editor/import_defaults_editor.cpp b/editor/import_defaults_editor.cpp new file mode 100644 index 0000000000..ad08411403 --- /dev/null +++ b/editor/import_defaults_editor.cpp @@ -0,0 +1,194 @@ +/*************************************************************************/ +/* import_defaults_editor.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "import_defaults_editor.h" + +class ImportDefaultsEditorSettings : public Object { + GDCLASS(ImportDefaultsEditorSettings, Object) + friend class ImportDefaultsEditor; + List<PropertyInfo> properties; + Map<StringName, Variant> values; + Map<StringName, Variant> default_values; + + Ref<ResourceImporter> importer; + +protected: + bool _set(const StringName &p_name, const Variant &p_value) { + if (values.has(p_name)) { + values[p_name] = p_value; + return true; + } else { + return false; + } + } + bool _get(const StringName &p_name, Variant &r_ret) const { + if (values.has(p_name)) { + r_ret = values[p_name]; + return true; + } else { + r_ret = Variant(); + return false; + } + } + void _get_property_list(List<PropertyInfo> *p_list) const { + if (importer.is_null()) { + return; + } + for (const List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) { + if (importer->get_option_visibility(E->get().name, values)) { + p_list->push_back(E->get()); + } + } + } +}; + +void ImportDefaultsEditor::_reset() { + if (settings->importer.is_valid()) { + settings->values = settings->default_values; + settings->notify_property_list_changed(); + } +} +void ImportDefaultsEditor::_save() { + if (settings->importer.is_valid()) { + Dictionary modified; + + for (Map<StringName, Variant>::Element *E = settings->values.front(); E; E = E->next()) { + if (E->get() != settings->default_values[E->key()]) { + modified[E->key()] = E->get(); + } + } + + if (modified.size()) { + ProjectSettings::get_singleton()->set("importer_defaults/" + settings->importer->get_importer_name(), modified); + } else { + ProjectSettings::get_singleton()->set("importer_defaults/" + settings->importer->get_importer_name(), Variant()); + } + + emit_signal("project_settings_changed"); + } +} + +void ImportDefaultsEditor::_update_importer() { + List<Ref<ResourceImporter>> importer_list; + ResourceFormatImporter::get_singleton()->get_importers(&importer_list); + Ref<ResourceImporter> importer; + for (List<Ref<ResourceImporter>>::Element *E = importer_list.front(); E; E = E->next()) { + if (E->get()->get_visible_name() == importers->get_item_text(importers->get_selected())) { + importer = E->get(); + break; + } + } + + settings->properties.clear(); + settings->values.clear(); + settings->importer = importer; + + if (importer.is_valid()) { + List<ResourceImporter::ImportOption> options; + importer->get_import_options(&options); + Dictionary d; + if (ProjectSettings::get_singleton()->has_setting("importer_defaults/" + importer->get_importer_name())) { + d = ProjectSettings::get_singleton()->get("importer_defaults/" + importer->get_importer_name()); + } + + for (List<ResourceImporter::ImportOption>::Element *E = options.front(); E; E = E->next()) { + settings->properties.push_back(E->get().option); + if (d.has(E->get().option.name)) { + settings->values[E->get().option.name] = d[E->get().option.name]; + } else { + settings->values[E->get().option.name] = E->get().default_value; + } + settings->default_values[E->get().option.name] = E->get().default_value; + } + + save_defaults->set_disabled(false); + reset_defaults->set_disabled(false); + + } else { + save_defaults->set_disabled(true); + reset_defaults->set_disabled(true); + } + + settings->notify_property_list_changed(); + + inspector->edit(settings); +} +void ImportDefaultsEditor::_importer_selected(int p_index) { + _update_importer(); +} +void ImportDefaultsEditor::clear() { + importers->clear(); + importers->add_item("<" + TTR("Select Importer") + ">"); + List<Ref<ResourceImporter>> importer_list; + ResourceFormatImporter::get_singleton()->get_importers(&importer_list); + Vector<String> names; + for (List<Ref<ResourceImporter>>::Element *E = importer_list.front(); E; E = E->next()) { + String vn = E->get()->get_visible_name(); + names.push_back(vn); + } + names.sort(); + + for (int i = 0; i < names.size(); i++) { + importers->add_item(names[i]); + } +} +void ImportDefaultsEditor::_bind_methods() { + ADD_SIGNAL(MethodInfo("project_settings_changed")); +} +ImportDefaultsEditor::ImportDefaultsEditor() { + HBoxContainer *hb = memnew(HBoxContainer); + hb->add_child(memnew(Label(TTR("Importer:")))); + importers = memnew(OptionButton); + hb->add_child(importers); + hb->add_spacer(); + importers->connect("item_selected", callable_mp(this, &ImportDefaultsEditor::_importer_selected)); + reset_defaults = memnew(Button); + reset_defaults->set_text(TTR("Reset to Defaults")); + reset_defaults->set_disabled(true); + reset_defaults->connect("pressed", callable_mp(this, &ImportDefaultsEditor::_reset)); + hb->add_child(reset_defaults); + add_child(hb); + inspector = memnew(EditorInspector); + add_child(inspector); + inspector->set_v_size_flags(SIZE_EXPAND_FILL); + CenterContainer *cc = memnew(CenterContainer); + save_defaults = memnew(Button); + save_defaults->set_text(TTR("Save")); + save_defaults->connect("pressed", callable_mp(this, &ImportDefaultsEditor::_save)); + cc->add_child(save_defaults); + add_child(cc); + + settings = memnew(ImportDefaultsEditorSettings); +} + +ImportDefaultsEditor::~ImportDefaultsEditor() { + inspector->edit(nullptr); + memdelete(settings); +} diff --git a/editor/import_defaults_editor.h b/editor/import_defaults_editor.h new file mode 100644 index 0000000000..ff85a25b00 --- /dev/null +++ b/editor/import_defaults_editor.h @@ -0,0 +1,74 @@ +/*************************************************************************/ +/* import_defaults_editor.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef IMPORT_DEFAULTS_EDITOR_H +#define IMPORT_DEFAULTS_EDITOR_H + +#include "core/object/undo_redo.h" +#include "editor/action_map_editor.h" +#include "editor/editor_data.h" +#include "editor/editor_plugin_settings.h" +#include "editor/editor_sectioned_inspector.h" +#include "editor/localization_editor.h" +#include "editor/shader_globals_editor.h" +#include "editor_autoload_settings.h" +#include "scene/gui/center_container.h" +#include "scene/gui/option_button.h" + +class ImportDefaultsEditorSettings; + +class ImportDefaultsEditor : public VBoxContainer { + GDCLASS(ImportDefaultsEditor, VBoxContainer) + + OptionButton *importers; + Button *save_defaults; + Button *reset_defaults; + + EditorInspector *inspector; + + ImportDefaultsEditorSettings *settings; + + void _update_importer(); + void _importer_selected(int p_index); + + void _reset(); + void _save(); + +protected: + static void _bind_methods(); + +public: + void clear(); + + ImportDefaultsEditor(); + ~ImportDefaultsEditor(); +}; + +#endif // IMPORT_DEFAULTS_EDITOR_H diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 6e2cd72796..d7d12903e0 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -52,6 +52,7 @@ void ProjectSettingsEditor::popup_project_settings() { localization_editor->update_translations(); autoload_settings->update_autoload(); plugin_settings->update_plugins(); + import_defaults_editor->clear(); } void ProjectSettingsEditor::queue_save() { @@ -692,4 +693,9 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { } inspector->set_restrict_to_basic_settings(!use_advanced); + + import_defaults_editor = memnew(ImportDefaultsEditor); + import_defaults_editor->set_name(TTR("Import Defaults")); + tab_container->add_child(import_defaults_editor); + import_defaults_editor->connect("project_settings_changed", callable_mp(this, &ProjectSettingsEditor::queue_save)); } diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h index c28785bb27..cde46ac4c4 100644 --- a/editor/project_settings_editor.h +++ b/editor/project_settings_editor.h @@ -36,6 +36,7 @@ #include "editor/editor_data.h" #include "editor/editor_plugin_settings.h" #include "editor/editor_sectioned_inspector.h" +#include "editor/import_defaults_editor.h" #include "editor/localization_editor.h" #include "editor/shader_globals_editor.h" #include "editor_autoload_settings.h" @@ -75,6 +76,7 @@ class ProjectSettingsEditor : public AcceptDialog { PanelContainer *restart_container; Button *restart_close_button; + ImportDefaultsEditor *import_defaults_editor; EditorData *data; UndoRedo *undo_redo; diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 888b1546e4..da3ffab094 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -2553,6 +2553,7 @@ public: cmdline.push_back("-Pplugins_maven_repos=" + custom_maven_repos); // argument to specify the list of custom maven repos for the plugins dependencies. cmdline.push_back("-Pperform_zipalign=" + zipalign_flag); // argument to specify whether the build should be zipaligned. cmdline.push_back("-Pperform_signing=" + sign_flag); // argument to specify whether the build should be signed. + cmdline.push_back("-Pgodot_editor_version=" + String(VERSION_FULL_CONFIG)); // NOTE: The release keystore is not included in the verbose logging // to avoid accidentally leaking sensitive information when sharing verbose logs for troubleshooting. diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml index e94681659c..cd2f1d367e 100644 --- a/platform/android/java/app/AndroidManifest.xml +++ b/platform/android/java/app/AndroidManifest.xml @@ -22,6 +22,11 @@ tools:ignore="GoogleAppIndexingWarning" android:icon="@mipmap/icon" > + <!-- Records the version of the Godot editor used for building --> + <meta-data + android:name="org.godotengine.editor.version" + android:value="${godotEditorVersion}" /> + <!-- The following metadata values are replaced when Godot exports, modifying them here has no effect. --> <!-- Do these changes in the export preset. Adding new ones is fine. --> diff --git a/platform/android/java/app/build.gradle b/platform/android/java/app/build.gradle index 814cc30613..934c4bf441 100644 --- a/platform/android/java/app/build.gradle +++ b/platform/android/java/app/build.gradle @@ -85,6 +85,8 @@ android { abiFilters export_abi_list } + manifestPlaceholders = [godotEditorVersion: getGodotEditorVersion()] + // Feel free to modify the application id to your own. applicationId getExportPackageName() versionCode getExportVersionCode() diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle index 202b3c35c0..06d1f4064e 100644 --- a/platform/android/java/app/config.gradle +++ b/platform/android/java/app/config.gradle @@ -50,6 +50,55 @@ ext.getExportVersionName = { -> return versionName } +ext.getGodotEditorVersion = { -> + String editorVersion = project.hasProperty("godot_editor_version") ? project.property("godot_editor_version") : "" + if (editorVersion == null || editorVersion.isEmpty()) { + // Try the library version first + editorVersion = getGodotLibraryVersion() + + if (editorVersion.isEmpty()) { + // Fallback value. + editorVersion = "custom_build" + } + } + return editorVersion +} + +ext.getGodotLibraryVersion = { -> + // Attempt to read the version from the `version.py` file. + String libraryVersion = "" + + File versionFile = new File("../../../version.py") + if (versionFile.isFile()) { + List<String> requiredKeys = ["major", "minor", "patch", "status", "module_config"] + def map = [:] + + List<String> lines = versionFile.readLines() + for (String line in lines) { + String[] keyValue = line.split("=") + String key = keyValue[0].trim() + String value = keyValue[1].trim().replaceAll("\"", "") + + if (requiredKeys.contains(key)) { + if (!value.isEmpty()) { + map[key] = value + } + requiredKeys.remove(key) + } + } + + if (requiredKeys.empty) { + libraryVersion = map.values().join(".") + } + } + + if (libraryVersion.isEmpty()) { + // Fallback value in case we're unable to read the file. + libraryVersion = "custom_build" + } + return libraryVersion +} + final String PLUGIN_VALUE_SEPARATOR_REGEX = "\\|" // get the list of ABIs the project should be exported to diff --git a/platform/android/java/build.gradle b/platform/android/java/build.gradle index 73c136ed0e..ec02b0fc7a 100644 --- a/platform/android/java/build.gradle +++ b/platform/android/java/build.gradle @@ -165,12 +165,6 @@ task cleanGodotTemplates(type: Delete) { // Delete the library generated AAR files delete("lib/build/outputs/aar") - // Delete the godotpayment libs directory contents - delete("plugins/godotpayment/libs") - - // Delete the generated godotpayment aar - delete("plugins/godotpayment/build/outputs/aar") - // Delete the app libs directory contents delete("app/libs") diff --git a/platform/android/java/lib/AndroidManifest.xml b/platform/android/java/lib/AndroidManifest.xml index fa39bc0f1d..3034794d69 100644 --- a/platform/android/java/lib/AndroidManifest.xml +++ b/platform/android/java/lib/AndroidManifest.xml @@ -6,6 +6,11 @@ <application> + <!-- Records the version of the Godot library --> + <meta-data + android:name="org.godotengine.library.version" + android:value="${godotLibraryVersion}" /> + <service android:name=".GodotDownloaderService" /> </application> diff --git a/platform/android/java/lib/build.gradle b/platform/android/java/lib/build.gradle index ca5153f7f6..6fc9a11a08 100644 --- a/platform/android/java/lib/build.gradle +++ b/platform/android/java/lib/build.gradle @@ -18,6 +18,8 @@ android { defaultConfig { minSdkVersion versions.minSdk targetSdkVersion versions.targetSdk + + manifestPlaceholders = [godotLibraryVersion: getGodotLibraryVersion()] } compileOptions { diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index 7d396b402e..0891904dff 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -464,7 +464,9 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle icicle) { + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + final Activity activity = getActivity(); Window window = activity.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); @@ -572,24 +574,11 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) { // This is where you do set up to display the download - // progress (next step) + // progress (next step in onCreateView) mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this, GodotDownloaderService.class); - View downloadingExpansionView = - inflater.inflate(R.layout.downloading_expansion, container, false); - mPB = (ProgressBar)downloadingExpansionView.findViewById(R.id.progressBar); - mStatusText = (TextView)downloadingExpansionView.findViewById(R.id.statusText); - mProgressFraction = (TextView)downloadingExpansionView.findViewById(R.id.progressAsFraction); - mProgressPercent = (TextView)downloadingExpansionView.findViewById(R.id.progressAsPercentage); - mAverageSpeed = (TextView)downloadingExpansionView.findViewById(R.id.progressAverageSpeed); - mTimeRemaining = (TextView)downloadingExpansionView.findViewById(R.id.progressTimeRemaining); - mDashboard = downloadingExpansionView.findViewById(R.id.downloaderDashboard); - mCellMessage = downloadingExpansionView.findViewById(R.id.approveCellular); - mPauseButton = (Button)downloadingExpansionView.findViewById(R.id.pauseButton); - mWiFiSettingsButton = (Button)downloadingExpansionView.findViewById(R.id.wifiSettingsButton); - - return downloadingExpansionView; + return; } } catch (NameNotFoundException e) { // TODO Auto-generated catch block @@ -600,6 +589,27 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC mCurrentIntent = activity.getIntent(); initializeGodot(); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle icicle) { + if (mDownloaderClientStub != null) { + View downloadingExpansionView = + inflater.inflate(R.layout.downloading_expansion, container, false); + mPB = (ProgressBar)downloadingExpansionView.findViewById(R.id.progressBar); + mStatusText = (TextView)downloadingExpansionView.findViewById(R.id.statusText); + mProgressFraction = (TextView)downloadingExpansionView.findViewById(R.id.progressAsFraction); + mProgressPercent = (TextView)downloadingExpansionView.findViewById(R.id.progressAsPercentage); + mAverageSpeed = (TextView)downloadingExpansionView.findViewById(R.id.progressAverageSpeed); + mTimeRemaining = (TextView)downloadingExpansionView.findViewById(R.id.progressTimeRemaining); + mDashboard = downloadingExpansionView.findViewById(R.id.downloaderDashboard); + mCellMessage = downloadingExpansionView.findViewById(R.id.approveCellular); + mPauseButton = (Button)downloadingExpansionView.findViewById(R.id.pauseButton); + mWiFiSettingsButton = (Button)downloadingExpansionView.findViewById(R.id.wifiSettingsButton); + + return downloadingExpansionView; + } + return containerLayout; } diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 62d03ea80c..9b98f3d031 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -1350,6 +1350,9 @@ void Tween::interpolate_property(Object *p_object, NodePath p_property, Variant return; } + // Check that the target object is valid + ERR_FAIL_COND_MSG(p_object == nullptr, vformat("The Tween \"%s\"'s target node is `null`. Is the node reference correct?", get_name())); + // Get the property from the node path p_property = p_property.get_as_property_path(); @@ -1378,6 +1381,9 @@ void Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_ return; } + // Check that the target object is valid + ERR_FAIL_COND_MSG(p_object == nullptr, vformat("The Tween \"%s\"'s target node is `null`. Is the node reference correct?", get_name())); + // Convert any integers into REALs as they are better for interpolation if (p_initial_val.get_type() == Variant::INT) { p_initial_val = p_initial_val.operator real_t(); diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index 1b82aca386..3fb4f8f211 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -50,6 +50,28 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf int vcount = varray.size(); ERR_FAIL_COND_V(vcount == 0, ERR_INVALID_PARAMETER); + Vector<int> indices; + + if (arrays[Mesh::ARRAY_INDEX].get_type() != Variant::NIL) { + indices = arrays[Mesh::ARRAY_INDEX]; + } else { + //make code simpler + indices.resize(vcount); + int *iw = indices.ptrw(); + for (int i = 0; i < vcount; i++) { + iw[i] = i; + } + } + + int icount = indices.size(); + const int *r = indices.ptr(); + + ERR_FAIL_COND_V(icount == 0, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(icount % 3, ERR_INVALID_PARAMETER); + for (int i = 0; i < icount; i++) { + ERR_FAIL_INDEX_V(r[i], vcount, ERR_INVALID_PARAMETER); + } + clear(); format = p_mesh->surface_get_format(p_surface); material = p_mesh->surface_get_material(p_surface); @@ -128,22 +150,6 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf vertices.write[i] = v; } - Vector<int> indices; - - if (arrays[Mesh::ARRAY_INDEX].get_type() != Variant::NIL) { - indices = arrays[Mesh::ARRAY_INDEX]; - } else { - //make code simpler - indices.resize(vcount); - int *iw = indices.ptrw(); - for (int i = 0; i < vcount; i++) { - iw[i] = i; - } - } - - int icount = indices.size(); - const int *r = indices.ptr(); - Map<Point2i, int> edge_indices; for (int i = 0; i < icount; i += 3) { |