From 812de2219423ad8511ea554856b48654daa2b054 Mon Sep 17 00:00:00 2001 From: Franklin Sobrinho Date: Mon, 14 Mar 2016 16:05:20 -0300 Subject: [PATCH] Fix file dialog, of Particles2D plugin, showing "Error" icons (cherry picked from commit 8d2a957e360bd66e02522a18161df8b35c0db0df) --- .../plugins/particles_2d_editor_plugin.cpp | 28 +++++++++---------- .../plugins/particles_2d_editor_plugin.h | 6 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/editor/plugins/particles_2d_editor_plugin.cpp b/tools/editor/plugins/particles_2d_editor_plugin.cpp index 2488c4cdd98..297145f408c 100644 --- a/tools/editor/plugins/particles_2d_editor_plugin.cpp +++ b/tools/editor/plugins/particles_2d_editor_plugin.cpp @@ -26,10 +26,11 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "particles_2d_editor_plugin.h" #include "canvas_item_editor_plugin.h" #include "io/image_loader.h" - +#include "scene/gui/separator.h" void Particles2DEditorPlugin::edit(Object *p_object) { @@ -49,12 +50,10 @@ void Particles2DEditorPlugin::make_visible(bool p_visible) { if (p_visible) { - sep->show(); - menu->show(); + toolbar->show(); } else { - menu->hide(); - sep->hide(); + toolbar->hide(); } } @@ -164,35 +163,36 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { particles=NULL; editor=p_node; undo_redo=editor->get_undo_redo(); - sep = memnew( VSeparator ); - CanvasItemEditor::get_singleton()->add_control_to_menu_panel(sep); - sep->hide(); + + toolbar = memnew( HBoxContainer ); + add_control_to_container(CONTAINER_CANVAS_EDITOR_MENU, toolbar); + toolbar->hide(); + + toolbar->add_child( memnew( VSeparator ) ); menu = memnew( MenuButton ); menu->get_popup()->add_item("Load Emission Mask",MENU_LOAD_EMISSION_MASK); menu->get_popup()->add_item("Clear Emission Mask",MENU_CLEAR_EMISSION_MASK); menu->set_text("Particles"); + toolbar->add_child(menu); - file = memnew(EditorFileDialog); - add_child(file); + file = memnew( EditorFileDialog ); List ext; ImageLoader::get_recognized_extensions(&ext); for(List::Element *E=ext.front();E;E=E->next()) { file->add_filter("*."+E->get()+"; "+E->get().to_upper()); } file->set_mode(EditorFileDialog::MODE_OPEN_FILE); - CanvasItemEditor::get_singleton()->add_control_to_menu_panel(menu); + toolbar->add_child(file); + epoints = memnew( SpinBox ); epoints->set_min(1); epoints->set_max(8192); epoints->set_step(1); epoints->set_val(512); file->get_vbox()->add_margin_child("Generated Point Count:",epoints); - menu->hide(); - } - Particles2DEditorPlugin::~Particles2DEditorPlugin() { } diff --git a/tools/editor/plugins/particles_2d_editor_plugin.h b/tools/editor/plugins/particles_2d_editor_plugin.h index f70a0e7b769..ce2056b482e 100644 --- a/tools/editor/plugins/particles_2d_editor_plugin.h +++ b/tools/editor/plugins/particles_2d_editor_plugin.h @@ -33,7 +33,7 @@ #include "tools/editor/editor_node.h" #include "scene/2d/collision_polygon_2d.h" -#include "scene/gui/separator.h" +#include "scene/gui/box_container.h" #include "scene/gui/file_dialog.h" #include "scene/2d/particles_2d.h" @@ -47,14 +47,14 @@ class Particles2DEditorPlugin : public EditorPlugin { MENU_CLEAR_EMISSION_MASK }; + Particles2D *particles; EditorFileDialog *file; EditorNode *editor; + HBoxContainer *toolbar; MenuButton *menu; - VSeparator *sep; - Particles2D *particles; SpinBox *epoints; UndoRedo *undo_redo;