Skip to content

Commit

Permalink
Merge pull request godotengine#77779 from KoBeWi/emit_changed()
Browse files Browse the repository at this point in the history
Use `emit_changed()` consistently
  • Loading branch information
akien-mga committed Jun 10, 2023
2 parents 20bf10d + 5b85dab commit fe0ee24
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
7 changes: 3 additions & 4 deletions scene/resources/curve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

#include "curve.h"

#include "core/core_string_names.h"
#include "core/math/math_funcs.h"

const char *Curve::SIGNAL_RANGE_CHANGED = "range_changed";
Expand Down Expand Up @@ -388,7 +387,7 @@ real_t Curve::sample_local_nocheck(int p_index, real_t p_local_offset) const {

void Curve::mark_dirty() {
_baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

Array Curve::get_data() const {
Expand Down Expand Up @@ -775,7 +774,7 @@ Vector2 Curve2D::samplef(real_t p_findex) const {

void Curve2D::mark_dirty() {
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

void Curve2D::_bake_segment2d(RBMap<real_t, Vector2> &r_bake, real_t p_begin, real_t p_end, const Vector2 &p_a, const Vector2 &p_out, const Vector2 &p_b, const Vector2 &p_in, int p_depth, int p_max_depth, real_t p_tol) const {
Expand Down Expand Up @@ -1492,7 +1491,7 @@ Vector3 Curve3D::samplef(real_t p_findex) const {

void Curve3D::mark_dirty() {
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

void Curve3D::_bake_segment3d(RBMap<real_t, Vector3> &r_bake, real_t p_begin, real_t p_end, const Vector3 &p_a, const Vector3 &p_out, const Vector3 &p_b, const Vector3 &p_in, int p_depth, int p_max_depth, real_t p_tol) const {
Expand Down
22 changes: 10 additions & 12 deletions scene/resources/gradient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

#include "gradient.h"

#include "core/core_string_names.h"

Gradient::Gradient() {
//Set initial gradient transition from black to white
points.resize(2);
Expand Down Expand Up @@ -119,7 +117,7 @@ void Gradient::set_interpolation_mode(Gradient::InterpolationMode p_interp_mode)
}

interpolation_mode = p_interp_mode;
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
notify_property_list_changed();
}

Expand All @@ -133,7 +131,7 @@ void Gradient::set_interpolation_color_space(Gradient::ColorSpace p_color_space)
}

interpolation_color_space = p_color_space;
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

Gradient::ColorSpace Gradient::get_interpolation_color_space() {
Expand All @@ -146,7 +144,7 @@ void Gradient::set_offsets(const Vector<float> &p_offsets) {
points.write[i].offset = p_offsets[i];
}
is_sorted = false;
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

void Gradient::set_colors(const Vector<Color> &p_colors) {
Expand All @@ -157,7 +155,7 @@ void Gradient::set_colors(const Vector<Color> &p_colors) {
for (int i = 0; i < points.size(); i++) {
points.write[i].color = p_colors[i];
}
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

Vector<Gradient::Point> &Gradient::get_points() {
Expand All @@ -171,14 +169,14 @@ void Gradient::add_point(float p_offset, const Color &p_color) {
is_sorted = false;
points.push_back(p);

emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

void Gradient::remove_point(int p_index) {
ERR_FAIL_INDEX(p_index, points.size());
ERR_FAIL_COND(points.size() <= 1);
points.remove_at(p_index);
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

void Gradient::reverse() {
Expand All @@ -188,21 +186,21 @@ void Gradient::reverse() {

is_sorted = false;
_update_sorting();
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

void Gradient::set_points(const Vector<Gradient::Point> &p_points) {
points = p_points;
is_sorted = false;
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

void Gradient::set_offset(int pos, const float offset) {
ERR_FAIL_INDEX(pos, points.size());
_update_sorting();
points.write[pos].offset = offset;
is_sorted = false;
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

float Gradient::get_offset(int pos) {
Expand All @@ -215,7 +213,7 @@ void Gradient::set_color(int pos, const Color &color) {
ERR_FAIL_INDEX(pos, points.size());
_update_sorting();
points.write[pos].color = color;
emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

Color Gradient::get_color(int pos) {
Expand Down
3 changes: 1 addition & 2 deletions scene/resources/navigation_polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

#include "navigation_polygon.h"

#include "core/core_string_names.h"
#include "core/math/geometry_2d.h"
#include "core/os/mutex.h"

Expand Down Expand Up @@ -320,7 +319,7 @@ void NavigationPolygon::make_polygons_from_outlines() {
polygons.push_back(p);
}

emit_signal(CoreStringNames::get_singleton()->changed);
emit_changed();
}

void NavigationPolygon::_bind_methods() {
Expand Down

0 comments on commit fe0ee24

Please sign in to comment.