Merge pull request #9160 from karroffel/color-ramp-rename
renamed occurances of ColorRamp with Gradient
This commit is contained in:
commit
80de0c35df
8 changed files with 85 additions and 85 deletions
|
@ -73,10 +73,10 @@
|
|||
#include "plugins/collision_polygon_2d_editor_plugin.h"
|
||||
#include "plugins/collision_polygon_editor_plugin.h"
|
||||
#include "plugins/collision_shape_2d_editor_plugin.h"
|
||||
#include "plugins/color_ramp_editor_plugin.h"
|
||||
#include "plugins/cube_grid_theme_editor_plugin.h"
|
||||
#include "plugins/curve_editor_plugin.h"
|
||||
#include "plugins/gi_probe_editor_plugin.h"
|
||||
#include "plugins/gradient_editor_plugin.h"
|
||||
#include "plugins/gradient_texture_editor_plugin.h"
|
||||
#include "plugins/item_list_editor_plugin.h"
|
||||
#include "plugins/light_occluder_2d_editor_plugin.h"
|
||||
|
@ -6042,7 +6042,7 @@ EditorNode::EditorNode() {
|
|||
add_editor_plugin(memnew(Polygon2DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(LightOccluder2DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(NavigationPolygonEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(ColorRampEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(GradientEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(GradientTextureEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(CollisionShape2DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(CurveTextureEditorPlugin(this)));
|
||||
|
|
|
@ -27,15 +27,15 @@
|
|||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "color_ramp_editor_plugin.h"
|
||||
#include "gradient_editor_plugin.h"
|
||||
|
||||
#include "canvas_item_editor_plugin.h"
|
||||
#include "spatial_editor_plugin.h"
|
||||
|
||||
ColorRampEditorPlugin::ColorRampEditorPlugin(EditorNode *p_node) {
|
||||
GradientEditorPlugin::GradientEditorPlugin(EditorNode *p_node) {
|
||||
|
||||
editor = p_node;
|
||||
ramp_editor = memnew(ColorRampEdit);
|
||||
ramp_editor = memnew(GradientEdit);
|
||||
|
||||
add_control_to_container(CONTAINER_PROPERTY_EDITOR_BOTTOM, ramp_editor);
|
||||
|
||||
|
@ -44,21 +44,21 @@ ColorRampEditorPlugin::ColorRampEditorPlugin(EditorNode *p_node) {
|
|||
ramp_editor->connect("ramp_changed", this, "ramp_changed");
|
||||
}
|
||||
|
||||
void ColorRampEditorPlugin::edit(Object *p_object) {
|
||||
void GradientEditorPlugin::edit(Object *p_object) {
|
||||
|
||||
Gradient *color_ramp = p_object->cast_to<Gradient>();
|
||||
if (!color_ramp)
|
||||
Gradient *gradient = p_object->cast_to<Gradient>();
|
||||
if (!gradient)
|
||||
return;
|
||||
color_ramp_ref = Ref<Gradient>(color_ramp);
|
||||
ramp_editor->set_points(color_ramp_ref->get_points());
|
||||
gradient_ref = Ref<Gradient>(gradient);
|
||||
ramp_editor->set_points(gradient_ref->get_points());
|
||||
}
|
||||
|
||||
bool ColorRampEditorPlugin::handles(Object *p_object) const {
|
||||
bool GradientEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
return p_object->is_class("ColorRamp");
|
||||
return p_object->is_class("Gradient");
|
||||
}
|
||||
|
||||
void ColorRampEditorPlugin::make_visible(bool p_visible) {
|
||||
void GradientEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
if (p_visible) {
|
||||
ramp_editor->show();
|
||||
|
@ -67,43 +67,43 @@ void ColorRampEditorPlugin::make_visible(bool p_visible) {
|
|||
}
|
||||
}
|
||||
|
||||
void ColorRampEditorPlugin::_ramp_changed() {
|
||||
void GradientEditorPlugin::_ramp_changed() {
|
||||
|
||||
if (color_ramp_ref.is_valid()) {
|
||||
if (gradient_ref.is_valid()) {
|
||||
|
||||
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
||||
|
||||
//Not sure if I should convert this data to PoolVector
|
||||
Vector<float> new_offsets = ramp_editor->get_offsets();
|
||||
Vector<Color> new_colors = ramp_editor->get_colors();
|
||||
Vector<float> old_offsets = color_ramp_ref->get_offsets();
|
||||
Vector<Color> old_colors = color_ramp_ref->get_colors();
|
||||
Vector<float> old_offsets = gradient_ref->get_offsets();
|
||||
Vector<Color> old_colors = gradient_ref->get_colors();
|
||||
|
||||
if (old_offsets.size() != new_offsets.size())
|
||||
ur->create_action(TTR("Add/Remove Color Ramp Point"));
|
||||
else
|
||||
ur->create_action(TTR("Modify Color Ramp"), UndoRedo::MERGE_ENDS);
|
||||
ur->add_do_method(this, "undo_redo_color_ramp", new_offsets, new_colors);
|
||||
ur->add_undo_method(this, "undo_redo_color_ramp", old_offsets, old_colors);
|
||||
ur->add_do_method(this, "undo_redo_gradient", new_offsets, new_colors);
|
||||
ur->add_undo_method(this, "undo_redo_gradient", old_offsets, old_colors);
|
||||
ur->commit_action();
|
||||
|
||||
//color_ramp_ref->set_points(ramp_editor->get_points());
|
||||
}
|
||||
}
|
||||
|
||||
void ColorRampEditorPlugin::_undo_redo_color_ramp(const Vector<float> &offsets,
|
||||
void GradientEditorPlugin::_undo_redo_gradient(const Vector<float> &offsets,
|
||||
const Vector<Color> &colors) {
|
||||
|
||||
color_ramp_ref->set_offsets(offsets);
|
||||
color_ramp_ref->set_colors(colors);
|
||||
ramp_editor->set_points(color_ramp_ref->get_points());
|
||||
gradient_ref->set_offsets(offsets);
|
||||
gradient_ref->set_colors(colors);
|
||||
ramp_editor->set_points(gradient_ref->get_points());
|
||||
ramp_editor->update();
|
||||
}
|
||||
|
||||
ColorRampEditorPlugin::~ColorRampEditorPlugin() {
|
||||
GradientEditorPlugin::~GradientEditorPlugin() {
|
||||
}
|
||||
|
||||
void ColorRampEditorPlugin::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("ramp_changed"), &ColorRampEditorPlugin::_ramp_changed);
|
||||
ClassDB::bind_method(D_METHOD("undo_redo_color_ramp", "offsets", "colors"), &ColorRampEditorPlugin::_undo_redo_color_ramp);
|
||||
void GradientEditorPlugin::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("ramp_changed"), &GradientEditorPlugin::_ramp_changed);
|
||||
ClassDB::bind_method(D_METHOD("undo_redo_gradient", "offsets", "colors"), &GradientEditorPlugin::_undo_redo_gradient);
|
||||
}
|
|
@ -32,21 +32,21 @@
|
|||
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_plugin.h"
|
||||
#include "scene/gui/color_ramp_edit.h"
|
||||
#include "scene/gui/gradient_edit.h"
|
||||
|
||||
class ColorRampEditorPlugin : public EditorPlugin {
|
||||
class GradientEditorPlugin : public EditorPlugin {
|
||||
|
||||
GDCLASS(ColorRampEditorPlugin, EditorPlugin);
|
||||
GDCLASS(GradientEditorPlugin, EditorPlugin);
|
||||
|
||||
bool _2d;
|
||||
Ref<Gradient> color_ramp_ref;
|
||||
ColorRampEdit *ramp_editor;
|
||||
Ref<Gradient> gradient_ref;
|
||||
GradientEdit *ramp_editor;
|
||||
EditorNode *editor;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
void _ramp_changed();
|
||||
void _undo_redo_color_ramp(const Vector<float> &offsets, const Vector<Color> &colors);
|
||||
void _undo_redo_gradient(const Vector<float> &offsets, const Vector<Color> &colors);
|
||||
|
||||
public:
|
||||
virtual String get_name() const { return "ColorRamp"; }
|
||||
|
@ -55,8 +55,8 @@ public:
|
|||
virtual bool handles(Object *p_node) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
|
||||
ColorRampEditorPlugin(EditorNode *p_node);
|
||||
~ColorRampEditorPlugin();
|
||||
GradientEditorPlugin(EditorNode *p_node);
|
||||
~GradientEditorPlugin();
|
||||
};
|
||||
|
||||
#endif /* TOOLS_EDITOR_PLUGINS_COLOR_RAMP_EDITOR_PLUGIN_H_ */
|
|
@ -310,7 +310,7 @@ void Line2D::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "points"), "set_points", "get_points");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "width"), "set_width", "get_width");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "default_color"), "set_default_color", "get_default_color");
|
||||
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "gradient", PROPERTY_HINT_RESOURCE_TYPE, "ColorRamp"), "set_gradient", "get_gradient");
|
||||
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "gradient", PROPERTY_HINT_RESOURCE_TYPE, "Gradient"), "set_gradient", "get_gradient");
|
||||
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture");
|
||||
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "texture_mode", PROPERTY_HINT_ENUM, "None,Tile"), "set_texture_mode", "get_texture_mode");
|
||||
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "joint_mode", PROPERTY_HINT_ENUM, "Sharp,Bevel,Round"), "set_joint_mode", "get_joint_mode");
|
||||
|
|
|
@ -505,8 +505,8 @@ void Particles2D::_notification(int p_what) {
|
|||
|
||||
Color color;
|
||||
|
||||
if (color_ramp.is_valid()) {
|
||||
color = color_ramp->get_color_at_offset(ptime);
|
||||
if (gradient.is_valid()) {
|
||||
color = gradient->get_color_at_offset(ptime);
|
||||
} else {
|
||||
color = default_color;
|
||||
}
|
||||
|
@ -774,14 +774,14 @@ Color Particles2D::get_color() const {
|
|||
return default_color;
|
||||
}
|
||||
|
||||
void Particles2D::set_color_ramp(const Ref<Gradient> &p_color_ramp) {
|
||||
void Particles2D::set_gradient(const Ref<Gradient> &p_gradient) {
|
||||
|
||||
color_ramp = p_color_ramp;
|
||||
gradient = p_gradient;
|
||||
}
|
||||
|
||||
Ref<Gradient> Particles2D::get_color_ramp() const {
|
||||
Ref<Gradient> Particles2D::get_gradient() const {
|
||||
|
||||
return color_ramp;
|
||||
return gradient;
|
||||
}
|
||||
|
||||
void Particles2D::set_emissor_offset(const Point2 &p_offset) {
|
||||
|
@ -809,19 +809,19 @@ void Particles2D::set_color_phases(int p_phases) {
|
|||
|
||||
//Create color ramp if we have 2 or more phases.
|
||||
//Otherwise first phase phase will be assigned to default color.
|
||||
if (p_phases > 1 && color_ramp.is_null()) {
|
||||
color_ramp = Ref<Gradient>(memnew(Gradient()));
|
||||
if (p_phases > 1 && gradient.is_null()) {
|
||||
gradient = Ref<Gradient>(memnew(Gradient()));
|
||||
}
|
||||
if (color_ramp.is_valid()) {
|
||||
color_ramp->get_points().resize(p_phases);
|
||||
if (gradient.is_valid()) {
|
||||
gradient->get_points().resize(p_phases);
|
||||
}
|
||||
}
|
||||
|
||||
//Deprecated.
|
||||
int Particles2D::get_color_phases() const {
|
||||
|
||||
if (color_ramp.is_valid()) {
|
||||
return color_ramp->get_points_count();
|
||||
if (gradient.is_valid()) {
|
||||
return gradient->get_points_count();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -830,9 +830,9 @@ int Particles2D::get_color_phases() const {
|
|||
void Particles2D::set_color_phase_color(int p_phase, const Color &p_color) {
|
||||
|
||||
ERR_FAIL_INDEX(p_phase, MAX_COLOR_PHASES);
|
||||
if (color_ramp.is_valid()) {
|
||||
if (color_ramp->get_points_count() > p_phase)
|
||||
color_ramp->set_color(p_phase, p_color);
|
||||
if (gradient.is_valid()) {
|
||||
if (gradient->get_points_count() > p_phase)
|
||||
gradient->set_color(p_phase, p_color);
|
||||
} else {
|
||||
if (p_phase == 0)
|
||||
default_color = p_color;
|
||||
|
@ -843,8 +843,8 @@ void Particles2D::set_color_phase_color(int p_phase, const Color &p_color) {
|
|||
Color Particles2D::get_color_phase_color(int p_phase) const {
|
||||
|
||||
ERR_FAIL_INDEX_V(p_phase, MAX_COLOR_PHASES, Color());
|
||||
if (color_ramp.is_valid()) {
|
||||
return color_ramp->get_color(p_phase);
|
||||
if (gradient.is_valid()) {
|
||||
return gradient->get_color(p_phase);
|
||||
}
|
||||
return Color(0, 0, 0, 1);
|
||||
}
|
||||
|
@ -853,8 +853,8 @@ Color Particles2D::get_color_phase_color(int p_phase) const {
|
|||
void Particles2D::set_color_phase_pos(int p_phase, float p_pos) {
|
||||
ERR_FAIL_INDEX(p_phase, MAX_COLOR_PHASES);
|
||||
ERR_FAIL_COND(p_pos < 0.0 || p_pos > 1.0);
|
||||
if (color_ramp.is_valid() && color_ramp->get_points_count() > p_phase) {
|
||||
return color_ramp->set_offset(p_phase, p_pos);
|
||||
if (gradient.is_valid() && gradient->get_points_count() > p_phase) {
|
||||
return gradient->set_offset(p_phase, p_pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -862,8 +862,8 @@ void Particles2D::set_color_phase_pos(int p_phase, float p_pos) {
|
|||
float Particles2D::get_color_phase_pos(int p_phase) const {
|
||||
|
||||
ERR_FAIL_INDEX_V(p_phase, MAX_COLOR_PHASES, 0);
|
||||
if (color_ramp.is_valid()) {
|
||||
return color_ramp->get_offset(p_phase);
|
||||
if (gradient.is_valid()) {
|
||||
return gradient->get_offset(p_phase);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -996,8 +996,8 @@ void Particles2D::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_color", "color"), &Particles2D::set_color);
|
||||
ClassDB::bind_method(D_METHOD("get_color"), &Particles2D::get_color);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_color_ramp:ColorRamp", "color_ramp"), &Particles2D::set_color_ramp);
|
||||
ClassDB::bind_method(D_METHOD("get_color_ramp:ColorRamp"), &Particles2D::get_color_ramp);
|
||||
ClassDB::bind_method(D_METHOD("set_gradient:Gradient", "gradient"), &Particles2D::set_gradient);
|
||||
ClassDB::bind_method(D_METHOD("get_gradient:Gradient"), &Particles2D::get_gradient);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_emissor_offset", "offset"), &Particles2D::set_emissor_offset);
|
||||
ClassDB::bind_method(D_METHOD("get_emissor_offset"), &Particles2D::get_emissor_offset);
|
||||
|
@ -1078,7 +1078,7 @@ void Particles2D::_bind_methods() {
|
|||
}
|
||||
|
||||
ADD_PROPERTYNO(PropertyInfo(Variant::COLOR, "color/color"), "set_color", "get_color");
|
||||
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "color/color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "ColorRamp"), "set_color_ramp", "get_color_ramp");
|
||||
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "color/color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "Gradient"), "set_gradient", "get_gradient");
|
||||
|
||||
ADD_PROPERTYNZ(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "emission_points", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_emission_points", "get_emission_points");
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ private:
|
|||
|
||||
//If no color ramp is set then default color is used. Created as simple alternative to color_ramp.
|
||||
Color default_color;
|
||||
Ref<Gradient> color_ramp;
|
||||
Ref<Gradient> gradient;
|
||||
|
||||
void _process_particles(float p_delta);
|
||||
friend class ParticleAttractor2D;
|
||||
|
@ -241,8 +241,8 @@ public:
|
|||
void set_color(const Color &p_color);
|
||||
Color get_color() const;
|
||||
|
||||
void set_color_ramp(const Ref<Gradient> &p_texture);
|
||||
Ref<Gradient> get_color_ramp() const;
|
||||
void set_gradient(const Ref<Gradient> &p_texture);
|
||||
Ref<Gradient> get_gradient() const;
|
||||
|
||||
void set_emissor_offset(const Point2 &p_offset);
|
||||
Point2 get_emissor_offset() const;
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "color_ramp_edit.h"
|
||||
#include "gradient_edit.h"
|
||||
#include "os/keyboard.h"
|
||||
|
||||
ColorRampEdit::ColorRampEdit() {
|
||||
GradientEdit::GradientEdit() {
|
||||
grabbed = -1;
|
||||
grabbing = false;
|
||||
set_focus_mode(FOCUS_ALL);
|
||||
|
@ -46,7 +46,7 @@ ColorRampEdit::ColorRampEdit() {
|
|||
checker->create_from_image(img, ImageTexture::FLAG_REPEAT);
|
||||
}
|
||||
|
||||
int ColorRampEdit::_get_point_from_pos(int x) {
|
||||
int GradientEdit::_get_point_from_pos(int x) {
|
||||
int result = -1;
|
||||
int total_w = get_size().width - get_size().height - 3;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
|
@ -58,7 +58,7 @@ int ColorRampEdit::_get_point_from_pos(int x) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void ColorRampEdit::_show_color_picker() {
|
||||
void GradientEdit::_show_color_picker() {
|
||||
if (grabbed == -1)
|
||||
return;
|
||||
Size2 ms = Size2(350, picker->get_combined_minimum_size().height + 10);
|
||||
|
@ -68,10 +68,10 @@ void ColorRampEdit::_show_color_picker() {
|
|||
popup->popup();
|
||||
}
|
||||
|
||||
ColorRampEdit::~ColorRampEdit() {
|
||||
GradientEdit::~GradientEdit() {
|
||||
}
|
||||
|
||||
void ColorRampEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||
void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||
|
||||
Ref<InputEventKey> k = p_event;
|
||||
|
||||
|
@ -272,7 +272,7 @@ void ColorRampEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
}
|
||||
|
||||
void ColorRampEdit::_notification(int p_what) {
|
||||
void GradientEdit::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
if (!picker->is_connected("color_changed", this, "_color_changed")) {
|
||||
|
@ -370,7 +370,7 @@ void ColorRampEdit::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
|
||||
void ColorRampEdit::_draw_checker(int x, int y, int w, int h) {
|
||||
void GradientEdit::_draw_checker(int x, int y, int w, int h) {
|
||||
//Draw it with polygon to insert UVs for scale
|
||||
Vector<Vector2> backPoints;
|
||||
backPoints.push_back(Vector2(x, y));
|
||||
|
@ -391,12 +391,12 @@ void ColorRampEdit::_draw_checker(int x, int y, int w, int h) {
|
|||
draw_polygon(backPoints, colorPoints, uvPoints, checker);
|
||||
}
|
||||
|
||||
Size2 ColorRampEdit::get_minimum_size() const {
|
||||
Size2 GradientEdit::get_minimum_size() const {
|
||||
|
||||
return Vector2(0, 16);
|
||||
}
|
||||
|
||||
void ColorRampEdit::_color_changed(const Color &p_color) {
|
||||
void GradientEdit::_color_changed(const Color &p_color) {
|
||||
|
||||
if (grabbed == -1)
|
||||
return;
|
||||
|
@ -405,7 +405,7 @@ void ColorRampEdit::_color_changed(const Color &p_color) {
|
|||
emit_signal("ramp_changed");
|
||||
}
|
||||
|
||||
void ColorRampEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color> &p_colors) {
|
||||
void GradientEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color> &p_colors) {
|
||||
|
||||
ERR_FAIL_COND(p_offsets.size() != p_colors.size());
|
||||
points.clear();
|
||||
|
@ -420,33 +420,33 @@ void ColorRampEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color>
|
|||
update();
|
||||
}
|
||||
|
||||
Vector<float> ColorRampEdit::get_offsets() const {
|
||||
Vector<float> GradientEdit::get_offsets() const {
|
||||
Vector<float> ret;
|
||||
for (int i = 0; i < points.size(); i++)
|
||||
ret.push_back(points[i].offset);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Vector<Color> ColorRampEdit::get_colors() const {
|
||||
Vector<Color> GradientEdit::get_colors() const {
|
||||
Vector<Color> ret;
|
||||
for (int i = 0; i < points.size(); i++)
|
||||
ret.push_back(points[i].color);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ColorRampEdit::set_points(Vector<Gradient::Point> &p_points) {
|
||||
void GradientEdit::set_points(Vector<Gradient::Point> &p_points) {
|
||||
if (points.size() != p_points.size())
|
||||
grabbed = -1;
|
||||
points.clear();
|
||||
points = p_points;
|
||||
}
|
||||
|
||||
Vector<Gradient::Point> &ColorRampEdit::get_points() {
|
||||
Vector<Gradient::Point> &GradientEdit::get_points() {
|
||||
return points;
|
||||
}
|
||||
|
||||
void ColorRampEdit::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_gui_input"), &ColorRampEdit::_gui_input);
|
||||
ClassDB::bind_method(D_METHOD("_color_changed"), &ColorRampEdit::_color_changed);
|
||||
void GradientEdit::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_gui_input"), &GradientEdit::_gui_input);
|
||||
ClassDB::bind_method(D_METHOD("_color_changed"), &GradientEdit::_color_changed);
|
||||
ADD_SIGNAL(MethodInfo("ramp_changed"));
|
||||
}
|
|
@ -37,9 +37,9 @@
|
|||
|
||||
#define POINT_WIDTH 8
|
||||
|
||||
class ColorRampEdit : public Control {
|
||||
class GradientEdit : public Control {
|
||||
|
||||
GDCLASS(ColorRampEdit, Control);
|
||||
GDCLASS(GradientEdit, Control);
|
||||
|
||||
PopupPanel *popup;
|
||||
ColorPicker *picker;
|
||||
|
@ -68,8 +68,8 @@ public:
|
|||
Vector<Gradient::Point> &get_points();
|
||||
virtual Size2 get_minimum_size() const;
|
||||
|
||||
ColorRampEdit();
|
||||
virtual ~ColorRampEdit();
|
||||
GradientEdit();
|
||||
virtual ~GradientEdit();
|
||||
};
|
||||
|
||||
/*class ColorRampEditPanel : public Panel
|
Loading…
Reference in a new issue