Path: blob/master/editor/scene/resource_preloader_editor_plugin.h
9898 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/plugins/editor_plugin.h"33#include "scene/gui/dialogs.h"34#include "scene/gui/panel_container.h"35#include "scene/gui/tree.h"36#include "scene/main/resource_preloader.h"3738class EditorFileDialog;3940class ResourcePreloaderEditor : public PanelContainer {41GDCLASS(ResourcePreloaderEditor, PanelContainer);4243enum {44BUTTON_OPEN_SCENE,45BUTTON_EDIT_RESOURCE,46BUTTON_REMOVE47};4849Button *load = nullptr;50Button *paste = nullptr;51Tree *tree = nullptr;52bool loading_scene;5354EditorFileDialog *file = nullptr;5556AcceptDialog *dialog = nullptr;5758ResourcePreloader *preloader = nullptr;5960void _load_pressed();61void _files_load_request(const Vector<String> &p_paths);62void _paste_pressed();63void _remove_resource(const String &p_to_remove);64void _update_library();65void _cell_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button);66void _item_edited();6768Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);69bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;70void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);7172protected:73void _notification(int p_what);7475static void _bind_methods();7677public:78void edit(ResourcePreloader *p_preloader);79ResourcePreloaderEditor();80};8182class ResourcePreloaderEditorPlugin : public EditorPlugin {83GDCLASS(ResourcePreloaderEditorPlugin, EditorPlugin);8485ResourcePreloaderEditor *preloader_editor = nullptr;86Button *button = nullptr;8788public:89virtual String get_plugin_name() const override { return "ResourcePreloader"; }90bool has_main_screen() const override { return false; }91virtual void edit(Object *p_object) override;92virtual bool handles(Object *p_object) const override;93virtual void make_visible(bool p_visible) override;9495ResourcePreloaderEditorPlugin();96};979899