Path: blob/master/editor/scene/2d/particles_2d_editor_plugin.h
9903 views
/**************************************************************************/1/* particles_2d_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/scene/particles_editor_plugin.h"3334class EditorFileDialog;3536class Particles2DEditorPlugin : public ParticlesEditorPlugin {37GDCLASS(Particles2DEditorPlugin, ParticlesEditorPlugin);3839protected:40enum {41MENU_LOAD_EMISSION_MASK = 100,42};4344List<Node *> selected_particles;4546enum EmissionMode {47EMISSION_MODE_SOLID,48EMISSION_MODE_BORDER,49EMISSION_MODE_BORDER_DIRECTED50};5152EditorFileDialog *file = nullptr;53ConfirmationDialog *emission_mask = nullptr;54OptionButton *emission_mask_mode = nullptr;55CheckBox *emission_mask_centered = nullptr;56CheckBox *emission_colors = nullptr;57String source_emission_file;5859virtual void _menu_callback(int p_idx) override;60virtual void _add_menu_options(PopupMenu *p_menu) override;6162void _file_selected(const String &p_file);63void _get_base_emission_mask(PackedVector2Array &r_valid_positions, PackedVector2Array &r_valid_normals, PackedByteArray &r_valid_colors, Vector2i &r_image_size);64virtual void _generate_emission_mask() = 0;65void _notification(int p_what);66void _set_show_gizmos(Node *p_node, bool p_show);67void _selection_changed();68void _node_removed(Node *p_node);6970public:71Particles2DEditorPlugin();72};7374class GPUParticles2DEditorPlugin : public Particles2DEditorPlugin {75GDCLASS(GPUParticles2DEditorPlugin, Particles2DEditorPlugin);7677enum {78MENU_GENERATE_VISIBILITY_RECT = 200,79};8081ConfirmationDialog *generate_visibility_rect = nullptr;82SpinBox *generate_seconds = nullptr;8384void _generate_visibility_rect();8586protected:87void _menu_callback(int p_idx) override;88void _add_menu_options(PopupMenu *p_menu) override;8990Node *_convert_particles() override;9192void _generate_emission_mask() override;9394public:95GPUParticles2DEditorPlugin();96};9798class CPUParticles2DEditorPlugin : public Particles2DEditorPlugin {99GDCLASS(CPUParticles2DEditorPlugin, Particles2DEditorPlugin);100101protected:102Node *_convert_particles() override;103104void _generate_emission_mask() override;105106public:107CPUParticles2DEditorPlugin();108};109110111