Browse Source

Range: Remove min/max check added in #33908

This wasn't a very good idea as it puts too strict requirements on how
to set `min` and `max` values. For example, since the default min and
max are 0 and 100, this triggers an error:

```
set_min(256)
set_max(16384)
```

Since `min` will be higher than `max` temporarily. It can be worked
around by setting max first, but it's not really intuitive. I'll relax
the requirement as it's only a problem in `get_as_ratio`, which already
has a check.

Fix another min == max occurrence.
Rémi Verschelde 6 years ago
parent
commit
966c68badd
2 changed files with 1 additions and 6 deletions
  1. 1 2
      editor/editor_profiler.cpp
  2. 0 4
      scene/gui/range.cpp

+ 1 - 2
editor/editor_profiler.cpp

@@ -88,14 +88,13 @@ void EditorProfiler::clear() {
 	frame_metrics.resize(metric_size);
 	frame_metrics.resize(metric_size);
 	last_metric = -1;
 	last_metric = -1;
 	variables->clear();
 	variables->clear();
-	//activate->set_pressed(false);
 	plot_sigs.clear();
 	plot_sigs.clear();
 	plot_sigs.insert("physics_frame_time");
 	plot_sigs.insert("physics_frame_time");
 	plot_sigs.insert("category_frame_time");
 	plot_sigs.insert("category_frame_time");
 
 
 	updating_frame = true;
 	updating_frame = true;
 	cursor_metric_edit->set_min(0);
 	cursor_metric_edit->set_min(0);
-	cursor_metric_edit->set_max(0);
+	cursor_metric_edit->set_max(100); // Doesn't make much sense, but we can't have min == max. Doesn't hurt.
 	cursor_metric_edit->set_value(0);
 	cursor_metric_edit->set_value(0);
 	updating_frame = false;
 	updating_frame = false;
 	hover_metric = -1;
 	hover_metric = -1;

+ 0 - 4
scene/gui/range.cpp

@@ -100,8 +100,6 @@ void Range::set_value(double p_val) {
 	shared->emit_value_changed();
 	shared->emit_value_changed();
 }
 }
 void Range::set_min(double p_min) {
 void Range::set_min(double p_min) {
-	ERR_FAIL_COND_MSG(p_min >= shared->max, "Range cannot have min value higher or equal to its max value.");
-
 	shared->min = p_min;
 	shared->min = p_min;
 	set_value(shared->val);
 	set_value(shared->val);
 
 
@@ -110,8 +108,6 @@ void Range::set_min(double p_min) {
 	update_configuration_warning();
 	update_configuration_warning();
 }
 }
 void Range::set_max(double p_max) {
 void Range::set_max(double p_max) {
-	ERR_FAIL_COND_MSG(p_max <= shared->min, "Range cannot have max value lower or equal to its min value.");
-
 	shared->max = p_max;
 	shared->max = p_max;
 	set_value(shared->val);
 	set_value(shared->val);