summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2020-10-20 17:41:10 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2020-10-22 08:41:35 +0300
commitd87e645bcfa9feaec1a7cae9b612543b09e53fb8 (patch)
tree201a9f0511a52fe42bc5d8ffd3dbf61f2fb2e4eb
parenta4548a079bc975411269abe2ba917ee825e90d23 (diff)
Fix custom property editor to correctly show Basis
-rw-r--r--editor/property_editor.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index cb56358ae6..7f1b5347cf 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -1697,13 +1697,18 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns, int
int cell_width = 95;
int cell_height = 25;
int cell_margin = 5;
- int hor_spacing = 5; // Spacing between labels and their values
-
int rows = ((p_amount - 1) / p_columns) + 1;
set_size(Size2(cell_margin + p_label_w + (cell_width + cell_margin + p_label_w) * p_columns, cell_margin + (cell_height + cell_margin) * rows) * EDSCALE);
for (int i = 0; i < MAX_VALUE_EDITORS; i++) {
+ value_label[i]->get_parent()->remove_child(value_label[i]);
+ value_editor[i]->get_parent()->remove_child(value_editor[i]);
+
+ int box_id = i / p_columns;
+ value_hboxes[box_id]->add_child(value_label[i]);
+ value_hboxes[box_id]->add_child(value_editor[i]);
+
if (i < MAX_VALUE_EDITORS / 4) {
if (i <= p_amount / 4) {
value_hboxes[i]->show();
@@ -1712,16 +1717,10 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns, int
}
}
- int c = i % p_columns;
- int r = i / p_columns;
-
if (i < p_amount) {
value_editor[i]->show();
value_label[i]->show();
value_label[i]->set_text(i < p_strings.size() ? p_strings[i] : String(""));
- value_editor[i]->set_position(Point2(cell_margin + p_label_w + hor_spacing + (cell_width + cell_margin + p_label_w + hor_spacing) * c, cell_margin + (cell_height + cell_margin) * r) * EDSCALE);
- value_editor[i]->set_size(Size2(cell_width, cell_height));
- value_label[i]->set_position(Point2(cell_margin + (cell_width + cell_margin + p_label_w + hor_spacing) * c, cell_margin + (cell_height + cell_margin) * r) * EDSCALE);
value_editor[i]->set_editable(!read_only);
} else {
value_editor[i]->hide();