Path: blob/master/editor/scene/resource_preloader_editor_plugin.h
20952 views
/**************************************************************************/1/* resource_preloader_editor_plugin.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "editor/docks/editor_dock.h"33#include "editor/plugins/editor_plugin.h"3435class AcceptDialog;36class Button;37class EditorFileDialog;38class ResourcePreloader;39class Tree;4041class ResourcePreloaderEditor : public EditorDock {42GDCLASS(ResourcePreloaderEditor, EditorDock);4344enum {45BUTTON_OPEN_SCENE,46BUTTON_EDIT_RESOURCE,47BUTTON_REMOVE48};4950Button *load = nullptr;51Button *paste = nullptr;52MarginContainer *mc = nullptr;53Tree *tree = nullptr;5455bool horizontal = false;56bool loading_scene = false;5758EditorFileDialog *file = nullptr;5960AcceptDialog *dialog = nullptr;6162ResourcePreloader *preloader = nullptr;6364void _load_pressed();65void _files_load_request(const Vector<String> &p_paths);66void _paste_pressed();67void _remove_resource(const String &p_to_remove);68void _update_library();69void _cell_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button);70void _item_edited();7172Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);73bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;74void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);7576protected:77void _notification(int p_what);78static void _bind_methods();7980virtual void update_layout(EditorDock::DockLayout p_layout) override;8182public:83void edit(ResourcePreloader *p_preloader);84ResourcePreloaderEditor();85};8687class ResourcePreloaderEditorPlugin : public EditorPlugin {88GDCLASS(ResourcePreloaderEditorPlugin, EditorPlugin);8990ResourcePreloaderEditor *preloader_editor = nullptr;9192public:93virtual String get_plugin_name() const override { return "ResourcePreloader"; }94bool has_main_screen() const override { return false; }95virtual void edit(Object *p_object) override;96virtual bool handles(Object *p_object) const override;97virtual void make_visible(bool p_visible) override;9899ResourcePreloaderEditorPlugin();100};101102103