summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2019-08-15 15:54:12 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2019-08-15 16:01:39 +0200
commit63d45136dceedf207a490ca070f3b437d37126e4 (patch)
tree52657cd06b17c934fb47ea2d03d0d0dd38f41342 /editor
parentdd31974a88763bb032fb726c3ced2ca74c804c39 (diff)
Improve error reporting in the Particles emission point creation dialog
- Display an error message if the selected node doesn't extend from Spatial - Display the selected node name in error messages to provide additional context when relevant - Clarify error messages - Use the standard editor warning dialog
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/particles_editor_plugin.cpp21
-rw-r--r--editor/plugins/particles_editor_plugin.h2
2 files changed, 10 insertions, 13 deletions
diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp
index 75d31459e8..31b0539bfe 100644
--- a/editor/plugins/particles_editor_plugin.cpp
+++ b/editor/plugins/particles_editor_plugin.cpp
@@ -55,8 +55,7 @@ bool ParticlesEditorBase::_generate(PoolVector<Vector3> &points, PoolVector<Vect
if (!triangle_area_map.size() || area_accum == 0) {
- err_dialog->set_text(TTR("Faces contain no area!"));
- err_dialog->popup_centered_minsize();
+ EditorNode::get_singleton()->show_warning(TTR("The geometry's faces don't contain any area."));
return false;
}
@@ -90,8 +89,7 @@ bool ParticlesEditorBase::_generate(PoolVector<Vector3> &points, PoolVector<Vect
if (gcount == 0) {
- err_dialog->set_text(TTR("No faces!"));
- err_dialog->popup_centered_minsize();
+ EditorNode::get_singleton()->show_warning(TTR("The geometry doesn't contain any faces."));
return false;
}
@@ -169,11 +167,16 @@ void ParticlesEditorBase::_node_selected(const NodePath &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) {
- err_dialog->set_text(TTR("Node does not contain geometry."));
- err_dialog->popup_centered_minsize();
+ EditorNode::get_singleton()->show_warning(vformat(TTR("\"%s\" doesn't contain geometry."), sel->get_name()));
return;
}
@@ -181,8 +184,7 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) {
if (geometry.size() == 0) {
- err_dialog->set_text(TTR("Node does not contain geometry (faces)."));
- err_dialog->popup_centered_minsize();
+ EditorNode::get_singleton()->show_warning(vformat(TTR("\"%s\" doesn't contain face geometry."), sel->get_name()));
return;
}
@@ -231,9 +233,6 @@ ParticlesEditorBase::ParticlesEditorBase() {
emission_dialog->get_ok()->set_text(TTR("Create"));
emission_dialog->connect("confirmed", this, "_generate_emission_points");
- err_dialog = memnew(ConfirmationDialog);
- add_child(err_dialog);
-
emission_file_dialog = memnew(EditorFileDialog);
add_child(emission_file_dialog);
emission_file_dialog->connect("file_selected", this, "_resource_seleted");
diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h
index f689240371..1b3a1877a4 100644
--- a/editor/plugins/particles_editor_plugin.h
+++ b/editor/plugins/particles_editor_plugin.h
@@ -49,8 +49,6 @@ protected:
EditorFileDialog *emission_file_dialog;
SceneTreeDialog *emission_tree_dialog;
- ConfirmationDialog *err_dialog;
-
ConfirmationDialog *emission_dialog;
SpinBox *emission_amount;
OptionButton *emission_fill;