SpatialEditor: fix transform dialog

This commit is contained in:
Poommetee Ketson 2017-07-31 20:00:02 +07:00
parent 3a3915b726
commit 6dde105be7
1 changed files with 26 additions and 22 deletions

View File

@ -3142,7 +3142,7 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
xform_scale[i]->set_text("1");
}
xform_dialog->popup_centered(Size2(200, 200));
xform_dialog->popup_centered(Size2(320, 240) * EDSCALE);
} break;
case MENU_VIEW_USE_1_VIEWPORT: {
@ -3964,55 +3964,59 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
xform_dialog = memnew(ConfirmationDialog);
xform_dialog->set_title(TTR("Transform Change"));
add_child(xform_dialog);
VBoxContainer *xform_vbc = memnew(VBoxContainer);
xform_dialog->add_child(xform_vbc);
Label *l = memnew(Label);
l->set_text(TTR("Translate:"));
l->set_position(Point2(5, 5));
xform_dialog->add_child(l);
xform_vbc->add_child(l);
HBoxContainer *xform_hbc = memnew(HBoxContainer);
xform_vbc->add_child(xform_hbc);
for (int i = 0; i < 3; i++) {
xform_translate[i] = memnew(LineEdit);
xform_translate[i]->set_position(Point2(15 + i * 60, 22));
xform_translate[i]->set_size(Size2(50, 12));
xform_dialog->add_child(xform_translate[i]);
xform_translate[i]->set_h_size_flags(SIZE_EXPAND_FILL);
xform_hbc->add_child(xform_translate[i]);
}
l = memnew(Label);
l->set_text(TTR("Rotate (deg.):"));
l->set_position(Point2(5, 45));
xform_dialog->add_child(l);
xform_vbc->add_child(l);
xform_hbc = memnew(HBoxContainer);
xform_vbc->add_child(xform_hbc);
for (int i = 0; i < 3; i++) {
xform_rotate[i] = memnew(LineEdit);
xform_rotate[i]->set_position(Point2(15 + i * 60, 62));
xform_rotate[i]->set_size(Size2(50, 22));
xform_dialog->add_child(xform_rotate[i]);
xform_rotate[i]->set_h_size_flags(SIZE_EXPAND_FILL);
xform_hbc->add_child(xform_rotate[i]);
}
l = memnew(Label);
l->set_text(TTR("Scale (ratio):"));
l->set_position(Point2(5, 85));
xform_dialog->add_child(l);
xform_vbc->add_child(l);
xform_hbc = memnew(HBoxContainer);
xform_vbc->add_child(xform_hbc);
for (int i = 0; i < 3; i++) {
xform_scale[i] = memnew(LineEdit);
xform_scale[i]->set_position(Point2(15 + i * 60, 102));
xform_scale[i]->set_size(Size2(50, 22));
xform_dialog->add_child(xform_scale[i]);
xform_scale[i]->set_h_size_flags(SIZE_EXPAND_FILL);
xform_hbc->add_child(xform_scale[i]);
}
l = memnew(Label);
l->set_text(TTR("Transform Type"));
l->set_position(Point2(5, 125));
xform_dialog->add_child(l);
xform_vbc->add_child(l);
xform_type = memnew(OptionButton);
xform_type->set_anchor(MARGIN_RIGHT, ANCHOR_END);
xform_type->set_begin(Point2(15, 142));
xform_type->set_end(Point2(15, 75));
xform_type->set_h_size_flags(SIZE_EXPAND_FILL);
xform_type->add_item(TTR("Pre"));
xform_type->add_item(TTR("Post"));
xform_dialog->add_child(xform_type);
xform_vbc->add_child(xform_type);
xform_dialog->connect("confirmed", this, "_xform_dialog_action");