Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Particles editor plugin generate emission point from mesh file broken #33099

Open
thimenesup opened this issue Oct 27, 2019 · 8 comments · May be fixed by #84124
Open

Particles editor plugin generate emission point from mesh file broken #33099

thimenesup opened this issue Oct 27, 2019 · 8 comments · May be fixed by #84124

Comments

@thimenesup
Copy link
Contributor

Godot version: 3.1.0

OS/device including version: Windows 10 (Irrelevant)

Issue description: When creating emission points from a mesh they won't get generated and this error will appear: "core/object.cpp:1238 - Error calling method from signal 'file_selected': 'ParticlesEditor::_resource_seleted': Method not found." besides the method not being spelled correctly, from reading the source it looks like it doesn't even exist?

Steps to reproduce: Create Particle node, select it, click on Create Emission Points From Mesh,
select the mesh file and the error will appear.
Minimal reproduction project: (Reproducing its simple and such is irrelevant)

And yes, generating from a MeshInstance node works fine. So it would be a really low priority issue.

@clayjohn
Copy link
Member

clayjohn commented Oct 27, 2019

Looks like reduz just forgot to add it 😆

Here you can see the signal connection (typo and everything):

emission_file_dialog = memnew(EditorFileDialog);
add_child(emission_file_dialog);
emission_file_dialog->connect("file_selected", this, "_resource_seleted");
emission_tree_dialog = memnew(SceneTreeDialog);
add_child(emission_tree_dialog);
emission_tree_dialog->connect("selected", this, "_node_selected");

And here you can see _node_selected is implemented:

void ParticlesEditorBase::_node_selected(const NodePath &p_path) {
Node *sel = get_node(p_path);
if (!sel)
return;
if (!sel->is_class("Spatial")) {
EditorNode::get_singleton()->show_warning(vformat(TTR("\"%s\" doesn't inherit from Spatial."), sel->get_name()));
return;
}
VisualInstance *vi = Object::cast_to<VisualInstance>(sel);
if (!vi) {
EditorNode::get_singleton()->show_warning(vformat(TTR("\"%s\" doesn't contain geometry."), sel->get_name()));
return;
}
geometry = vi->get_faces(VisualInstance::FACES_SOLID);
if (geometry.size() == 0) {
EditorNode::get_singleton()->show_warning(vformat(TTR("\"%s\" doesn't contain face geometry."), sel->get_name()));
return;
}
Transform geom_xform = base_node->get_global_transform().affine_inverse() * vi->get_global_transform();
int gc = geometry.size();
PoolVector<Face3>::Write w = geometry.write();
for (int i = 0; i < gc; i++) {
for (int j = 0; j < 3; j++) {
w[i].vertex[j] = geom_xform.xform(w[i].vertex[j]);
}
}
w.release();
emission_dialog->popup_centered(Size2(300, 130));
}

Ill bet you can copy a lot of the _node_selected code to implement it.

CC: @hmech (if you are interested in a good first PR)

@hmech
Copy link

hmech commented Oct 27, 2019 via email

@shredder2004
Copy link

Hey @clayjohn ,

I've took a look at that issue. Like you said: there's a lot of code that could be borrowed from the "_node_selected" method. However I wanted to know what was the intended behavior here ?

The "Create emission point from node" one is pretty obvious since it takes the coordinate of an already placed object in the world. However, what should the editor do when a user create an emission point from a mesh. At the moment, it does open a file dialog so you can select a mesh from the file system. Does that mean that it should create a child of the Particles node and make it a mesh node then pop the Emission dialog ?

Cheers !

@andresfelipemendez
Copy link

I tried to work on this but I noticed that on the master branch this menu option is removed and I wonder if this featured is necessary in the first place since for example GLTF files are imported as scenes this functionality is better handled with the _node_selected option

@Calinou
Copy link
Member

Calinou commented Jul 11, 2020

@Mishari713
Copy link

Mishari713 commented Apr 27, 2023

@Calinou Is this issue now solvable after having the Particles featured implemented?

@Kemikal1

This comment was marked as off-topic.

@Patchcoat
Copy link
Contributor

I'm currently working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.