1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Create AudioStreamPlayer when dropping AudioStream

- Create AudioStreamPlayer if dropped in between nodes in the Scene dock
- Create AudioStreamPlayer2D if dropped into 2D editor
- Create AudioStreamPlayer3D if dropped into 3D editor
This commit is contained in:
Haoyu Qiu
2024-05-16 10:13:46 +08:00
parent daa81bbb7d
commit e5c321448e
7 changed files with 472 additions and 223 deletions

View File

@@ -32,10 +32,11 @@
#define CANVAS_ITEM_EDITOR_PLUGIN_H
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/base_button.h"
#include "scene/gui/box_container.h"
class AcceptDialog;
class Button;
class ButtonGroup;
class CanvasItemEditorViewport;
class ConfirmationDialog;
class EditorData;
@@ -409,7 +410,7 @@ private:
void _selection_result_pressed(int);
void _selection_menu_hide();
void _add_node_pressed(int p_result);
void _node_created(Node *p_node);
void _adjust_new_node_position(Node *p_node);
void _reset_create_position();
void _update_editor_settings();
bool _is_grid_visible() const;
@@ -634,15 +635,13 @@ class CanvasItemEditorViewport : public Control {
CanvasItemEditor *canvas_item_editor = nullptr;
Control *preview_node = nullptr;
AcceptDialog *accept = nullptr;
AcceptDialog *selector = nullptr;
Label *selector_label = nullptr;
AcceptDialog *texture_node_type_selector = nullptr;
Label *label = nullptr;
Label *label_desc = nullptr;
VBoxContainer *btn_group = nullptr;
Ref<ButtonGroup> button_group;
void _on_mouse_exit();
void _on_select_type(Object *selected);
void _on_select_texture_node_type(Object *selected);
void _on_change_type_confirmed();
void _on_change_type_closed();
@@ -650,11 +649,12 @@ class CanvasItemEditorViewport : public Control {
void _remove_preview();
bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node) const;
bool _only_packed_scenes_selected() const;
void _create_nodes(Node *parent, Node *child, String &path, const Point2 &p_point);
bool _create_instance(Node *parent, String &path, const Point2 &p_point);
bool _is_any_texture_selected() const;
void _create_texture_node(Node *p_parent, Node *p_child, const String &p_path, const Point2 &p_point);
void _create_audio_node(Node *p_parent, const String &p_path, const Point2 &p_point);
bool _create_instance(Node *p_parent, const String &p_path, const Point2 &p_point);
void _perform_drop_data();
void _show_resource_type_selector();
void _show_texture_node_type_selector();
void _update_theme();
protected: