summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-06-14 23:09:30 +0200
committerGitHub <noreply@github.com>2017-06-14 23:09:30 +0200
commit80de0c35df3aea7155c6e8026448896c3c749126 (patch)
treeec36576131315f3edbca3af66fcf5f5c7fb39074 /scene
parentbccee07ae714b43df135199594899ed88389d7b4 (diff)
parent23c5fa86877ba90be8e6d4c06adc3dca18a8a784 (diff)
Merge pull request #9160 from karroffel/color-ramp-rename
renamed occurances of ColorRamp with Gradient
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/line_2d.cpp2
-rw-r--r--scene/2d/particles_2d.cpp48
-rw-r--r--scene/2d/particles_2d.h6
-rw-r--r--scene/gui/gradient_edit.cpp (renamed from scene/gui/color_ramp_edit.cpp)36
-rw-r--r--scene/gui/gradient_edit.h (renamed from scene/gui/color_ramp_edit.h)8
5 files changed, 50 insertions, 50 deletions
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp
index 80969d11b3..1a57d24342 100644
--- a/scene/2d/line_2d.cpp
+++ b/scene/2d/line_2d.cpp
@@ -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");
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 27d0d07c0f..21d64c5d64 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -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");
diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h
index 5769fdd251..856beaa836 100644
--- a/scene/2d/particles_2d.h
+++ b/scene/2d/particles_2d.h
@@ -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;
diff --git a/scene/gui/color_ramp_edit.cpp b/scene/gui/gradient_edit.cpp
index 33e4ce0403..58bce57580 100644
--- a/scene/gui/color_ramp_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -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"));
}
diff --git a/scene/gui/color_ramp_edit.h b/scene/gui/gradient_edit.h
index 0fe447c43a..6c4ae6fd15 100644
--- a/scene/gui/color_ramp_edit.h
+++ b/scene/gui/gradient_edit.h
@@ -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