mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-10 12:59:40 +01:00
Fix duplicate methods and binds in CurveEditor.
This commit is contained in:
parent
025713f94f
commit
034aed2b73
@ -6,7 +6,7 @@
|
||||
#include "core/object.h"
|
||||
#include "slope_point.h"
|
||||
|
||||
void MMCurveEditor::set_curve(const Variant &c) {
|
||||
void MMCurveEditor::set_curve(const Ref<CurveBase> &c) {
|
||||
curve = c;
|
||||
update();
|
||||
update_controls();
|
||||
@ -52,7 +52,7 @@ void MMCurveEditor::update_controls() {
|
||||
emit_signal("value_changed", curve);
|
||||
}
|
||||
|
||||
void MMCurveEditor::_on_ControlPoint_moved(const Variant &index) {
|
||||
void MMCurveEditor::_on_ControlPoint_moved(const int index) {
|
||||
Vector<CurveBase::Point> points = curve->get_points();
|
||||
ControlPoint *control_point = Object::cast_to<ControlPoint>(get_child(index));
|
||||
points.write[index].p = reverse_transform_point(control_point->get_position() + control_point->OFFSET);
|
||||
@ -78,14 +78,14 @@ void MMCurveEditor::_on_ControlPoint_moved(const Variant &index) {
|
||||
emit_signal("value_changed", curve);
|
||||
}
|
||||
|
||||
void MMCurveEditor::_on_ControlPoint_removed(const Variant &index) {
|
||||
void MMCurveEditor::_on_ControlPoint_removed(const int index) {
|
||||
if (curve->remove_point(index)) {
|
||||
update();
|
||||
update_controls();
|
||||
}
|
||||
}
|
||||
|
||||
void MMCurveEditor::_on_MMCurveEditor_gui_input(const Variant &event) {
|
||||
void MMCurveEditor::_on_MMCurveEditor_gui_input(const Ref<InputEvent> &event) {
|
||||
Ref<InputEventMouseButton> iemb = event;
|
||||
|
||||
if (iemb.is_valid()) {
|
||||
@ -122,11 +122,9 @@ void MMCurveEditor::_notification(int p_what) {
|
||||
void MMCurveEditor::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("value_changed", PropertyInfo(Variant::OBJECT, "value", PROPERTY_HINT_RESOURCE_TYPE, "CurveBase")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_curve", "c"), &MMCurveEditor::set_curve);
|
||||
ClassDB::bind_method(D_METHOD("update_controls"), &MMCurveEditor::update_controls);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_on_ControlPoint_moved", "index"), &MMCurveEditor::_on_ControlPoint_moved);
|
||||
ClassDB::bind_method(D_METHOD("_on_ControlPoint_removed", "index"), &MMCurveEditor::_on_ControlPoint_removed);
|
||||
ClassDB::bind_method(D_METHOD("_on_MMCurveEditor_gui_input", "event"), &MMCurveEditor::_on_MMCurveEditor_gui_input);
|
||||
ClassDB::bind_method(D_METHOD("_on_resize"), &MMCurveEditor::_on_resize);
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ class MMCurveEditor : public CurveView {
|
||||
GDCLASS(MMCurveEditor, CurveView);
|
||||
|
||||
public:
|
||||
void set_curve(const Variant &c);
|
||||
void set_curve(const Ref<CurveBase> &c);
|
||||
void update_controls();
|
||||
|
||||
void _on_ControlPoint_moved(const Variant &index);
|
||||
void _on_ControlPoint_removed(const Variant &index);
|
||||
void _on_MMCurveEditor_gui_input(const Variant &event);
|
||||
void _on_ControlPoint_moved(const int index);
|
||||
void _on_ControlPoint_removed(const int index);
|
||||
void _on_MMCurveEditor_gui_input(const Ref<InputEvent> &event);
|
||||
void _on_resize();
|
||||
|
||||
MMCurveEditor();
|
||||
|
@ -15,13 +15,13 @@ public:
|
||||
void set_show_axes(const bool val);
|
||||
|
||||
Ref<CurveBase> get_curve();
|
||||
void set_curve(const Ref<CurveBase> &val);
|
||||
virtual void set_curve(const Ref<CurveBase> &val);
|
||||
|
||||
Vector2 transform_point(const Vector2 &p);
|
||||
Vector2 reverse_transform_point(const Vector2 &p);
|
||||
|
||||
void _draw();
|
||||
void _on_resize();
|
||||
virtual void _on_resize();
|
||||
|
||||
CurveView();
|
||||
~CurveView();
|
||||
|
Loading…
Reference in New Issue
Block a user