Fix file dialog, of Particles2D plugin, showing "Error" icons

(cherry picked from commit 8d2a957e36)
This commit is contained in:
Franklin Sobrinho 2016-03-14 16:05:20 -03:00 committed by Rémi Verschelde
parent 8de0405032
commit 812de22194
2 changed files with 17 additions and 17 deletions

View File

@ -26,10 +26,11 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "particles_2d_editor_plugin.h" #include "particles_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h" #include "canvas_item_editor_plugin.h"
#include "io/image_loader.h" #include "io/image_loader.h"
#include "scene/gui/separator.h"
void Particles2DEditorPlugin::edit(Object *p_object) { void Particles2DEditorPlugin::edit(Object *p_object) {
@ -49,12 +50,10 @@ void Particles2DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
sep->show(); toolbar->show();
menu->show();
} else { } else {
menu->hide(); toolbar->hide();
sep->hide();
} }
} }
@ -164,35 +163,36 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
particles=NULL; particles=NULL;
editor=p_node; editor=p_node;
undo_redo=editor->get_undo_redo(); undo_redo=editor->get_undo_redo();
sep = memnew( VSeparator );
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(sep); toolbar = memnew( HBoxContainer );
sep->hide(); add_control_to_container(CONTAINER_CANVAS_EDITOR_MENU, toolbar);
toolbar->hide();
toolbar->add_child( memnew( VSeparator ) );
menu = memnew( MenuButton ); menu = memnew( MenuButton );
menu->get_popup()->add_item("Load Emission Mask",MENU_LOAD_EMISSION_MASK); 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->get_popup()->add_item("Clear Emission Mask",MENU_CLEAR_EMISSION_MASK);
menu->set_text("Particles"); menu->set_text("Particles");
toolbar->add_child(menu);
file = memnew( EditorFileDialog ); file = memnew( EditorFileDialog );
add_child(file);
List<String> ext; List<String> ext;
ImageLoader::get_recognized_extensions(&ext); ImageLoader::get_recognized_extensions(&ext);
for(List<String>::Element *E=ext.front();E;E=E->next()) { for(List<String>::Element *E=ext.front();E;E=E->next()) {
file->add_filter("*."+E->get()+"; "+E->get().to_upper()); file->add_filter("*."+E->get()+"; "+E->get().to_upper());
} }
file->set_mode(EditorFileDialog::MODE_OPEN_FILE); file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(menu); toolbar->add_child(file);
epoints = memnew( SpinBox ); epoints = memnew( SpinBox );
epoints->set_min(1); epoints->set_min(1);
epoints->set_max(8192); epoints->set_max(8192);
epoints->set_step(1); epoints->set_step(1);
epoints->set_val(512); epoints->set_val(512);
file->get_vbox()->add_margin_child("Generated Point Count:",epoints); file->get_vbox()->add_margin_child("Generated Point Count:",epoints);
menu->hide();
} }
Particles2DEditorPlugin::~Particles2DEditorPlugin() Particles2DEditorPlugin::~Particles2DEditorPlugin()
{ {
} }

View File

@ -33,7 +33,7 @@
#include "tools/editor/editor_node.h" #include "tools/editor/editor_node.h"
#include "scene/2d/collision_polygon_2d.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/gui/file_dialog.h"
#include "scene/2d/particles_2d.h" #include "scene/2d/particles_2d.h"
@ -47,14 +47,14 @@ class Particles2DEditorPlugin : public EditorPlugin {
MENU_CLEAR_EMISSION_MASK MENU_CLEAR_EMISSION_MASK
}; };
Particles2D *particles;
EditorFileDialog *file; EditorFileDialog *file;
EditorNode *editor; EditorNode *editor;
HBoxContainer *toolbar;
MenuButton *menu; MenuButton *menu;
VSeparator *sep;
Particles2D *particles;
SpinBox *epoints; SpinBox *epoints;
UndoRedo *undo_redo; UndoRedo *undo_redo;