diff --git a/modules/material_maker/editor/widgets/gradient_editor/gradient_cursor.cpp b/modules/material_maker/editor/widgets/gradient_editor/gradient_cursor.cpp index 3f86d6260..04c5f96dc 100644 --- a/modules/material_maker/editor/widgets/gradient_editor/gradient_cursor.cpp +++ b/modules/material_maker/editor/widgets/gradient_editor/gradient_cursor.cpp @@ -8,6 +8,11 @@ Color GradientCursor::get_cursor_color() { } void GradientCursor::set_cursor_color(const Color &val) { + color = val; + update(); +} + +void GradientCursor::set_cursor_color_notify(const Color &val) { color = val; MMGradientEditor *ged = Object::cast_to(get_parent()); ERR_FAIL_COND(!ged); @@ -104,7 +109,7 @@ bool GradientCursor::can_drop_data_fw(const Point2 &p_point, const Variant &p_da } void GradientCursor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { - set_cursor_color(p_data); + set_cursor_color_notify(p_data); } GradientCursor::GradientCursor() { @@ -132,6 +137,8 @@ void GradientCursor::_bind_methods() { ClassDB::bind_method(D_METHOD("set_cursor_color", "value"), &GradientCursor::set_cursor_color); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "cursor_color"), "set_cursor_color", "get_cursor_color"); + ClassDB::bind_method(D_METHOD("set_cursor_color_notify", "value"), &GradientCursor::set_cursor_color_notify); + ClassDB::bind_method(D_METHOD("get_sliding"), &GradientCursor::get_sliding); ClassDB::bind_method(D_METHOD("set_sliding", "value"), &GradientCursor::set_sliding); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sliding"), "set_sliding", "get_sliding"); diff --git a/modules/material_maker/editor/widgets/gradient_editor/gradient_cursor.h b/modules/material_maker/editor/widgets/gradient_editor/gradient_cursor.h index 8629ce858..895864821 100644 --- a/modules/material_maker/editor/widgets/gradient_editor/gradient_cursor.h +++ b/modules/material_maker/editor/widgets/gradient_editor/gradient_cursor.h @@ -17,6 +17,8 @@ public: Color get_cursor_color(); void set_cursor_color(const Color &val); + void set_cursor_color_notify(const Color &val); + bool get_sliding() const; void set_sliding(const bool val); diff --git a/modules/material_maker/editor/widgets/gradient_editor/gradient_editor.cpp b/modules/material_maker/editor/widgets/gradient_editor/gradient_editor.cpp index 0683d954a..f372fb590 100644 --- a/modules/material_maker/editor/widgets/gradient_editor/gradient_editor.cpp +++ b/modules/material_maker/editor/widgets/gradient_editor/gradient_editor.cpp @@ -191,7 +191,7 @@ void MMGradientEditor::select_color(GradientCursor *cursor, const Vector2 &posit ColorPicker *color_picker = color_picker_popup->color_picker; color_picker->set_pick_color(cursor->get_cursor_color()); - color_picker->connect("color_changed", cursor, "set_cursor_color"); + color_picker->connect("color_changed", cursor, "set_cursor_color_notify"); color_picker_popup->set_position(position); color_picker_popup->connect("popup_hide", this, "undo_redo_save_color_state");