mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
@@ -44,7 +44,6 @@ String Range::get_configuration_warning() const {
|
||||
}
|
||||
|
||||
void Range::_value_changed_notify() {
|
||||
|
||||
_value_changed(shared->val);
|
||||
emit_signal("value_changed", shared->val);
|
||||
update();
|
||||
@@ -52,7 +51,6 @@ void Range::_value_changed_notify() {
|
||||
}
|
||||
|
||||
void Range::Shared::emit_value_changed() {
|
||||
|
||||
for (Set<Range *>::Element *E = owners.front(); E; E = E->next()) {
|
||||
Range *r = E->get();
|
||||
if (!r->is_inside_tree())
|
||||
@@ -62,14 +60,12 @@ void Range::Shared::emit_value_changed() {
|
||||
}
|
||||
|
||||
void Range::_changed_notify(const char *p_what) {
|
||||
|
||||
emit_signal("changed");
|
||||
update();
|
||||
_change_notify(p_what);
|
||||
}
|
||||
|
||||
void Range::Shared::emit_changed(const char *p_what) {
|
||||
|
||||
for (Set<Range *>::Element *E = owners.front(); E; E = E->next()) {
|
||||
Range *r = E->get();
|
||||
if (!r->is_inside_tree())
|
||||
@@ -79,7 +75,6 @@ void Range::Shared::emit_changed(const char *p_what) {
|
||||
}
|
||||
|
||||
void Range::set_value(double p_val) {
|
||||
|
||||
if (shared->step > 0)
|
||||
p_val = Math::round(p_val / shared->step) * shared->step;
|
||||
|
||||
@@ -114,12 +109,10 @@ void Range::set_max(double p_max) {
|
||||
shared->emit_changed("max");
|
||||
}
|
||||
void Range::set_step(double p_step) {
|
||||
|
||||
shared->step = p_step;
|
||||
shared->emit_changed("step");
|
||||
}
|
||||
void Range::set_page(double p_page) {
|
||||
|
||||
shared->page = p_page;
|
||||
set_value(shared->val);
|
||||
|
||||
@@ -127,37 +120,29 @@ void Range::set_page(double p_page) {
|
||||
}
|
||||
|
||||
double Range::get_value() const {
|
||||
|
||||
return shared->val;
|
||||
}
|
||||
double Range::get_min() const {
|
||||
|
||||
return shared->min;
|
||||
}
|
||||
double Range::get_max() const {
|
||||
|
||||
return shared->max;
|
||||
}
|
||||
double Range::get_step() const {
|
||||
|
||||
return shared->step;
|
||||
}
|
||||
double Range::get_page() const {
|
||||
|
||||
return shared->page;
|
||||
}
|
||||
|
||||
void Range::set_as_ratio(double p_value) {
|
||||
|
||||
double v;
|
||||
|
||||
if (shared->exp_ratio && get_min() >= 0) {
|
||||
|
||||
double exp_min = get_min() == 0 ? 0.0 : Math::log(get_min()) / Math::log((double)2);
|
||||
double exp_max = Math::log(get_max()) / Math::log((double)2);
|
||||
v = Math::pow(2, exp_min + (exp_max - exp_min) * p_value);
|
||||
} else {
|
||||
|
||||
double percent = (get_max() - get_min()) * p_value;
|
||||
if (get_step() > 0) {
|
||||
double steps = round(percent / get_step());
|
||||
@@ -176,7 +161,6 @@ double Range::get_as_ratio() const {
|
||||
}
|
||||
|
||||
if (shared->exp_ratio && get_min() >= 0) {
|
||||
|
||||
double exp_min = get_min() == 0 ? 0.0 : Math::log(get_min()) / Math::log((double)2);
|
||||
double exp_max = Math::log(get_max()) / Math::log((double)2);
|
||||
float value = CLAMP(get_value(), shared->min, shared->max);
|
||||
@@ -185,21 +169,18 @@ double Range::get_as_ratio() const {
|
||||
return CLAMP((v - exp_min) / (exp_max - exp_min), 0, 1);
|
||||
|
||||
} else {
|
||||
|
||||
float value = CLAMP(get_value(), shared->min, shared->max);
|
||||
return CLAMP((value - get_min()) / (get_max() - get_min()), 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void Range::_share(Node *p_range) {
|
||||
|
||||
Range *r = Object::cast_to<Range>(p_range);
|
||||
ERR_FAIL_COND(!r);
|
||||
share(r);
|
||||
}
|
||||
|
||||
void Range::share(Range *p_range) {
|
||||
|
||||
ERR_FAIL_NULL(p_range);
|
||||
|
||||
p_range->_ref_shared(shared);
|
||||
@@ -208,7 +189,6 @@ void Range::share(Range *p_range) {
|
||||
}
|
||||
|
||||
void Range::unshare() {
|
||||
|
||||
Shared *nshared = memnew(Shared);
|
||||
nshared->min = shared->min;
|
||||
nshared->max = shared->max;
|
||||
@@ -223,7 +203,6 @@ void Range::unshare() {
|
||||
}
|
||||
|
||||
void Range::_ref_shared(Shared *p_shared) {
|
||||
|
||||
if (shared && p_shared == shared)
|
||||
return;
|
||||
|
||||
@@ -233,7 +212,6 @@ void Range::_ref_shared(Shared *p_shared) {
|
||||
}
|
||||
|
||||
void Range::_unref_shared() {
|
||||
|
||||
if (shared) {
|
||||
shared->owners.erase(this);
|
||||
if (shared->owners.size() == 0) {
|
||||
@@ -244,7 +222,6 @@ void Range::_unref_shared() {
|
||||
}
|
||||
|
||||
void Range::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_value"), &Range::get_value);
|
||||
ClassDB::bind_method(D_METHOD("get_min"), &Range::get_min);
|
||||
ClassDB::bind_method(D_METHOD("get_max"), &Range::get_max);
|
||||
@@ -285,49 +262,40 @@ void Range::_bind_methods() {
|
||||
}
|
||||
|
||||
void Range::set_use_rounded_values(bool p_enable) {
|
||||
|
||||
_rounded_values = p_enable;
|
||||
}
|
||||
|
||||
bool Range::is_using_rounded_values() const {
|
||||
|
||||
return _rounded_values;
|
||||
}
|
||||
|
||||
void Range::set_exp_ratio(bool p_enable) {
|
||||
|
||||
shared->exp_ratio = p_enable;
|
||||
|
||||
update_configuration_warning();
|
||||
}
|
||||
|
||||
bool Range::is_ratio_exp() const {
|
||||
|
||||
return shared->exp_ratio;
|
||||
}
|
||||
|
||||
void Range::set_allow_greater(bool p_allow) {
|
||||
|
||||
shared->allow_greater = p_allow;
|
||||
}
|
||||
|
||||
bool Range::is_greater_allowed() const {
|
||||
|
||||
return shared->allow_greater;
|
||||
}
|
||||
|
||||
void Range::set_allow_lesser(bool p_allow) {
|
||||
|
||||
shared->allow_lesser = p_allow;
|
||||
}
|
||||
|
||||
bool Range::is_lesser_allowed() const {
|
||||
|
||||
return shared->allow_lesser;
|
||||
}
|
||||
|
||||
Range::Range() {
|
||||
|
||||
shared = memnew(Shared);
|
||||
shared->min = 0;
|
||||
shared->max = 100;
|
||||
@@ -343,6 +311,5 @@ Range::Range() {
|
||||
}
|
||||
|
||||
Range::~Range() {
|
||||
|
||||
_unref_shared();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user