Merge pull request #22364 from YeldhamDev/rect2_inspector_singleline

Make Rect2 EditorProperty obey the horizontal setting
This commit is contained in:
Rémi Verschelde 2018-10-02 09:27:40 +02:00 committed by GitHub
commit 879e4d8312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 9 deletions

View File

@ -4849,7 +4849,7 @@ EditorNode::EditorNode() {
EDITOR_DEF_RST("interface/inspector/capitalize_properties", true);
EDITOR_DEF_RST("interface/inspector/disable_folding", false);
EDITOR_DEF("interface/inspector/horizontal_vector2_editing", false);
EDITOR_DEF("interface/inspector/horizontal_vector3_editing", true);
EDITOR_DEF("interface/inspector/horizontal_vector_types_editing", true);
EDITOR_DEF("interface/inspector/open_resources_in_current_inspector", true);
EDITOR_DEF("interface/inspector/resources_types_to_open_in_new_inspector", "SpatialMaterial,Script");
EDITOR_DEF("run/auto_save/save_before_running", true);

View File

@ -1185,21 +1185,39 @@ void EditorPropertyRect2::setup(double p_min, double p_max, double p_step, bool
}
EditorPropertyRect2::EditorPropertyRect2() {
VBoxContainer *vb = memnew(VBoxContainer);
add_child(vb);
bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
BoxContainer *bc;
if (horizontal) {
bc = memnew(HBoxContainer);
add_child(bc);
set_bottom_editor(bc);
} else {
bc = memnew(VBoxContainer);
add_child(bc);
}
static const char *desc[4] = { "x", "y", "w", "h" };
for (int i = 0; i < 4; i++) {
spin[i] = memnew(EditorSpinSlider);
spin[i]->set_label(desc[i]);
spin[i]->set_flat(true);
vb->add_child(spin[i]);
bc->add_child(spin[i]);
add_focusable(spin[i]);
spin[i]->connect("value_changed", this, "_value_changed");
if (horizontal) {
spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
}
}
if (!horizontal) {
set_label_reference(spin[0]); //show text and buttons around this
}
set_label_reference(spin[0]); //show text and buttons around this
setting = false;
}
///////////////////// VECTOR3 /////////////////////////
void EditorPropertyVector3::_value_changed(double val) {
@ -1247,7 +1265,7 @@ void EditorPropertyVector3::setup(double p_min, double p_max, double p_step, boo
}
EditorPropertyVector3::EditorPropertyVector3() {
bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector3_editing");
bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
BoxContainer *bc;
@ -1328,7 +1346,7 @@ void EditorPropertyPlane::setup(double p_min, double p_max, double p_step, bool
EditorPropertyPlane::EditorPropertyPlane() {
bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector3_editing");
bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
BoxContainer *bc;
@ -1409,7 +1427,7 @@ void EditorPropertyQuat::setup(double p_min, double p_max, double p_step, bool p
}
EditorPropertyQuat::EditorPropertyQuat() {
bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector3_editing");
bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
BoxContainer *bc;