Merge pull request #2626 from TheHX/editor_dialogs

Small fixes in some editor dialogs
This commit is contained in:
Juan Linietsky 2015-11-18 19:17:55 -03:00
commit 551925475b
6 changed files with 66 additions and 80 deletions

View File

@ -1279,6 +1279,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
add_child(file); add_child(file);
name_dialog = memnew( ConfirmationDialog ); name_dialog = memnew( ConfirmationDialog );
name_dialog->set_title("Create New Animation");
name_dialog->set_hide_on_ok(false); name_dialog->set_hide_on_ok(false);
add_child(name_dialog); add_child(name_dialog);
name = memnew( LineEdit ); name = memnew( LineEdit );

View File

@ -42,8 +42,8 @@ class SnapDialog : public ConfirmationDialog {
OBJ_TYPE(SnapDialog,ConfirmationDialog); OBJ_TYPE(SnapDialog,ConfirmationDialog);
protected: friend class CanvasItemEditor;
friend class CanvasItemEditor;
SpinBox *grid_offset_x; SpinBox *grid_offset_x;
SpinBox *grid_offset_y; SpinBox *grid_offset_y;
SpinBox *grid_step_x; SpinBox *grid_step_x;
@ -61,60 +61,72 @@ public:
set_title("Configure Snap"); set_title("Configure Snap");
get_ok()->set_text("Close"); get_ok()->set_text("Close");
container = memnew(VBoxContainer);
add_child(container);
child_container = memnew(GridContainer); container = memnew( VBoxContainer );
add_child(container);
set_child_rect(container);
child_container = memnew( GridContainer );
child_container->set_columns(3); child_container->set_columns(3);
container->add_child(child_container); container->add_child(child_container);
label = memnew(Label); label = memnew( Label );
label->set_text("Grid Offset:"); label->set_text("Grid Offset:");
child_container->add_child(label); child_container->add_child(label);
grid_offset_x=memnew(SpinBox); label->set_h_size_flags(SIZE_EXPAND_FILL);
grid_offset_x = memnew( SpinBox );
grid_offset_x->set_min(-SPIN_BOX_GRID_RANGE); grid_offset_x->set_min(-SPIN_BOX_GRID_RANGE);
grid_offset_x->set_max(SPIN_BOX_GRID_RANGE); grid_offset_x->set_max(SPIN_BOX_GRID_RANGE);
grid_offset_x->set_suffix("px"); grid_offset_x->set_suffix("px");
child_container->add_child(grid_offset_x); child_container->add_child(grid_offset_x);
grid_offset_y=memnew(SpinBox);
grid_offset_y = memnew( SpinBox );
grid_offset_y->set_min(-SPIN_BOX_GRID_RANGE); grid_offset_y->set_min(-SPIN_BOX_GRID_RANGE);
grid_offset_y->set_max(SPIN_BOX_GRID_RANGE); grid_offset_y->set_max(SPIN_BOX_GRID_RANGE);
grid_offset_y->set_suffix("px"); grid_offset_y->set_suffix("px");
child_container->add_child(grid_offset_y); child_container->add_child(grid_offset_y);
label = memnew(Label); label = memnew( Label );
label->set_text("Grid Step:"); label->set_text("Grid Step:");
child_container->add_child(label); child_container->add_child(label);
grid_step_x=memnew(SpinBox); label->set_h_size_flags(SIZE_EXPAND_FILL);
grid_step_x = memnew( SpinBox );
grid_step_x->set_min(-SPIN_BOX_GRID_RANGE); grid_step_x->set_min(-SPIN_BOX_GRID_RANGE);
grid_step_x->set_max(SPIN_BOX_GRID_RANGE); grid_step_x->set_max(SPIN_BOX_GRID_RANGE);
grid_step_x->set_suffix("px"); grid_step_x->set_suffix("px");
child_container->add_child(grid_step_x); child_container->add_child(grid_step_x);
grid_step_y=memnew(SpinBox);
grid_step_y = memnew( SpinBox );
grid_step_y->set_min(-SPIN_BOX_GRID_RANGE); grid_step_y->set_min(-SPIN_BOX_GRID_RANGE);
grid_step_y->set_max(SPIN_BOX_GRID_RANGE); grid_step_y->set_max(SPIN_BOX_GRID_RANGE);
grid_step_y->set_suffix("px"); grid_step_y->set_suffix("px");
child_container->add_child(grid_step_y); child_container->add_child(grid_step_y);
container->add_child(memnew(HSeparator)); container->add_child( memnew( HSeparator ) );
child_container = memnew(GridContainer); child_container = memnew( GridContainer );
child_container->set_columns(2); child_container->set_columns(2);
container->add_child(child_container); container->add_child(child_container);
label = memnew(Label); label = memnew( Label );
label->set_text("Rotation Offset:"); label->set_text("Rotation Offset:");
child_container->add_child(label); child_container->add_child(label);
rotation_offset=memnew(SpinBox); label->set_h_size_flags(SIZE_EXPAND_FILL);
rotation_offset = memnew( SpinBox );
rotation_offset->set_min(-SPIN_BOX_ROTATION_RANGE); rotation_offset->set_min(-SPIN_BOX_ROTATION_RANGE);
rotation_offset->set_max(SPIN_BOX_ROTATION_RANGE); rotation_offset->set_max(SPIN_BOX_ROTATION_RANGE);
rotation_offset->set_suffix("deg"); rotation_offset->set_suffix("deg");
child_container->add_child(rotation_offset); child_container->add_child(rotation_offset);
label = memnew(Label); label = memnew( Label );
label->set_text("Rotation Step:"); label->set_text("Rotation Step:");
child_container->add_child(label); child_container->add_child(label);
rotation_step=memnew(SpinBox); label->set_h_size_flags(SIZE_EXPAND_FILL);
rotation_step = memnew( SpinBox );
rotation_step->set_min(-SPIN_BOX_ROTATION_RANGE); rotation_step->set_min(-SPIN_BOX_ROTATION_RANGE);
rotation_step->set_max(SPIN_BOX_ROTATION_RANGE); rotation_step->set_max(SPIN_BOX_ROTATION_RANGE);
rotation_step->set_suffix("deg"); rotation_step->set_suffix("deg");
@ -2278,7 +2290,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
} break; } break;
case SNAP_CONFIGURE: { case SNAP_CONFIGURE: {
((SnapDialog *)snap_dialog)->set_fields(snap_offset, snap_step, snap_rotation_offset, snap_rotation_step); ((SnapDialog *)snap_dialog)->set_fields(snap_offset, snap_step, snap_rotation_offset, snap_rotation_step);
snap_dialog->popup_centered(Size2(200,160)); snap_dialog->popup_centered(Size2(220,160));
} break; } break;
case ZOOM_IN: { case ZOOM_IN: {
zoom=zoom*(1.0/0.5); zoom=zoom*(1.0/0.5);
@ -3173,7 +3185,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p->add_item("Paste Pose",ANIM_PASTE_POSE); p->add_item("Paste Pose",ANIM_PASTE_POSE);
p->add_item("Clear Pose",ANIM_CLEAR_POSE,KEY_MASK_SHIFT|KEY_K); p->add_item("Clear Pose",ANIM_CLEAR_POSE,KEY_MASK_SHIFT|KEY_K);
snap_dialog = memnew(SnapDialog); snap_dialog = memnew( SnapDialog );
snap_dialog->connect("confirmed",this,"_snap_changed"); snap_dialog->connect("confirmed",this,"_snap_changed");
add_child(snap_dialog); add_child(snap_dialog);

View File

@ -160,7 +160,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
} break; } break;
case MENU_OPTION_CREATE_OUTLINE_MESH: { case MENU_OPTION_CREATE_OUTLINE_MESH: {
outline_dialog->popup_centered_minsize(); outline_dialog->popup_centered(Vector2(200, 90));
} break; } break;
} }
@ -212,7 +212,6 @@ MeshInstanceEditor::MeshInstanceEditor() {
options = memnew( MenuButton ); options = memnew( MenuButton );
//add_child(options);
SpatialEditor::get_singleton()->add_control_to_menu_panel(options); SpatialEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text("Mesh"); options->set_text("Mesh");
@ -231,14 +230,20 @@ MeshInstanceEditor::MeshInstanceEditor() {
options->get_popup()->connect("item_pressed", this,"_menu_option"); options->get_popup()->connect("item_pressed", this,"_menu_option");
outline_dialog = memnew( ConfirmationDialog ); outline_dialog = memnew( ConfirmationDialog );
outline_dialog->set_title("Outline Size: "); outline_dialog->set_title("Create Outline Mesh");
outline_dialog->get_ok()->set_text("Create");
VBoxContainer *outline_dialog_vbc = memnew( VBoxContainer );
outline_dialog->add_child(outline_dialog_vbc);
outline_dialog->set_child_rect(outline_dialog_vbc);
outline_size = memnew( SpinBox ); outline_size = memnew( SpinBox );
outline_size->set_min(0.001); outline_size->set_min(0.001);
outline_size->set_max(1024); outline_size->set_max(1024);
outline_size->set_step(0.001); outline_size->set_step(0.001);
outline_size->set_val(0.05); outline_size->set_val(0.05);
outline_dialog->add_child(outline_size); outline_dialog_vbc->add_margin_child("Outline Size:",outline_size);
outline_dialog->set_child_rect(outline_size);
add_child(outline_dialog); add_child(outline_dialog);
outline_dialog->connect("confirmed",this,"_create_outline_mesh"); outline_dialog->connect("confirmed",this,"_create_outline_mesh");

View File

@ -289,7 +289,7 @@ void MultiMeshEditor::_menu_option(int p_option) {
_last_pp_node=node; _last_pp_node=node;
} }
populate_dialog->popup_centered(Size2(250,395)); populate_dialog->popup_centered(Size2(250,380));
} break; } break;
} }
@ -325,9 +325,7 @@ MultiMeshEditor::MultiMeshEditor() {
options = memnew( MenuButton ); options = memnew( MenuButton );
//add_child(options);
SpatialEditor::get_singleton()->add_control_to_menu_panel(options); SpatialEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_area_as_parent_rect();
options->set_text("MultiMesh"); options->set_text("MultiMesh");
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MultiMeshInstance","EditorIcons")); options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MultiMeshInstance","EditorIcons"));
@ -373,12 +371,12 @@ MultiMeshEditor::MultiMeshEditor() {
populate_axis->select(2); populate_axis->select(2);
vbc->add_margin_child("Mesh Up Axis:",populate_axis); vbc->add_margin_child("Mesh Up Axis:",populate_axis);
populate_rotate_random = memnew( HScrollBar ); populate_rotate_random = memnew( HSlider );
populate_rotate_random->set_max(1); populate_rotate_random->set_max(1);
populate_rotate_random->set_step(0.01); populate_rotate_random->set_step(0.01);
vbc->add_margin_child("Random Rotation:",populate_rotate_random); vbc->add_margin_child("Random Rotation:",populate_rotate_random);
populate_tilt_random = memnew( HScrollBar ); populate_tilt_random = memnew( HSlider );
populate_tilt_random->set_max(1); populate_tilt_random->set_max(1);
populate_tilt_random->set_step(0.01); populate_tilt_random->set_step(0.01);
vbc->add_margin_child("Random Tilt:",populate_tilt_random); vbc->add_margin_child("Random Tilt:",populate_tilt_random);
@ -416,8 +414,7 @@ MultiMeshEditor::MultiMeshEditor() {
std->connect("selected",this,"_browsed"); std->connect("selected",this,"_browsed");
_last_pp_node=NULL; _last_pp_node=NULL;
//options->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
//options->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
err_dialog = memnew( AcceptDialog ); err_dialog = memnew( AcceptDialog );
add_child(err_dialog); add_child(err_dialog);
} }
@ -451,13 +448,6 @@ MultiMeshEditorPlugin::MultiMeshEditorPlugin(EditorNode *p_node) {
multimesh_editor = memnew( MultiMeshEditor ); multimesh_editor = memnew( MultiMeshEditor );
editor->get_viewport()->add_child(multimesh_editor); editor->get_viewport()->add_child(multimesh_editor);
// multimesh_editor->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
// multimesh_editor->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
multimesh_editor->set_margin(MARGIN_LEFT,253);
multimesh_editor->set_margin(MARGIN_RIGHT,310);
multimesh_editor->set_margin(MARGIN_TOP,0);
multimesh_editor->set_margin(MARGIN_BOTTOM,10);
multimesh_editor->options->hide(); multimesh_editor->options->hide();
} }

View File

@ -42,10 +42,10 @@ class MultiMeshEditor : public Control {
OBJ_TYPE(MultiMeshEditor, Control ); OBJ_TYPE(MultiMeshEditor, Control );
friend class MultiMeshEditorPlugin; friend class MultiMeshEditorPlugin;
AcceptDialog *err_dialog; AcceptDialog *err_dialog;
MenuButton * options; MenuButton * options;
MultiMeshInstance *_last_pp_node; MultiMeshInstance *_last_pp_node;
bool browsing_source; bool browsing_source;
@ -59,8 +59,8 @@ class MultiMeshEditor : public Control {
ConfirmationDialog *populate_dialog; ConfirmationDialog *populate_dialog;
OptionButton *populate_axis; OptionButton *populate_axis;
HScrollBar *populate_rotate_random; HSlider *populate_rotate_random;
HScrollBar *populate_tilt_random; HSlider *populate_tilt_random;
SpinBox *populate_scale_random; SpinBox *populate_scale_random;
SpinBox *populate_scale; SpinBox *populate_scale;
SpinBox *populate_amount; SpinBox *populate_amount;

View File

@ -2725,7 +2725,7 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
} break; } break;
case MENU_TRANSFORM_CONFIGURE_SNAP: { case MENU_TRANSFORM_CONFIGURE_SNAP: {
snap_dialog->popup_centered(Size2(200,160)); snap_dialog->popup_centered(Size2(200,180));
} break; } break;
case MENU_TRANSFORM_LOCAL_COORDS: { case MENU_TRANSFORM_LOCAL_COORDS: {
@ -3793,46 +3793,24 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
snap_dialog = memnew( ConfirmationDialog ); snap_dialog = memnew( ConfirmationDialog );
snap_dialog->set_title("Snap Settings"); snap_dialog->set_title("Snap Settings");
add_child(snap_dialog); add_child(snap_dialog);
Label *l = memnew(Label);
l->set_text("Translate Snap:"); VBoxContainer *snap_dialog_vbc = memnew( VBoxContainer );
l->set_pos(Point2(5,5)); snap_dialog->add_child(snap_dialog_vbc);
snap_dialog->add_child(l); snap_dialog->set_child_rect(snap_dialog_vbc);
snap_translate = memnew( LineEdit ); snap_translate = memnew( LineEdit );
snap_translate->set_anchor( MARGIN_RIGHT, ANCHOR_END );
snap_translate->set_begin( Point2(15,22) );
snap_translate->set_end( Point2(15,35) );
snap_translate->set_text("1"); snap_translate->set_text("1");
snap_dialog->add_child(snap_translate); snap_dialog_vbc->add_margin_child("Translate Snap:",snap_translate);
l = memnew(Label);
l->set_text("Rotate Snap (deg.):");
l->set_pos(Point2(5,45));
snap_dialog->add_child(l);
snap_rotate = memnew( LineEdit ); snap_rotate = memnew( LineEdit );
snap_rotate->set_anchor( MARGIN_RIGHT, ANCHOR_END );
snap_rotate->set_begin( Point2(15,62) );
snap_rotate->set_end( Point2(15,75) );
snap_rotate->set_text("5"); snap_rotate->set_text("5");
snap_dialog->add_child(snap_rotate); snap_dialog_vbc->add_margin_child("Rotate Snap (deg.):",snap_rotate);
l = memnew(Label);
l->set_text("Scale Snap (%):");
l->set_pos(Point2(5,85));
snap_dialog->add_child(l);
snap_scale = memnew( LineEdit ); snap_scale = memnew( LineEdit );
snap_scale->set_anchor( MARGIN_RIGHT, ANCHOR_END );
snap_scale->set_begin( Point2(15,102) );
snap_scale->set_end( Point2(15,115) );
snap_scale->set_text("5"); snap_scale->set_text("5");
snap_dialog->add_child(snap_scale); snap_dialog_vbc->add_margin_child("Scale Snap (%):",snap_scale);
//snap_dialog->get_cancel()->hide(); /* SETTINGS DIALOG */
/* SNAP DIALOG */
settings_dialog = memnew( ConfirmationDialog ); settings_dialog = memnew( ConfirmationDialog );
settings_dialog->set_title("Viewport Settings"); settings_dialog->set_title("Viewport Settings");
@ -3906,7 +3884,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
xform_dialog = memnew( ConfirmationDialog ); xform_dialog = memnew( ConfirmationDialog );
xform_dialog->set_title("Transform Change"); xform_dialog->set_title("Transform Change");
add_child(xform_dialog); add_child(xform_dialog);
l = memnew(Label); Label *l = memnew(Label);
l->set_text("Translate:"); l->set_text("Translate:");
l->set_pos(Point2(5,5)); l->set_pos(Point2(5,5));
xform_dialog->add_child(l); xform_dialog->add_child(l);