summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2018-09-23 00:20:36 -0300
committerMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2018-09-23 16:00:48 -0300
commitb8f946f1186af016c4fb2faf676c628504188afb (patch)
tree2ece5ff23c830feb87f8f9ba01e7b10a82f0862f
parent399910ddd82e84f078ebefb3ed2c51d2ef989235 (diff)
Make Rect2 EditorProperty obey the horizontal setting
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/editor_properties.cpp34
2 files changed, 27 insertions, 9 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 03746fb8b7..fd67099d0d 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4839,7 +4839,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);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 3439133809..4b4b64ffdf 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1183,21 +1183,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) {
@@ -1245,7 +1263,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;
@@ -1326,7 +1344,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;
@@ -1407,7 +1425,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;