summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/csg/csg_gizmos.cpp2
-rw-r--r--modules/csg/csg_gizmos.h2
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.cpp4
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.h3
-rw-r--r--modules/gdnative/register_types.cpp2
-rw-r--r--modules/gltf/editor_scene_exporter_gltf_plugin.cpp13
-rw-r--r--modules/gltf/editor_scene_exporter_gltf_plugin.h3
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp13
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h8
-rw-r--r--modules/navigation/navigation_mesh_editor_plugin.cpp5
-rw-r--r--modules/navigation/navigation_mesh_editor_plugin.h4
-rw-r--r--modules/vorbis/resource_importer_ogg_vorbis.cpp22
12 files changed, 39 insertions, 42 deletions
diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp
index 076978c4fb..95a0fc7ada 100644
--- a/modules/csg/csg_gizmos.cpp
+++ b/modules/csg/csg_gizmos.cpp
@@ -421,7 +421,7 @@ void CSGShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
}
}
-EditorPluginCSG::EditorPluginCSG(EditorNode *p_editor) {
+EditorPluginCSG::EditorPluginCSG() {
Ref<CSGShape3DGizmoPlugin> gizmo_plugin = Ref<CSGShape3DGizmoPlugin>(memnew(CSGShape3DGizmoPlugin));
Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin);
}
diff --git a/modules/csg/csg_gizmos.h b/modules/csg/csg_gizmos.h
index 46761370dd..43efe57e64 100644
--- a/modules/csg/csg_gizmos.h
+++ b/modules/csg/csg_gizmos.h
@@ -57,7 +57,7 @@ class EditorPluginCSG : public EditorPlugin {
GDCLASS(EditorPluginCSG, EditorPlugin);
public:
- EditorPluginCSG(EditorNode *p_editor);
+ EditorPluginCSG();
};
#endif // CSG_GIZMOS_H
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index 868e1b878c..2440ef392e 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -408,10 +408,10 @@ void GDNativeLibraryEditorPlugin::make_visible(bool p_visible) {
}
}
-GDNativeLibraryEditorPlugin::GDNativeLibraryEditorPlugin(EditorNode *p_node) {
+GDNativeLibraryEditorPlugin::GDNativeLibraryEditorPlugin() {
library_editor = memnew(GDNativeLibraryEditor);
library_editor->set_custom_minimum_size(Size2(0, 250 * EDSCALE));
- button = p_node->add_bottom_panel_item(TTR("GDNativeLibrary"), library_editor);
+ button = EditorNode::get_singleton()->add_bottom_panel_item(TTR("GDNativeLibrary"), library_editor);
button->hide();
}
diff --git a/modules/gdnative/gdnative_library_editor_plugin.h b/modules/gdnative/gdnative_library_editor_plugin.h
index 8d007d207c..2e4b483ea7 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.h
+++ b/modules/gdnative/gdnative_library_editor_plugin.h
@@ -103,7 +103,6 @@ class GDNativeLibraryEditorPlugin : public EditorPlugin {
GDCLASS(GDNativeLibraryEditorPlugin, EditorPlugin);
GDNativeLibraryEditor *library_editor = nullptr;
- EditorNode *editor = nullptr;
Button *button = nullptr;
public:
@@ -113,7 +112,7 @@ public:
virtual bool handles(Object *p_node) const override;
virtual void make_visible(bool p_visible) override;
- GDNativeLibraryEditorPlugin(EditorNode *p_node);
+ GDNativeLibraryEditorPlugin();
};
#endif
#endif // GDNATIVE_LIBRARY_EDITOR_PLUGIN_H
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index fb682beccc..1121fd0e03 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -226,7 +226,7 @@ static void editor_init_callback() {
EditorExport::get_singleton()->add_export_plugin(export_plugin);
- EditorNode::get_singleton()->add_editor_plugin(memnew(GDNativeLibraryEditorPlugin(EditorNode::get_singleton())));
+ EditorNode::get_singleton()->add_editor_plugin(memnew(GDNativeLibraryEditorPlugin));
}
#endif
diff --git a/modules/gltf/editor_scene_exporter_gltf_plugin.cpp b/modules/gltf/editor_scene_exporter_gltf_plugin.cpp
index 9cae1cd87a..601c70791c 100644
--- a/modules/gltf/editor_scene_exporter_gltf_plugin.cpp
+++ b/modules/gltf/editor_scene_exporter_gltf_plugin.cpp
@@ -53,10 +53,9 @@ bool SceneExporterGLTFPlugin::has_main_screen() const {
return false;
}
-SceneExporterGLTFPlugin::SceneExporterGLTFPlugin(EditorNode *p_node) {
- editor = p_node;
+SceneExporterGLTFPlugin::SceneExporterGLTFPlugin() {
file_export_lib = memnew(EditorFileDialog);
- editor->get_gui_base()->add_child(file_export_lib);
+ EditorNode::get_singleton()->get_gui_base()->add_child(file_export_lib);
file_export_lib->connect("file_selected", callable_mp(this, &SceneExporterGLTFPlugin::_gltf2_dialog_action));
file_export_lib->set_title(TTR("Export Library"));
file_export_lib->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
@@ -70,9 +69,9 @@ SceneExporterGLTFPlugin::SceneExporterGLTFPlugin(EditorNode *p_node) {
}
void SceneExporterGLTFPlugin::_gltf2_dialog_action(String p_file) {
- Node *root = editor->get_tree()->get_edited_scene_root();
+ Node *root = EditorNode::get_singleton()->get_tree()->get_edited_scene_root();
if (!root) {
- editor->show_accept(TTR("This operation can't be done without a scene."), TTR("OK"));
+ EditorNode::get_singleton()->show_accept(TTR("This operation can't be done without a scene."), TTR("OK"));
return;
}
List<String> deps;
@@ -93,9 +92,9 @@ void SceneExporterGLTFPlugin::_gltf2_dialog_action(String p_file) {
}
void SceneExporterGLTFPlugin::convert_scene_to_gltf2() {
- Node *root = editor->get_tree()->get_edited_scene_root();
+ Node *root = EditorNode::get_singleton()->get_tree()->get_edited_scene_root();
if (!root) {
- editor->show_accept(TTR("This operation can't be done without a scene."), TTR("OK"));
+ EditorNode::get_singleton()->show_accept(TTR("This operation can't be done without a scene."), TTR("OK"));
return;
}
String filename = String(root->get_scene_file_path().get_file().get_basename());
diff --git a/modules/gltf/editor_scene_exporter_gltf_plugin.h b/modules/gltf/editor_scene_exporter_gltf_plugin.h
index 99d8911f46..c2c3f5710c 100644
--- a/modules/gltf/editor_scene_exporter_gltf_plugin.h
+++ b/modules/gltf/editor_scene_exporter_gltf_plugin.h
@@ -38,7 +38,6 @@
class SceneExporterGLTFPlugin : public EditorPlugin {
GDCLASS(SceneExporterGLTFPlugin, EditorPlugin);
- EditorNode *editor = nullptr;
EditorFileDialog *file_export_lib = nullptr;
void _gltf2_dialog_action(String p_file);
void convert_scene_to_gltf2();
@@ -46,7 +45,7 @@ class SceneExporterGLTFPlugin : public EditorPlugin {
public:
virtual String get_name() const override;
bool has_main_screen() const override;
- SceneExporterGLTFPlugin(class EditorNode *p_node);
+ SceneExporterGLTFPlugin();
};
#endif // TOOLS_ENABLED
#endif // EDITOR_SCENE_EXPORTER_GLTF_PLUGIN_H
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 5c0b45865d..a7f93a6ce9 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -924,7 +924,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
_update_selection_transform();
_update_paste_indicator();
- spatial_editor = Object::cast_to<Node3DEditorPlugin>(editor->get_editor_plugin_screen());
+ spatial_editor = Object::cast_to<Node3DEditorPlugin>(EditorNode::get_singleton()->get_editor_plugin_screen());
if (!node) {
set_process(false);
@@ -1160,9 +1160,8 @@ void GridMapEditor::_bind_methods() {
ClassDB::bind_method("_set_selection", &GridMapEditor::_set_selection);
}
-GridMapEditor::GridMapEditor(EditorNode *p_editor) {
- editor = p_editor;
- undo_redo = p_editor->get_undo_redo();
+GridMapEditor::GridMapEditor() {
+ undo_redo = EditorNode::get_singleton()->get_undo_redo();
int mw = EDITOR_DEF("editors/grid_map/palette_min_width", 230);
Control *ec = memnew(Control);
@@ -1490,13 +1489,11 @@ void GridMapEditorPlugin::make_visible(bool p_visible) {
}
}
-GridMapEditorPlugin::GridMapEditorPlugin(EditorNode *p_node) {
- editor = p_node;
-
+GridMapEditorPlugin::GridMapEditorPlugin() {
EDITOR_DEF("editors/grid_map/editor_side", 1);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/grid_map/editor_side", PROPERTY_HINT_ENUM, "Left,Right"));
- grid_map_editor = memnew(GridMapEditor(editor));
+ grid_map_editor = memnew(GridMapEditor);
switch ((int)EditorSettings::get_singleton()->get("editors/grid_map/editor_side")) {
case 0: { // Left.
Node3DEditor::get_singleton()->add_control_to_left_panel(grid_map_editor);
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 3b54138e36..10e466f096 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -192,8 +192,6 @@ class GridMapEditor : public VBoxContainer {
ItemList *mesh_library_palette;
Label *info_message;
- EditorNode *editor;
-
void update_grid(); // Change which and where the grid is displayed
void _draw_grids(const Vector3 &cell_size);
void _configure();
@@ -239,8 +237,7 @@ public:
EditorPlugin::AfterGUIInput forward_spatial_input_event(Camera3D *p_camera, const Ref<InputEvent> &p_event);
void edit(GridMap *p_gridmap);
- GridMapEditor() {}
- GridMapEditor(EditorNode *p_editor);
+ GridMapEditor();
~GridMapEditor();
};
@@ -248,7 +245,6 @@ class GridMapEditorPlugin : public EditorPlugin {
GDCLASS(GridMapEditorPlugin, EditorPlugin);
GridMapEditor *grid_map_editor;
- EditorNode *editor;
protected:
void _notification(int p_what);
@@ -261,7 +257,7 @@ public:
virtual bool handles(Object *p_object) const override;
virtual void make_visible(bool p_visible) override;
- GridMapEditorPlugin(EditorNode *p_node);
+ GridMapEditorPlugin();
~GridMapEditorPlugin();
};
diff --git a/modules/navigation/navigation_mesh_editor_plugin.cpp b/modules/navigation/navigation_mesh_editor_plugin.cpp
index af02bff4ca..04eca5fb0b 100644
--- a/modules/navigation/navigation_mesh_editor_plugin.cpp
+++ b/modules/navigation/navigation_mesh_editor_plugin.cpp
@@ -140,10 +140,9 @@ void NavigationMeshEditorPlugin::make_visible(bool p_visible) {
}
}
-NavigationMeshEditorPlugin::NavigationMeshEditorPlugin(EditorNode *p_node) {
- editor = p_node;
+NavigationMeshEditorPlugin::NavigationMeshEditorPlugin() {
navigation_mesh_editor = memnew(NavigationMeshEditor);
- editor->get_main_control()->add_child(navigation_mesh_editor);
+ EditorNode::get_singleton()->get_main_control()->add_child(navigation_mesh_editor);
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, navigation_mesh_editor->bake_hbox);
navigation_mesh_editor->hide();
navigation_mesh_editor->bake_hbox->hide();
diff --git a/modules/navigation/navigation_mesh_editor_plugin.h b/modules/navigation/navigation_mesh_editor_plugin.h
index 49ca28d3cf..0e4175eca0 100644
--- a/modules/navigation/navigation_mesh_editor_plugin.h
+++ b/modules/navigation/navigation_mesh_editor_plugin.h
@@ -35,7 +35,6 @@
#include "editor/editor_plugin.h"
-class EditorNode;
class NavigationRegion3D;
class NavigationMeshEditor : public Control {
@@ -70,7 +69,6 @@ class NavigationMeshEditorPlugin : public EditorPlugin {
GDCLASS(NavigationMeshEditorPlugin, EditorPlugin);
NavigationMeshEditor *navigation_mesh_editor;
- EditorNode *editor;
public:
virtual String get_name() const override { return "NavigationMesh"; }
@@ -79,7 +77,7 @@ public:
virtual bool handles(Object *p_object) const override;
virtual void make_visible(bool p_visible) override;
- NavigationMeshEditorPlugin(EditorNode *p_node);
+ NavigationMeshEditorPlugin();
~NavigationMeshEditorPlugin();
};
diff --git a/modules/vorbis/resource_importer_ogg_vorbis.cpp b/modules/vorbis/resource_importer_ogg_vorbis.cpp
index ccd463fd52..d12e65a96a 100644
--- a/modules/vorbis/resource_importer_ogg_vorbis.cpp
+++ b/modules/vorbis/resource_importer_ogg_vorbis.cpp
@@ -136,11 +136,11 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin
// Have a page now.
if (!initialized_stream) {
- ogg_stream_init(&stream_state, ogg_page_serialno(&page));
- ERR_FAIL_COND_V_MSG((err = ogg_stream_check(&stream_state)), Error::ERR_INVALID_DATA, "Ogg stream error " + itos(err));
+ if (ogg_stream_init(&stream_state, ogg_page_serialno(&page))) {
+ ERR_FAIL_V_MSG(Error::ERR_OUT_OF_MEMORY, "Failed allocating memory for OGG Vorbis stream.");
+ }
initialized_stream = true;
}
- ERR_FAIL_COND_V_MSG((err = ogg_stream_check(&stream_state)), Error::ERR_INVALID_DATA, "Ogg stream error " + itos(err));
ogg_stream_pagein(&stream_state, &page);
ERR_FAIL_COND_V_MSG((err = ogg_stream_check(&stream_state)), Error::ERR_INVALID_DATA, "Ogg stream error " + itos(err));
int desync_iters = 0;
@@ -160,10 +160,12 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin
break;
}
if (packet_count == 0 && vorbis_synthesis_idheader(&packet) == 0) {
- WARN_PRINT("Found a non-vorbis-header packet in a header position");
+ print_verbose("Found a non-vorbis-header packet in a header position");
// Clearly this logical stream is not a vorbis stream, so destroy it and try again with the next page.
- ogg_stream_destroy(&stream_state);
- initialized_stream = false;
+ if (initialized_stream) {
+ ogg_stream_clear(&stream_state);
+ initialized_stream = false;
+ }
break;
}
granule_pos = packet.granulepos;
@@ -178,6 +180,14 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin
ogg_packet_sequence->push_page(granule_pos, packet_data);
}
}
+ if (initialized_stream) {
+ ogg_stream_clear(&stream_state);
+ }
+ ogg_sync_clear(&sync_state);
+
+ if (ogg_packet_sequence->get_packet_granule_positions().is_empty()) {
+ ERR_FAIL_V_MSG(Error::ERR_FILE_CORRUPT, "OGG Vorbis decoding failed. Check that your data is a valid OGG Vorbis audio stream.");
+ }
ogg_vorbis_stream->set_packet_sequence(ogg_packet_sequence);
ogg_vorbis_stream->set_loop(loop);