Merge pull request #580 from marynate/PR-fix-particles-editor-menu

Particles editor menu not display in proper position
This commit is contained in:
Juan Linietsky 2014-09-17 10:44:22 -03:00
commit 02a694ff48
2 changed files with 11 additions and 12 deletions

View File

@ -29,6 +29,7 @@
#include "particles_editor_plugin.h"
#include "io/resource_loader.h"
#include "servers/visual/particle_system_sw.h"
#include "tools/editor/plugins/spatial_editor_plugin.h"
void ParticlesEditor::_node_removed(Node *p_node) {
@ -340,9 +341,11 @@ void ParticlesEditor::_bind_methods() {
ParticlesEditor::ParticlesEditor() {
particles_editor_hb = memnew ( HBoxContainer );
SpatialEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb);
options = memnew( MenuButton );
add_child(options);
options->set_area_as_parent_rect();
particles_editor_hb->add_child(options);
particles_editor_hb->hide();
options->set_text("Particles");
options->get_popup()->add_item("Generate AABB",MENU_OPTION_GENERATE_AABB);
@ -429,8 +432,9 @@ void ParticlesEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
particles_editor->show();
particles_editor->particles_editor_hb->show();
} else {
particles_editor->particles_editor_hb->hide();
particles_editor->hide();
particles_editor->edit(NULL);
}
@ -443,14 +447,6 @@ ParticlesEditorPlugin::ParticlesEditorPlugin(EditorNode *p_node) {
particles_editor = memnew( ParticlesEditor );
editor->get_viewport()->add_child(particles_editor);
// particles_editor->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
// particles_editor->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
particles_editor->set_margin(MARGIN_LEFT,253);
particles_editor->set_margin(MARGIN_RIGHT,280);
particles_editor->set_margin(MARGIN_TOP,0);
particles_editor->set_margin(MARGIN_BOTTOM,10);
particles_editor->hide();
}

View File

@ -43,7 +43,8 @@ class ParticlesEditor : public Control {
OBJ_TYPE(ParticlesEditor, Control );
Panel *panel;
MenuButton * options;
MenuButton *options;
HBoxContainer *particles_editor_hb;
Particles *node;
@ -78,6 +79,8 @@ class ParticlesEditor : public Control {
void _populate();
friend class ParticlesEditorPlugin;
protected:
void _notification(int p_notification);