mirror of
https://github.com/godotengine/godot.git
synced 2025-04-01 00:41:35 +08:00
fix changed signal emission in Curve::set_point_offset
This commit is contained in:
parent
b5bdb88062
commit
cd71f97209
@ -56,7 +56,7 @@ void Curve::set_point_count(int p_count) {
|
||||
notify_property_list_changed();
|
||||
}
|
||||
|
||||
int Curve::_add_point(Vector2 p_position, real_t p_left_tangent, real_t p_right_tangent, TangentMode p_left_mode, TangentMode p_right_mode) {
|
||||
int Curve::_add_point(Vector2 p_position, real_t p_left_tangent, real_t p_right_tangent, TangentMode p_left_mode, TangentMode p_right_mode, bool p_mark_dirty) {
|
||||
// Add a point and preserve order.
|
||||
|
||||
// Points must remain within the given value and domain ranges.
|
||||
@ -99,7 +99,9 @@ int Curve::_add_point(Vector2 p_position, real_t p_left_tangent, real_t p_right_
|
||||
|
||||
update_auto_tangents(ret);
|
||||
|
||||
mark_dirty();
|
||||
if (p_mark_dirty) {
|
||||
mark_dirty();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -221,10 +223,12 @@ Curve::TangentMode Curve::get_point_right_mode(int p_index) const {
|
||||
return _points[p_index].right_mode;
|
||||
}
|
||||
|
||||
void Curve::_remove_point(int p_index) {
|
||||
void Curve::_remove_point(int p_index, bool p_mark_dirty) {
|
||||
ERR_FAIL_UNSIGNED_INDEX((uint32_t)p_index, _points.size());
|
||||
_points.remove_at(p_index);
|
||||
mark_dirty();
|
||||
if (p_mark_dirty) {
|
||||
mark_dirty();
|
||||
}
|
||||
}
|
||||
|
||||
void Curve::remove_point(int p_index) {
|
||||
@ -252,16 +256,13 @@ void Curve::set_point_value(int p_index, real_t p_position) {
|
||||
int Curve::set_point_offset(int p_index, real_t p_offset) {
|
||||
ERR_FAIL_UNSIGNED_INDEX_V((uint32_t)p_index, _points.size(), -1);
|
||||
Point p = _points[p_index];
|
||||
_remove_point(p_index);
|
||||
int i = _add_point(Vector2(p_offset, p.position.y));
|
||||
_points[i].left_tangent = p.left_tangent;
|
||||
_points[i].right_tangent = p.right_tangent;
|
||||
_points[i].left_mode = p.left_mode;
|
||||
_points[i].right_mode = p.right_mode;
|
||||
_remove_point(p_index, false);
|
||||
int i = _add_point(Vector2(p_offset, p.position.y), p.left_tangent, p.right_tangent, p.left_mode, p.right_mode, false);
|
||||
if (p_index != i) {
|
||||
update_auto_tangents(p_index);
|
||||
}
|
||||
update_auto_tangents(i);
|
||||
mark_dirty();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -76,15 +76,15 @@ public:
|
||||
void set_point_count(int p_count);
|
||||
|
||||
int add_point(Vector2 p_position,
|
||||
real_t left_tangent = 0,
|
||||
real_t right_tangent = 0,
|
||||
TangentMode left_mode = TANGENT_FREE,
|
||||
TangentMode right_mode = TANGENT_FREE);
|
||||
real_t p_left_tangent = 0,
|
||||
real_t p_right_tangent = 0,
|
||||
TangentMode p_left_mode = TANGENT_FREE,
|
||||
TangentMode p_right_mode = TANGENT_FREE);
|
||||
int add_point_no_update(Vector2 p_position,
|
||||
real_t left_tangent = 0,
|
||||
real_t right_tangent = 0,
|
||||
TangentMode left_mode = TANGENT_FREE,
|
||||
TangentMode right_mode = TANGENT_FREE);
|
||||
real_t p_left_tangent = 0,
|
||||
real_t p_right_tangent = 0,
|
||||
TangentMode p_left_mode = TANGENT_FREE,
|
||||
TangentMode p_right_mode = TANGENT_FREE);
|
||||
void remove_point(int p_index);
|
||||
void clear_points();
|
||||
|
||||
@ -126,10 +126,10 @@ public:
|
||||
TangentMode get_point_left_mode(int p_index) const;
|
||||
TangentMode get_point_right_mode(int p_index) const;
|
||||
|
||||
void update_auto_tangents(int i);
|
||||
void update_auto_tangents(int p_index);
|
||||
|
||||
Array get_data() const;
|
||||
void set_data(Array input);
|
||||
void set_data(Array p_input);
|
||||
|
||||
void bake();
|
||||
void _bake() const;
|
||||
@ -149,11 +149,12 @@ protected:
|
||||
private:
|
||||
void mark_dirty();
|
||||
int _add_point(Vector2 p_position,
|
||||
real_t left_tangent = 0,
|
||||
real_t right_tangent = 0,
|
||||
TangentMode left_mode = TANGENT_FREE,
|
||||
TangentMode right_mode = TANGENT_FREE);
|
||||
void _remove_point(int p_index);
|
||||
real_t p_left_tangent = 0,
|
||||
real_t p_right_tangent = 0,
|
||||
TangentMode p_left_mode = TANGENT_FREE,
|
||||
TangentMode p_right_mode = TANGENT_FREE,
|
||||
bool p_mark_dirty = true);
|
||||
void _remove_point(int p_index, bool p_mark_dirty = true);
|
||||
|
||||
LocalVector<Point> _points;
|
||||
mutable bool _baked_cache_dirty = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user