From e6df7da6abe89979dea501cd48ff288f27a3c394 Mon Sep 17 00:00:00 2001 From: marynate Date: Thu, 10 Jul 2014 10:55:03 +0800 Subject: Particles editor menu not display in proper position --- tools/editor/plugins/particles_editor_plugin.cpp | 18 +++++++----------- tools/editor/plugins/particles_editor_plugin.h | 5 ++++- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'tools/editor/plugins') diff --git a/tools/editor/plugins/particles_editor_plugin.cpp b/tools/editor/plugins/particles_editor_plugin.cpp index 38781d93b9..418ad11704 100644 --- a/tools/editor/plugins/particles_editor_plugin.cpp +++ b/tools/editor/plugins/particles_editor_plugin.cpp @@ -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(); } diff --git a/tools/editor/plugins/particles_editor_plugin.h b/tools/editor/plugins/particles_editor_plugin.h index ba655c9b39..3e4b0f73aa 100644 --- a/tools/editor/plugins/particles_editor_plugin.h +++ b/tools/editor/plugins/particles_editor_plugin.h @@ -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); -- cgit v1.2.3