diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 290e0a32398..475ae8a0d4e 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -3548,6 +3548,7 @@ void VisualShaderEditor::_add_node(int p_idx, const Vector &p_ops, cons bool is_curve = (Object::cast_to(vsnode.ptr()) != nullptr); bool is_curve_xyz = (Object::cast_to(vsnode.ptr()) != nullptr); bool is_parameter = (Object::cast_to(vsnode.ptr()) != nullptr); + bool is_mesh_emitter = (Object::cast_to(vsnode.ptr()) != nullptr); Point2 position = graph->get_scroll_offset(); @@ -3754,6 +3755,12 @@ void VisualShaderEditor::_add_node(int p_idx, const Vector &p_ops, cons if (is_texture2d_array) { undo_redo->add_do_method(vsnode.ptr(), "set_texture_array", ResourceLoader::load(p_resource_path)); + return; + } + + if (is_mesh_emitter) { + undo_redo->add_do_method(vsnode.ptr(), "set_mesh", ResourceLoader::load(p_resource_path)); + return; } } } @@ -5867,6 +5874,11 @@ void VisualShaderEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da saved_node_pos = p_point + Vector2(0, i * 250 * EDSCALE); saved_node_pos_dirty = true; _add_node(cubemap_node_option_idx, {}, arr[i], i); + } else if (type == "Mesh" && visual_shader->get_mode() == Shader::MODE_PARTICLES && + (visual_shader->get_shader_type() == VisualShader::TYPE_START || visual_shader->get_shader_type() == VisualShader::TYPE_START_CUSTOM)) { + saved_node_pos = p_point + Vector2(0, i * 250 * EDSCALE); + saved_node_pos_dirty = true; + _add_node(mesh_emitter_option_idx, {}, arr[i], i); } } } @@ -6708,7 +6720,10 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("MultiplyByAxisAngle (*)", "Particles/Transform", "VisualShaderNodeParticleMultiplyByAxisAngle", TTR("A node for help to multiply a position input vector by rotation using specific axis. Intended to work with emitters."), {}, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_EMIT | TYPE_FLAGS_PROCESS | TYPE_FLAGS_COLLIDE, Shader::MODE_PARTICLES)); add_options.push_back(AddOption("BoxEmitter", "Particles/Emitters", "VisualShaderNodeParticleBoxEmitter", "", {}, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); + + mesh_emitter_option_idx = add_options.size(); add_options.push_back(AddOption("MeshEmitter", "Particles/Emitters", "VisualShaderNodeParticleMeshEmitter", "", {}, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); + add_options.push_back(AddOption("RingEmitter", "Particles/Emitters", "VisualShaderNodeParticleRingEmitter", "", {}, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); add_options.push_back(AddOption("SphereEmitter", "Particles/Emitters", "VisualShaderNodeParticleSphereEmitter", "", {}, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_EMIT, Shader::MODE_PARTICLES)); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index ee2bf605d94..1bf77c04703 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -392,6 +392,7 @@ class VisualShaderEditor : public VBoxContainer { int custom_node_option_idx; int curve_node_option_idx; int curve_xyz_node_option_idx; + int mesh_emitter_option_idx; List keyword_list; List uniform_refs;