From f491b43edde841fa0c264d617284ac5f155badd8 Mon Sep 17 00:00:00 2001 From: jmb462 Date: Mon, 20 Dec 2021 15:34:29 +0100 Subject: [PATCH] Fix wrong ColorPicker shape with GradientEdit --- editor/plugins/gradient_editor_plugin.cpp | 3 +++ scene/gui/gradient_edit.cpp | 4 ++++ scene/gui/gradient_edit.h | 1 + 3 files changed, 8 insertions(+) diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp index da050abc023..6f2d9501903 100644 --- a/editor/plugins/gradient_editor_plugin.cpp +++ b/editor/plugins/gradient_editor_plugin.cpp @@ -118,6 +118,9 @@ void EditorInspectorPluginGradient::parse_begin(Object *p_object) { editor->set_gradient(g); add_custom_control(editor); + int picker_shape = EDITOR_GET("interface/inspector/default_color_picker_shape"); + editor->get_picker()->set_picker_shape((ColorPicker::PickerShapeType)picker_shape); + reverse_btn = memnew(GradientReverseButton); gradient_tools_hbox = memnew(HBoxContainer); diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp index 1210be15ceb..b887499ad46 100644 --- a/scene/gui/gradient_edit.cpp +++ b/scene/gui/gradient_edit.cpp @@ -432,6 +432,10 @@ Gradient::InterpolationMode GradientEdit::get_interpolation_mode() { return interpolation_mode; } +ColorPicker *GradientEdit::get_picker() { + return picker; +} + void GradientEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("ramp_changed")); } diff --git a/scene/gui/gradient_edit.h b/scene/gui/gradient_edit.h index 66b60d87c7d..1e2059c4e31 100644 --- a/scene/gui/gradient_edit.h +++ b/scene/gui/gradient_edit.h @@ -75,6 +75,7 @@ public: Vector &get_points(); void set_interpolation_mode(Gradient::InterpolationMode p_interp_mode); Gradient::InterpolationMode get_interpolation_mode(); + ColorPicker *get_picker(); virtual Size2 get_minimum_size() const override;