Skip to content

Commit

Permalink
[WIP] Add Particles setup dialog in the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Calinou committed Dec 10, 2024
1 parent a372214 commit 4fa08e7
Show file tree
Hide file tree
Showing 3 changed files with 215 additions and 0 deletions.
182 changes: 182 additions & 0 deletions editor/plugins/particles_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,25 @@

#include "canvas_item_editor_plugin.h"
#include "core/io/image_loader.h"
#include "editor/editor_help.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/gui/editor_file_dialog.h"
#include "editor/scene_tree_dock.h"
#include "editor/themes/editor_scale.h"
#include "scene/2d/cpu_particles_2d.h"
#include "scene/2d/gpu_particles_2d.h"
#include "scene/3d/cpu_particles_3d.h"
#include "scene/3d/gpu_particles_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/box_container.h"
#include "scene/gui/item_list.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/separator.h"
#include "scene/gui/spin_box.h"
#include "scene/resources/3d/primitive_meshes.h"
#include "scene/resources/gradient_texture.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/particle_process_material.h"

Expand All @@ -64,13 +69,148 @@ void ParticlesEditorPlugin::_notification(int p_what) {
menu->set_text(handled_type);

PopupMenu *popup = menu->get_popup();
popup->add_shortcut(ED_SHORTCUT("particles/setup_particles", TTR("Setup Particles"), KeyModifierMask::CTRL | KeyModifierMask::ALT | Key::R), MENU_SETUP_PARTICLES);
popup->add_separator();
popup->add_shortcut(ED_SHORTCUT("particles/restart_emission", TTR("Restart Emission"), KeyModifierMask::CTRL | Key::R), MENU_RESTART);
_add_menu_options(popup);
popup->add_item(conversion_option_name, MENU_OPTION_CONVERT);
} break;
}
}

void ParticlesEditorPlugin::_setup_particles_item_selected(int p_idx) {
setup_dialog_choice = SetupPreset(p_idx);
setup_dialog_help_bit->set_custom_text(setup_preset_names[p_idx], "", setup_preset_descriptions[p_idx]);
}

void ParticlesEditorPlugin::_setup_particles_item_activated(int p_idx) {
setup_dialog_choice = SetupPreset(p_idx);
setup_dialog->hide();
_setup_particles_confirmed();
}

void ParticlesEditorPlugin::_setup_particles_hide_requested() {
setup_dialog->hide();
}

void ParticlesEditorPlugin::_setup_particles_confirmed() {
GPUParticles3D *gpu_particles_3d = memnew(GPUParticles3D);

Ref<ParticleProcessMaterial> process_material;
process_material.instantiate();

process_material->set_direction(Vector3(0, 1, 0));
process_material->set_collision_mode(ParticleProcessMaterial::COLLISION_RIGID);
process_material->set_collision_friction(0.1);
process_material->set_collision_bounce(0.5);
process_material->set_collision_use_scale(true);

Ref<GradientTexture2D> color_ramp_texture;
color_ramp_texture.instantiate();
Ref<Gradient> color_ramp;
color_ramp.instantiate();
color_ramp->set_color(0, Color(1, 1, 1));
color_ramp->set_color(1, Color(0, 0, 0, 0));
color_ramp_texture->set_gradient(color_ramp);
process_material->set_color_ramp(color_ramp_texture);

Ref<CurveTexture> scale_curve_texture;
scale_curve_texture.instantiate();
Ref<Curve> scale_curve;
scale_curve.instantiate();
scale_curve->add_point(Vector2(0.0, 1.0));
scale_curve->add_point(Vector2(1.0, 0.0));
scale_curve_texture->set_curve(scale_curve);
process_material->set_param_texture(ParticleProcessMaterial::PARAM_SCALE, scale_curve_texture);

switch (setup_dialog_choice) {
case SETUP_PRESET_SMOKE:
process_material->set_gravity(Vector3(0, 0, 0));
process_material->set_spread(180);
process_material->set_param(ParticleProcessMaterial::PARAM_INITIAL_LINEAR_VELOCITY, Vector2(1.0, 1.0));
process_material->set_param(ParticleProcessMaterial::PARAM_DAMPING, Vector2(0.5, 0.5));
break;
case SETUP_PRESET_EXPLOSION:
gpu_particles_3d->set_explosiveness_ratio(1.0);
process_material->set_spread(90);
process_material->set_param(ParticleProcessMaterial::PARAM_INITIAL_LINEAR_VELOCITY, Vector2(2.5, 2.5));
break;
case SETUP_PRESET_SPRINKLE:
process_material->set_spread(15);
process_material->set_direction(Vector3(0, 1, 0));
process_material->set_gravity(Vector3(0, 5, 0));
process_material->set_param(ParticleProcessMaterial::PARAM_INITIAL_LINEAR_VELOCITY, Vector2(1.0, 1.0));
break;
}

gpu_particles_3d->set_amount(60);
// Disable interpolation and simulate particles every rendered frame for a smoother appearance.
// This sidesteps issues such as GH-50824, GH-51318 and GH-65390.
// This also affects the conversion to CPUParticles3D, which lacks support for interpolation.
gpu_particles_3d->set_fixed_fps(0);
gpu_particles_3d->set_interpolate(false);
gpu_particles_3d->set_process_material(process_material);

// Create material to display billboarded texture that follows the color and scale ramps
// defined in ParticleProcessMaterial.
Ref<StandardMaterial3D> material;
material.instantiate();
material->set_shading_mode(BaseMaterial3D::SHADING_MODE_UNSHADED);
material->set_transparency(BaseMaterial3D::TRANSPARENCY_ALPHA);
material->set_blend_mode(BaseMaterial3D::BLEND_MODE_PREMULT_ALPHA);
material->set_flag(BaseMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
material->set_flag(BaseMaterial3D::FLAG_BILLBOARD_KEEP_SCALE, true);
material->set_billboard_mode(BaseMaterial3D::BILLBOARD_PARTICLES);

// Assign a smooth circle texture.
Ref<GradientTexture2D> texture;
texture.instantiate();
texture->set_fill(GradientTexture2D::FILL_RADIAL);
texture->set_fill_from(Vector2(0.5, 0.5));
texture->set_fill_to(Vector2(0.5, 0.01));
Ref<Gradient> gradient;
gradient.instantiate();
gradient->set_color(0, Color(1, 1, 1));
gradient->set_offset(0, 0.9);
gradient->set_color(1, Color(0, 0, 0, 0));
texture->set_gradient(gradient);
material->set_texture(BaseMaterial3D::TEXTURE_ALBEDO, texture);

if (setup_dialog_add_trails->is_pressed()) {
gpu_particles_3d->set_trail_enabled(true);
gpu_particles_3d->set_trail_lifetime(0.1);
// Fixed FPS is required for particle trails to work correctly (otherwise, it falls back to 30 FPS).
gpu_particles_3d->set_fixed_fps(60);
process_material->set_particle_flag(ParticleProcessMaterial::PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY, true);
material->set_flag(BaseMaterial3D::FLAG_PARTICLE_TRAILS_MODE, true);
material->set_billboard_mode(BaseMaterial3D::BILLBOARD_DISABLED);

Ref<RibbonTrailMesh> ribbon_trail_mesh = memnew(RibbonTrailMesh);
ribbon_trail_mesh->set_size(0.025);
ribbon_trail_mesh->set_material(material);
gpu_particles_3d->set_draw_pass_mesh(0, ribbon_trail_mesh);
} else {
Ref<QuadMesh> quad_mesh = memnew(QuadMesh);
quad_mesh->set_size(Vector2(0.025, 0.025));
quad_mesh->set_material(material);
gpu_particles_3d->set_draw_pass_mesh(0, quad_mesh);
}

Node *new_particles;
if (handled_type.begins_with("CPU")) {
CPUParticles3D *cpu_particles_3d = memnew(CPUParticles3D);
cpu_particles_3d->convert_from_particles(gpu_particles_3d);
new_particles = cpu_particles_3d;
} else {
new_particles = gpu_particles_3d;
}

EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
ur->create_action(vformat(TTR("Setup Particles for \"%s\" with preset: %s"), edited_node->get_name(), setup_dialog_choices->get_item_text(setup_dialog_choice)), UndoRedo::MERGE_DISABLE, edited_node);

Check failure on line 209 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor w/ Mono (target=editor)

'setup_dialog_choices' was not declared in this scope; did you mean 'setup_dialog_choice'?

Check failure on line 209 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor (target=editor, tests=yes)

'setup_dialog_choices': undeclared identifier
SceneTreeDock::get_singleton()->replace_node(edited_node, new_particles);
ur->commit_action(false);
}

bool ParticlesEditorPlugin::need_show_lifetime_dialog(SpinBox *p_seconds) {
// Add one second to the default generation lifetime, since the progress is updated every second.
p_seconds->set_value(MAX(1.0, trunc(edited_node->get("lifetime").operator double()) + 1.0));
Expand All @@ -95,6 +235,16 @@ void ParticlesEditorPlugin::_menu_callback(int p_idx) {
ur->commit_action(false);
} break;

case MENU_SETUP_PARTICLES: {
setup_dialog->popup_centered_clamped(Size2i(500, 0) * EDSCALE);
// Select first item in the list automatically and grab focus,
// so you can choose with the keyboard and press Enter.
setup_dialog_choices->select(0);

Check failure on line 242 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor w/ Mono (target=editor)

'setup_dialog_choices' was not declared in this scope; did you mean 'setup_dialog_choice'?

Check failure on line 242 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor (target=editor, tests=yes)

'setup_dialog_choices': undeclared identifier
// Required to update the description shown at the bottom of the dialog.
_setup_particles_item_selected(0);

Check failure on line 244 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor w/ Mono (target=editor)

this statement may fall through
setup_dialog_choices->grab_focus();

Check failure on line 245 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor (target=editor, tests=yes)

'setup_dialog_choices': undeclared identifier

Check failure on line 245 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, scu_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=gold)

this statement may fall through
}

case MENU_RESTART: {
edited_node->call("restart");
}
Expand All @@ -121,6 +271,38 @@ ParticlesEditorPlugin::ParticlesEditorPlugin() {
menu->set_switch_on_hover(true);
toolbar->add_child(menu);
menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &ParticlesEditorPlugin::_menu_callback));

setup_dialog = memnew(ConfirmationDialog);
toolbar->add_child(setup_dialog);
setup_dialog->set_title(TTR("Choose a Particles Type"));
setup_dialog->connect(SceneStringName(confirmed), callable_mp(this, &ParticlesEditorPlugin::_setup_particles_confirmed));

VBoxContainer *setup_dialog_vbc = memnew(VBoxContainer);
setup_dialog->add_child(setup_dialog_vbc);

setup_dialog_choices = memnew(ItemList);

Check failure on line 283 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor w/ Mono (target=editor)

'setup_dialog_choices' was not declared in this scope; did you mean 'setup_dialog_choice'?

Check failure on line 283 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor (target=editor, tests=yes)

'setup_dialog_choices': undeclared identifier
setup_dialog_choices->set_custom_minimum_size(Size2(0, 250) * EDSCALE);

Check failure on line 284 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor (target=editor, tests=yes)

'setup_dialog_choices': undeclared identifier
// Items here must match the order of the SetupPreset enum.
setup_dialog_choices->add_item(TTR("Smoke"));

Check failure on line 286 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor (target=editor, tests=yes)

'setup_dialog_choices': undeclared identifier
setup_dialog_choices->add_item(TTR("Explosion"));

Check failure on line 287 in editor/plugins/particles_editor_plugin.cpp

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor (target=editor, tests=yes)

'setup_dialog_choices': undeclared identifier
setup_dialog_choices->add_item(TTR("Sprinkle"));
setup_dialog_choices->connect(SceneStringName(item_selected), callable_mp(this, &ParticlesEditorPlugin::_setup_particles_item_selected));
setup_dialog_choices->connect(SceneStringName(item_activated), callable_mp(this, &ParticlesEditorPlugin::_setup_particles_item_activated));
setup_dialog_vbc->add_child(setup_dialog_choices);

setup_dialog_help_bit = memnew(EditorHelpBit);
setup_dialog_help_bit->set_content_height_limits(64 * EDSCALE, 64 * EDSCALE);
setup_dialog_help_bit->connect("request_hide", callable_mp(this, &ParticlesEditorPlugin::_setup_particles_hide_requested));
setup_dialog_vbc->add_margin_child(TTR("Description:"), setup_dialog_help_bit);

setup_dialog_add_trails = memnew(CheckBox);
if (handled_type.begins_with("CPU")) {
setup_dialog_add_trails->set_text(TTR("Enable Trails") + " " + TTR("(not supported with CPUParticles)"));
setup_dialog_add_trails->set_disabled(true);
} else {
setup_dialog_add_trails->set_text(TTR("Enable Trails"));
}
setup_dialog_vbc->add_child(setup_dialog_add_trails);
}

// 2D /////////////////////////////////////////////
Expand Down
32 changes: 32 additions & 0 deletions editor/plugins/particles_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,46 @@ class MenuButton;
class OptionButton;
class SceneTreeDialog;
class SpinBox;
class EditorHelpBit;

class ParticlesEditorPlugin : public EditorPlugin {
GDCLASS(ParticlesEditorPlugin, EditorPlugin);

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🤖 Android / Editor (target=editor)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🤖 Android / Editor (target=editor)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🤖 Android / Editor (target=editor)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🤖 Android / Editor (target=editor)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🤖 Android / Editor (target=editor)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🤖 Android / Editor (target=editor)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🤖 Android / Editor (target=editor)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🤖 Android / Editor (target=editor)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🤖 Android / Editor (target=editor)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🍎 macOS / Editor (target=editor, tests=yes)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🍎 macOS / Editor (target=editor, tests=yes)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🍎 macOS / Editor (target=editor, tests=yes)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🍎 macOS / Editor (target=editor, tests=yes)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🍎 macOS / Editor (target=editor, tests=yes)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🍎 macOS / Editor (target=editor, tests=yes)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🍎 macOS / Editor (target=editor, tests=yes)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🍎 macOS / Editor (target=editor, tests=yes)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🍎 macOS / Editor (target=editor, tests=yes)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const Object' with an expression of type 'const ParticlesEditorPlugin'

Check failure on line 48 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)

cannot initialize object parameter of type 'const EditorPlugin' with an expression of type 'const ParticlesEditorPlugin'

private:
enum {
MENU_OPTION_CONVERT,
MENU_SETUP_PARTICLES,
MENU_RESTART
};

enum SetupPreset {
SETUP_PRESET_SMOKE,
SETUP_PRESET_EXPLOSION,
SETUP_PRESET_SPRINKLE,
};

PackedStringArray setup_preset_names = {
TTR("Smoke"),
TTR("Explosion"),
TTR("Sprinkle"),
};

PackedStringArray setup_preset_descriptions = {
TTR("Smoke slowly emitting in all directions."),
TTR("An explosion that emits all particles at once, propelling particles upwards with gravity. Enable the Oneshot property for the explosion to occur only once."),
TTR("Particles quickly sprinkling upwards."),
};

SetupPreset setup_dialog_choice = SETUP_PRESET_SMOKE;

HBoxContainer *toolbar = nullptr;
MenuButton *menu = nullptr;

ConfirmationDialog *setup_dialog = nullptr;
ItemList *setup_dialog_choices = nullptr;

Check failure on line 81 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🤖 Android / Editor (target=editor)

unknown type name 'ItemList'

Check failure on line 81 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🍎 macOS / Editor (target=editor, tests=yes)

unknown type name 'ItemList'

Check failure on line 81 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)

unknown type name 'ItemList'

Check failure on line 81 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes)

unknown type name 'ItemList'

Check failure on line 81 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)

unknown type name 'ItemList'

Check failure on line 81 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor w/ Mono (target=editor)

'ItemList' does not name a type

Check failure on line 81 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor (target=editor, tests=yes)

syntax error: missing ';' before '*'

Check failure on line 81 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor (target=editor, tests=yes)

missing type specifier - int assumed. Note: C++ does not support default-int

Check failure on line 81 in editor/plugins/particles_editor_plugin.h

View workflow job for this annotation

GitHub Actions / 🏁 Windows / Editor (target=editor, tests=yes)

unexpected token(s) preceding ';'
EditorHelpBit *setup_dialog_help_bit = nullptr;
CheckBox *setup_dialog_add_trails = nullptr;

protected:
String handled_type;
String conversion_option_name;
Expand All @@ -66,6 +93,11 @@ class ParticlesEditorPlugin : public EditorPlugin {
bool need_show_lifetime_dialog(SpinBox *p_seconds);
virtual void _menu_callback(int p_idx);

void _setup_particles_item_selected(int p_idx);
void _setup_particles_item_activated(int p_idx);
void _setup_particles_hide_requested();
void _setup_particles_confirmed();

virtual void _add_menu_options(PopupMenu *p_menu) {}
virtual Node *_convert_particles() = 0;

Expand Down
1 change: 1 addition & 0 deletions scene/scene_string_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class SceneStringNames {

const StringName panel = StaticCString::create("panel");
const StringName item_selected = StaticCString::create("item_selected");
const StringName item_activated = StaticCString::create("item_activated");
const StringName confirmed = StaticCString::create("confirmed");

const StringName text_changed = StaticCString::create("text_changed");
Expand Down

0 comments on commit 4fa08e7

Please sign in to comment.