summaryrefslogtreecommitdiff
path: root/tools/editor/animation_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/animation_editor.cpp')
-rw-r--r--tools/editor/animation_editor.cpp402
1 files changed, 242 insertions, 160 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index a556031e5e..f256e351ae 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "animation_editor.h"
+
#include "editor_settings.h"
#include "os/keyboard.h"
#include "os/os.h"
@@ -48,7 +49,7 @@
class AnimationCurveEdit : public Control {
- OBJ_TYPE( AnimationCurveEdit, Control );
+ GDCLASS( AnimationCurveEdit, Control );
public:
enum Mode {
MODE_DISABLED,
@@ -157,7 +158,7 @@ private:
}
}
- void _input_event(const InputEvent& p_ev) {
+ void _gui_input(const InputEvent& p_ev) {
if (p_ev.type==InputEvent::MOUSE_MOTION && p_ev.mouse_motion.button_mask&BUTTON_MASK_LEFT) {
if (mode==MODE_DISABLED)
@@ -178,12 +179,12 @@ private:
bool sg = val < 0;
val = Math::absf(val);
- val = Math::log(val)/Math::log(2);
+ val = Math::log(val)/Math::log((float)2.0);
//logspace
val+=rel*0.05;
//
- val = Math::pow(2,val);
+ val = Math::pow((float)2.0,val);
if (sg)
val=-val;
@@ -198,8 +199,8 @@ public:
static void _bind_methods() {
- // ObjectTypeDB::bind_method("_update_obj",&AnimationKeyEdit::_update_obj);
- ObjectTypeDB::bind_method("_input_event",&AnimationCurveEdit::_input_event);
+ //ClassDB::bind_method("_update_obj",&AnimationKeyEdit::_update_obj);
+ ClassDB::bind_method("_gui_input",&AnimationCurveEdit::_gui_input);
ADD_SIGNAL(MethodInfo("transition_changed"));
}
@@ -243,15 +244,15 @@ public:
class AnimationKeyEdit : public Object {
- OBJ_TYPE(AnimationKeyEdit,Object);
+ GDCLASS(AnimationKeyEdit,Object);
public:
bool setting;
bool hidden;
static void _bind_methods() {
- ObjectTypeDB::bind_method("_update_obj",&AnimationKeyEdit::_update_obj);
- ObjectTypeDB::bind_method("_key_ofs_changed",&AnimationKeyEdit::_key_ofs_changed);
+ ClassDB::bind_method("_update_obj",&AnimationKeyEdit::_update_obj);
+ ClassDB::bind_method("_key_ofs_changed",&AnimationKeyEdit::_key_ofs_changed);
}
//PopupDialog *ke_dialog;
@@ -518,7 +519,7 @@ public:
case Animation::TYPE_VALUE: {
if (name=="value") {
- r_ret = animation->track_get_key_value(track,key);;
+ r_ret = animation->track_get_key_value(track,key);
return true;
}
@@ -612,7 +613,7 @@ public:
if (res.is_valid()) {
hint=PROPERTY_HINT_RESOURCE_TYPE;
- hint_string=res->get_type();
+ hint_string=res->get_class();
}
}
@@ -647,8 +648,10 @@ public:
} break;
}
- //if (animation->track_get_type(track)!=Animation::TYPE_METHOD)
- // p_list->push_back( PropertyInfo( Variant::REAL, "easing", PROPERTY_HINT_EXP_EASING));
+ /*
+ if (animation->track_get_type(track)!=Animation::TYPE_METHOD)
+ p_list->push_back( PropertyInfo( Variant::REAL, "easing", PROPERTY_HINT_EXP_EASING));
+ */
}
UndoRedo *undo_redo;
@@ -1040,7 +1043,7 @@ void AnimationKeyEditor::_animation_optimize() {
- animation->optimize(optimize_linear_error->get_val(),optimize_angular_error->get_val(),optimize_max_angle->get_val());
+ animation->optimize(optimize_linear_error->get_value(),optimize_angular_error->get_value(),optimize_max_angle->get_value());
track_editor->update();
undo_redo->clear_history();
@@ -1049,12 +1052,12 @@ void AnimationKeyEditor::_animation_optimize() {
float AnimationKeyEditor::_get_zoom_scale() const {
- float zv = zoom->get_val();
+ float zv = zoom->get_value();
if (zv<1) {
zv = 1.0-zv;
- return Math::pow(1.0+zv,8.0)*100;
+ return Math::pow(1.0f+zv,8.0f)*100;
} else {
- return 1.0/Math::pow(zv,8.0)*100;
+ return 1.0/Math::pow(zv,8.0f)*100;
}
}
@@ -1072,7 +1075,7 @@ void AnimationKeyEditor::_track_pos_draw() {
int settings_limit = size.width - right_data_size_cache;
int name_limit = settings_limit * name_column_ratio;
- float keys_from= h_scroll->get_val();
+ float keys_from= h_scroll->get_value();
float zoom_scale = _get_zoom_scale();
float keys_to=keys_from+(settings_limit-name_limit) / zoom_scale;
@@ -1081,7 +1084,7 @@ void AnimationKeyEditor::_track_pos_draw() {
//will move to separate control! (for speedup)
if (timeline_pos >= keys_from && timeline_pos<keys_to) {
//draw position
- int pixel = (timeline_pos - h_scroll->get_val()) * zoom_scale;
+ int pixel = (timeline_pos - h_scroll->get_value()) * zoom_scale;
pixel+=name_limit;
track_pos->draw_line(ofs+Point2(pixel,0),ofs+Point2(pixel,size.height),Color(1,0.3,0.3,0.8));
@@ -1090,7 +1093,6 @@ void AnimationKeyEditor::_track_pos_draw() {
void AnimationKeyEditor::_track_editor_draw() {
- VisualServer::get_singleton()->canvas_item_set_clip(track_editor->get_canvas_item(),true);
if (animation.is_valid() && animation->get_track_count()) {
if (selected_track < 0)
@@ -1157,6 +1159,12 @@ void AnimationKeyEditor::_track_editor_draw() {
Ref<Texture> add_key_icon = get_icon("TrackAddKey","EditorIcons");
Ref<Texture> add_key_icon_hl = get_icon("TrackAddKeyHl","EditorIcons");
Ref<Texture> down_icon = get_icon("select_arrow","Tree");
+
+ Ref<Texture> wrap_icon[2]={
+ get_icon("InterpWrapClamp","EditorIcons"),
+ get_icon("InterpWrapLoop","EditorIcons"),
+ };
+
Ref<Texture> interp_icon[3]={
get_icon("InterpRaw","EditorIcons"),
get_icon("InterpLinear","EditorIcons"),
@@ -1181,7 +1189,7 @@ void AnimationKeyEditor::_track_editor_draw() {
Ref<Texture> type_hover=get_icon("KeyHover","EditorIcons");
Ref<Texture> type_selected=get_icon("KeySelected","EditorIcons");
- int right_separator_ofs = down_icon->get_width() *2 + add_key_icon->get_width() + interp_icon[0]->get_width() + cont_icon[0]->get_width() + hsep*7;
+ int right_separator_ofs = down_icon->get_width() *3 + add_key_icon->get_width() + interp_icon[0]->get_width() + wrap_icon[0]->get_width() + cont_icon[0]->get_width() + hsep*9;
int h = font->get_height()+sep;
@@ -1227,8 +1235,8 @@ void AnimationKeyEditor::_track_editor_draw() {
if (l<=0)
l=0.001; //avoid crashor
- int end_px = (l - h_scroll->get_val()) * scale;
- int begin_px = -h_scroll->get_val() * scale;
+ int end_px = (l - h_scroll->get_value()) * scale;
+ int begin_px = -h_scroll->get_value() * scale;
Color notimecol;
notimecol.r=timecolor.gray();
notimecol.g=notimecol.r;
@@ -1254,7 +1262,7 @@ void AnimationKeyEditor::_track_editor_draw() {
- keys_from= h_scroll->get_val();
+ keys_from= h_scroll->get_value();
keys_to=keys_from+zoomw / scale;
{
@@ -1331,8 +1339,8 @@ void AnimationKeyEditor::_track_editor_draw() {
for(int i=0;i<zoomw;i++) {
- float pos = h_scroll->get_val() + double(i)/scale;
- float prev = h_scroll->get_val() + (double(i)-1.0)/scale;
+ float pos = h_scroll->get_value() + double(i)/scale;
+ float prev = h_scroll->get_value() + (double(i)-1.0)/scale;
int sc = int(Math::floor(pos*SC_ADJ));
@@ -1356,7 +1364,7 @@ void AnimationKeyEditor::_track_editor_draw() {
//this code sucks, i always forget how it works
- int idx = v_scroll->get_val() + i;
+ int idx = v_scroll->get_value() + i;
if (idx>=animation->get_track_count())
break;
int y = h+i*h+sep;
@@ -1421,6 +1429,20 @@ void AnimationKeyEditor::_track_editor_draw() {
icon_ofs.x-=hsep;
*/
+ track_ofs[0]=size.width-icon_ofs.x;
+ icon_ofs.x-=down_icon->get_width();
+ te->draw_texture(down_icon,icon_ofs);
+
+ int wrap_type = animation->track_get_interpolation_loop_wrap(idx)?1:0;
+ icon_ofs.x-=hsep;
+ icon_ofs.x-=wrap_icon[wrap_type]->get_width();
+ te->draw_texture(wrap_icon[wrap_type],icon_ofs);
+
+ icon_ofs.x-=hsep;
+ te->draw_line(Point2(icon_ofs.x,ofs.y+y),Point2(icon_ofs.x,ofs.y+y+h),sepcolor);
+
+ track_ofs[1]=size.width-icon_ofs.x;
+
icon_ofs.x-=down_icon->get_width();
te->draw_texture(down_icon,icon_ofs);
@@ -1433,6 +1455,8 @@ void AnimationKeyEditor::_track_editor_draw() {
icon_ofs.x-=hsep;
te->draw_line(Point2(icon_ofs.x,ofs.y+y),Point2(icon_ofs.x,ofs.y+y+h),sepcolor);
+ track_ofs[2]=size.width-icon_ofs.x;
+
if (animation->track_get_type(idx)==Animation::TYPE_VALUE) {
@@ -1453,14 +1477,18 @@ void AnimationKeyEditor::_track_editor_draw() {
icon_ofs.x-=hsep;
te->draw_line(Point2(icon_ofs.x,ofs.y+y),Point2(icon_ofs.x,ofs.y+y+h),sepcolor);
+ track_ofs[3]=size.width-icon_ofs.x;
+
icon_ofs.x-=hsep;
icon_ofs.x-=add_key_icon->get_width();
te->draw_texture((mouse_over.over==MouseOver::OVER_ADD_KEY && mouse_over.track==idx)?add_key_icon_hl:add_key_icon,icon_ofs);
+ track_ofs[4]=size.width-icon_ofs.x;
+
//draw the keys;
int tt = animation->track_get_type(idx);
- float key_vofs = Math::floor((h - type_icon[tt]->get_height())/2);
- float key_hofs = -Math::floor(type_icon[tt]->get_height()/2);
+ float key_vofs = Math::floor((float)(h - type_icon[tt]->get_height())/2);
+ float key_hofs = -Math::floor((float)type_icon[tt]->get_height()/2);
int kc=animation->track_get_key_count(idx);
bool first=true;
@@ -1552,20 +1580,20 @@ void AnimationKeyEditor::_track_editor_draw() {
}
float motion = from_t+(click.to.x - click.at.x)/zoom_scale;
- if (step->get_val())
- motion = Math::stepify(motion,step->get_val());
+ if (step->get_value())
+ motion = Math::stepify(motion,step->get_value());
for(Map<SelectedKey,KeyInfo>::Element *E=selection.front();E;E=E->next()) {
int idx = E->key().track;
- int i = idx-v_scroll->get_val();
+ int i = idx-v_scroll->get_value();
if (i<0 || i>=fit)
continue;
int y = h+i*h+sep;
- float key_vofs = Math::floor((h - type_selected->get_height())/2);
- float key_hofs = -Math::floor(type_selected->get_height()/2);
+ float key_vofs = Math::floor((float)(h - type_selected->get_height())/2);
+ float key_hofs = -Math::floor((float)type_selected->get_height()/2);
float time = animation->track_get_key_time(idx,E->key().key);
float diff = time-from_t;
@@ -1621,6 +1649,14 @@ void AnimationKeyEditor::_track_menu_selected(int p_idx) {
undo_redo->add_do_method(animation.ptr(),"value_track_set_update_mode",cont_editing,p_idx);
undo_redo->add_undo_method(animation.ptr(),"value_track_set_update_mode",cont_editing,animation->value_track_get_update_mode(cont_editing));
undo_redo->commit_action();
+ } else if (wrap_editing!=-1) {
+
+ ERR_FAIL_INDEX(wrap_editing,animation->get_track_count());
+
+ undo_redo->create_action(TTR("Anim Track Change Wrap Mode"));
+ undo_redo->add_do_method(animation.ptr(),"track_set_interpolation_loop_wrap",wrap_editing,p_idx?true:false);
+ undo_redo->add_undo_method(animation.ptr(),"track_set_interpolation_loop_wrap",wrap_editing,animation->track_get_interpolation_loop_wrap(wrap_editing));
+ undo_redo->commit_action();
} else {
switch (p_idx) {
@@ -1811,7 +1847,7 @@ void AnimationKeyEditor::_anim_delete_keys() {
}
}
-void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
+void AnimationKeyEditor::_track_editor_gui_input(const InputEvent& p_input) {
Control *te=track_editor;
Ref<StyleBox> style = get_stylebox("normal","TextEdit");
@@ -1833,6 +1869,10 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
Ref<Texture> hsize_icon = get_icon("Hsize","EditorIcons");
Ref<Texture> add_key_icon = get_icon("TrackAddKey","EditorIcons");
+ Ref<Texture> wrap_icon[2]={
+ get_icon("InterpWrapClamp","EditorIcons"),
+ get_icon("InterpWrapLoop","EditorIcons"),
+ };
Ref<Texture> interp_icon[3]={
get_icon("InterpRaw","EditorIcons"),
get_icon("InterpLinear","EditorIcons"),
@@ -1848,7 +1888,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
get_icon("KeyXform","EditorIcons"),
get_icon("KeyCall","EditorIcons")
};
- int right_separator_ofs = down_icon->get_width() *2 + add_key_icon->get_width() + interp_icon[0]->get_width() + cont_icon[0]->get_width() + hsep*7;
+ int right_separator_ofs = down_icon->get_width() *3 + add_key_icon->get_width() + interp_icon[0]->get_width() + wrap_icon[0]->get_width() + cont_icon[0]->get_width() + hsep*9;
int h = font->get_height()+sep;
@@ -1877,7 +1917,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
else
_menu_track(TRACK_MENU_DUPLICATE);
- accept_event();;
+ accept_event();
} else if (p_input.key.scancode==KEY_DELETE && p_input.key.pressed && click.click==ClickOver::CLICK_NONE) {
@@ -1888,16 +1928,16 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
if (p_input.is_action("ui_up"))
selected_track--;
- if (v_scroll->is_visible() && p_input.is_action("ui_page_up"))
+ if (v_scroll->is_visible_in_tree() && p_input.is_action("ui_page_up"))
selected_track--;
if (selected_track<0)
selected_track=0;
- if (v_scroll->is_visible()) {
- if (v_scroll->get_val() > selected_track)
- v_scroll->set_val(selected_track);
+ if (v_scroll->is_visible_in_tree()) {
+ if (v_scroll->get_value() > selected_track)
+ v_scroll->set_value(selected_track);
}
@@ -1910,14 +1950,14 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
if (p_input.is_action("ui_down"))
selected_track++;
- else if (v_scroll->is_visible() && p_input.is_action("ui_page_down"))
+ else if (v_scroll->is_visible_in_tree() && p_input.is_action("ui_page_down"))
selected_track+=v_scroll->get_page();
if (selected_track >= animation->get_track_count())
selected_track=animation->get_track_count()-1;
- if (v_scroll->is_visible() && v_scroll->get_page()+v_scroll->get_val() < selected_track+1) {
- v_scroll->set_val(selected_track-v_scroll->get_page()+1);
+ if (v_scroll->is_visible_in_tree() && v_scroll->get_page()+v_scroll->get_value() < selected_track+1) {
+ v_scroll->set_value(selected_track-v_scroll->get_page()+1);
}
track_editor->update();
@@ -1934,18 +1974,18 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
if (mb.button_index==BUTTON_WHEEL_UP && mb.pressed) {
if (mb.mod.command) {
- zoom->set_val(zoom->get_val() + zoom->get_step());
+ zoom->set_value(zoom->get_value() + zoom->get_step());
} else {
- v_scroll->set_val( v_scroll->get_val() - v_scroll->get_page() / 8 );
+ v_scroll->set_value( v_scroll->get_value() - v_scroll->get_page() / 8 );
}
}
if (mb.button_index==BUTTON_WHEEL_DOWN && mb.pressed) {
if (mb.mod.command) {
- zoom->set_val(zoom->get_val() - zoom->get_step());
+ zoom->set_value(zoom->get_value() - zoom->get_step());
} else {
- v_scroll->set_val( v_scroll->get_val() + v_scroll->get_page() / 8 );
+ v_scroll->set_value( v_scroll->get_value() + v_scroll->get_page() / 8 );
}
}
@@ -1966,7 +2006,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
mpos.y -= h;
int idx = mpos.y / h;
- idx+=v_scroll->get_val();
+ idx+=v_scroll->get_value();
if (idx <0 || idx>=animation->get_track_count())
break;
@@ -1974,7 +2014,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
} else if (mpos.x < settings_limit) {
float pos = mpos.x - name_limit;
pos/=_get_zoom_scale();
- pos+=h_scroll->get_val();
+ pos+=h_scroll->get_value();
float w_time = (type_icon[0]->get_width() / _get_zoom_scale())/2.0;
int kidx = animation->track_find_key(idx,pos);
@@ -2054,6 +2094,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
interp_editing=-1;
cont_editing=-1;
+ wrap_editing=-1;
track_menu->popup();
}
@@ -2083,7 +2124,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
//seek
//int zoomw = settings_limit-name_limit;
float scale = _get_zoom_scale();
- float pos = h_scroll->get_val() + (mpos.x-name_limit) / scale;
+ float pos = h_scroll->get_value() + (mpos.x-name_limit) / scale;
if (animation->get_step())
pos=Math::stepify(pos,animation->get_step());
@@ -2105,7 +2146,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
mpos.y -= h;
int idx = mpos.y / h;
- idx+=v_scroll->get_val();
+ idx+=v_scroll->get_value();
if (idx <0)
break;
@@ -2146,7 +2187,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
float pos = mpos.x - name_limit;
pos/=_get_zoom_scale();
- pos+=h_scroll->get_val();
+ pos+=h_scroll->get_value();
float w_time = (type_icon[0]->get_width() / _get_zoom_scale())/2.0;
int kidx = animation->track_find_key(idx,pos);
@@ -2277,7 +2318,33 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
ofsx-=hsep*3+move_up_icon->get_width();
*/
- if (ofsx < down_icon->get_width() + interp_icon[0]->get_width() + hsep*2) {
+
+ if (ofsx < track_ofs[1]) {
+
+ track_menu->clear();
+ track_menu->set_size(Point2(1,1));
+ static const char *interp_name[2]={"Clamp Loop Interp","Wrap Loop Interp"};
+ for(int i=0;i<2;i++) {
+ track_menu->add_icon_item(wrap_icon[i],interp_name[i]);
+ }
+
+ int popup_y = ofs.y+((int(mpos.y)/h)+2)*h;
+ int popup_x = size.width-track_ofs[1];
+
+ track_menu->set_pos(te->get_global_pos()+Point2(popup_x,popup_y));
+
+
+ wrap_editing=idx;
+ interp_editing=-1;
+ cont_editing=-1;
+
+ track_menu->popup();
+
+ return;
+ }
+
+
+ if (ofsx < track_ofs[2]) {
track_menu->clear();
track_menu->set_size(Point2(1,1));
@@ -2286,24 +2353,22 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
track_menu->add_icon_item(interp_icon[i],interp_name[i]);
}
- int lofs = remove_icon->get_width() + move_up_icon->get_width() + move_down_icon->get_width() + down_icon->get_width() *2 + hsep*7;//interp_icon[0]->get_width() + cont_icon[0]->get_width() ;
int popup_y = ofs.y+((int(mpos.y)/h)+2)*h;
- int popup_x = ofs.x+size.width-lofs;
+ int popup_x = size.width-track_ofs[2];
track_menu->set_pos(te->get_global_pos()+Point2(popup_x,popup_y));
interp_editing=idx;
cont_editing=-1;
+ wrap_editing=-1;
track_menu->popup();
return;
}
- ofsx-=hsep*2+interp_icon[0]->get_width()+down_icon->get_width();
-
- if (ofsx < down_icon->get_width() + cont_icon[0]->get_width()) {
+ if (ofsx < track_ofs[3]) {
track_menu->clear();
track_menu->set_size(Point2(1,1));
@@ -2312,13 +2377,14 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
track_menu->add_icon_item(cont_icon[i],cont_name[i]);
}
- int lofs = settings_limit;
+
int popup_y = ofs.y+((int(mpos.y)/h)+2)*h;
- int popup_x = ofs.x+lofs;
+ int popup_x = size.width-track_ofs[3];
track_menu->set_pos(te->get_global_pos()+Point2(popup_x,popup_y));
interp_editing=-1;
+ wrap_editing=-1;
cont_editing=idx;
track_menu->popup();
@@ -2326,9 +2392,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
return;
}
- ofsx-=hsep*3+cont_icon[0]->get_width()+down_icon->get_width();
-
- if (ofsx < add_key_icon->get_width()) {
+ if (ofsx < track_ofs[4]) {
Animation::TrackType tt = animation->track_get_type(idx);
@@ -2403,7 +2467,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
float zoom_scale=_get_zoom_scale();
- float keys_from = h_scroll->get_val();
+ float keys_from = h_scroll->get_value();
float keys_to = keys_from + (settings_limit-name_limit) / zoom_scale;
float from_time = keys_from + ( click.at.x - (name_limit+ofs.x)) / zoom_scale;
@@ -2423,8 +2487,8 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
to_time = keys_to;
- int from_track = int(click.at.y-ofs.y-h-sep) / h + v_scroll->get_val();
- int to_track = int(click.to.y-ofs.y-h-sep) / h + v_scroll->get_val();
+ int from_track = int(click.at.y-ofs.y-h-sep) / h + v_scroll->get_value();
+ int to_track = int(click.to.y-ofs.y-h-sep) / h + v_scroll->get_value();
int from_mod = int(click.at.y-ofs.y-sep) % h;
int to_mod = int(click.to.y-ofs.y-sep) % h;
@@ -2452,8 +2516,8 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
break;
}
- int tracks_from = v_scroll->get_val();
- int tracks_to = v_scroll->get_val()+fit-1;
+ int tracks_from = v_scroll->get_value();
+ int tracks_to = v_scroll->get_value()+fit-1;
if (tracks_to>=animation->get_track_count())
tracks_to=animation->get_track_count()-1;
@@ -2536,8 +2600,8 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
}
float motion = from_t+(click.to.x - click.at.x)/_get_zoom_scale();
- if (step->get_val())
- motion = Math::stepify(motion,step->get_val());
+ if (step->get_value())
+ motion = Math::stepify(motion,step->get_value());
@@ -2580,8 +2644,10 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
for(Map<SelectedKey,KeyInfo>::Element *E=selection.back();E;E=E->prev()) {
float newpos=E->get().pos-from_t+motion;
- //if (newpos<0)
- // continue; //no add at the begining
+ /*
+ if (newpos<0)
+ continue; //no add at the begining
+ */
undo_redo->add_do_method(animation.ptr(),"track_insert_key",E->key().track,newpos,animation->track_get_key_value(E->key().track,E->key().key),animation->track_get_key_transition(E->key().track,E->key().key));
}
@@ -2590,8 +2656,10 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
for(Map<SelectedKey,KeyInfo>::Element *E=selection.back();E;E=E->prev()) {
float newpos=E->get().pos+-from_t+motion;
- //if (newpos<0)
- // continue; //no remove what no inserted
+ /*
+ if (newpos<0)
+ continue; //no remove what no inserted
+ */
undo_redo->add_undo_method(animation.ptr(),"track_remove_key_at_pos",E->key().track,newpos);
}
@@ -2629,7 +2697,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
float oldpos=E->get().pos;
float newpos=oldpos-from_t+motion;
//if (newpos>=0)
- undo_redo->add_do_method(this,"_select_at_anim",animation,E->key().track,newpos);
+ undo_redo->add_do_method(this,"_select_at_anim",animation,E->key().track,newpos);
undo_redo->add_undo_method(this,"_select_at_anim",animation,E->key().track,oldpos);
}
@@ -2700,7 +2768,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
//int zoomw = settings_limit-name_limit;
float scale = _get_zoom_scale();
- float pos = h_scroll->get_val() + (mpos.x-name_limit) / scale;
+ float pos = h_scroll->get_value() + (mpos.x-name_limit) / scale;
if (animation->get_step()) {
pos=Math::stepify(pos,animation->get_step());
@@ -2710,10 +2778,10 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
if (pos>=animation->get_length())
pos=animation->get_length();
- if (pos < h_scroll->get_val()) {
- h_scroll->set_val(pos);
- } else if (pos > h_scroll->get_val() + (settings_limit - name_limit) / scale) {
- h_scroll->set_val( pos - (settings_limit - name_limit) / scale );
+ if (pos < h_scroll->get_value()) {
+ h_scroll->set_value(pos);
+ } else if (pos > h_scroll->get_value() + (settings_limit - name_limit) / scale) {
+ h_scroll->set_value( pos - (settings_limit - name_limit) / scale );
}
timeline_pos=pos;
@@ -2727,18 +2795,18 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
click.to=Point2(mb.x,mb.y);
if (click.to.y<h && click.at.y>h && mb.relative_y<0) {
- float prev = v_scroll->get_val();
- v_scroll->set_val( v_scroll->get_val() -1 );
- if (prev!=v_scroll->get_val())
+ float prev = v_scroll->get_value();
+ v_scroll->set_value( v_scroll->get_value() -1 );
+ if (prev!=v_scroll->get_value())
click.at.y+=h;
}
if (click.to.y>size.height && click.at.y<size.height && mb.relative_y>0) {
- float prev = v_scroll->get_val();
- v_scroll->set_val( v_scroll->get_val() +1 );
- if (prev!=v_scroll->get_val())
+ float prev = v_scroll->get_value();
+ v_scroll->set_value( v_scroll->get_value() +1 );
+ if (prev!=v_scroll->get_value())
click.at.y-=h;
}
@@ -2755,7 +2823,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
int rel = mb.relative_x;
float relf = rel / _get_zoom_scale();
- h_scroll->set_val( h_scroll->get_val() - relf );
+ h_scroll->set_value( h_scroll->get_value() - relf );
}
if (mb.button_mask==0) {
@@ -2781,7 +2849,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
mpos.y -= h;
int idx = mpos.y / h;
- idx+=v_scroll->get_val();
+ idx+=v_scroll->get_value();
if (idx <0 || idx>=animation->get_track_count())
break;
@@ -2797,7 +2865,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
float pos = mpos.x - name_limit;
pos/=_get_zoom_scale();
- pos+=h_scroll->get_val();
+ pos+=h_scroll->get_value();
float w_time = (type_icon[0]->get_width() / _get_zoom_scale())/2.0;
int kidx = animation->track_find_key(idx,pos);
@@ -2850,7 +2918,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
} break;
case Animation::TYPE_VALUE: {
- Variant v = animation->track_get_key_value(idx,mouse_over.over_key);;
+ Variant v = animation->track_get_key_value(idx,mouse_over.over_key);
//text+="value: "+String(v)+"\n";
bool prop_exists=false;
@@ -2940,7 +3008,15 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
*/
- if (ofsx < down_icon->get_width() + interp_icon[0]->get_width() + hsep*2) {
+ if (ofsx < down_icon->get_width() + wrap_icon[0]->get_width() + hsep*3) {
+
+ mouse_over.over=MouseOver::OVER_WRAP;
+ return;
+ }
+
+ ofsx-=hsep*3+wrap_icon[0]->get_width() + down_icon->get_width();
+
+ if (ofsx < down_icon->get_width() + interp_icon[0]->get_width() + hsep*3) {
mouse_over.over=MouseOver::OVER_INTERP;
return;
@@ -3012,7 +3088,7 @@ void AnimationKeyEditor::_notification(int p_what) {
tpp->add_item(TTR("In-Out"),TRACK_MENU_SET_ALL_TRANS_INOUT);
tpp->add_item(TTR("Out-In"),TRACK_MENU_SET_ALL_TRANS_OUTIN);
tpp->set_name(TTR("Transitions"));
- tpp->connect("item_pressed",this,"_menu_track");
+ tpp->connect("id_pressed",this,"_menu_track");
optimize_dialog->connect("confirmed",this,"_animation_optimize");
menu_track->get_popup()->add_child(tpp);
@@ -3068,13 +3144,18 @@ void AnimationKeyEditor::_notification(int p_what) {
get_icon("TrackTrigger","EditorIcons")
};
+ Ref<Texture> wrap_icon[2]={
+ get_icon("InterpWrapClamp","EditorIcons"),
+ get_icon("InterpWrapLoop","EditorIcons"),
+ };
+
//right_data_size_cache = remove_icon->get_width() + move_up_icon->get_width() + move_down_icon->get_width() + down_icon->get_width() *2 + interp_icon[0]->get_width() + cont_icon[0]->get_width() + add_key_icon->get_width() + hsep*11;
- right_data_size_cache = down_icon->get_width() *2 + add_key_icon->get_width() + interp_icon[0]->get_width() + cont_icon[0]->get_width() + hsep*7;
+ right_data_size_cache = down_icon->get_width() *3 + add_key_icon->get_width() + interp_icon[0]->get_width() + cont_icon[0]->get_width() + wrap_icon[0]->get_width() + hsep*8;
}
call_select->connect("selected",this,"_add_call_track");
-// rename_anim->set_icon( get_icon("Rename","EditorIcons") );
+ //rename_anim->set_icon( get_icon("Rename","EditorIcons") );
/*
edit_anim->set_icon( get_icon("Edit","EditorIcons") );
blend_anim->set_icon( get_icon("Blend","EditorIcons") );
@@ -3082,8 +3163,8 @@ void AnimationKeyEditor::_notification(int p_what) {
stop->set_icon( get_icon("Stop","EditorIcons") );
pause->set_icon( get_icon("Pause","EditorIcons") );
*/
-// menu->set_icon(get_icon("Animation","EditorIcons"));
-// play->set_icon(get_icon("AnimationPlay","EditorIcons"));
+ //menu->set_icon(get_icon("Animation","EditorIcons"));
+ //play->set_icon(get_icon("AnimationPlay","EditorIcons"));
//menu->set_icon(get_icon("Animation","EditorIcons"));
_update_menu();
@@ -3112,8 +3193,8 @@ void AnimationKeyEditor::_update_paths() {
//timeline->set_max(animation->get_length());
//timeline->set_step(0.01);
track_editor->update();
- length->set_val(animation->get_length());
- step->set_val(animation->get_step());
+ length->set_value(animation->get_length());
+ step->set_value(animation->get_step());
}
}
@@ -3130,9 +3211,9 @@ void AnimationKeyEditor::_update_menu() {
if (animation.is_valid()) {
- length->set_val(animation->get_length());
+ length->set_value(animation->get_length());
loop->set_pressed(animation->has_loop());
- step->set_val(animation->get_step());
+ step->set_value(animation->get_step());
}
track_editor->update();
@@ -3174,12 +3255,12 @@ void AnimationKeyEditor::set_animation(const Ref<Animation>& p_anim) {
void AnimationKeyEditor::set_root(Node *p_root) {
if (root)
- root->disconnect("exit_tree",this,"_root_removed");
+ root->disconnect("tree_exited",this,"_root_removed");
root=p_root;
if (root)
- root->connect("exit_tree",this,"_root_removed",make_binds(),CONNECT_ONESHOT);
+ root->connect("tree_exited",this,"_root_removed",make_binds(),CONNECT_ONESHOT);
}
@@ -3196,7 +3277,7 @@ Node *AnimationKeyEditor::get_root() const {
void AnimationKeyEditor::update_keying() {
- bool keying_enabled=is_visible() && animation.is_valid();
+ bool keying_enabled=is_visible_in_tree() && animation.is_valid();
if (keying_enabled==keying)
return;
@@ -3215,14 +3296,14 @@ bool AnimationKeyEditor::has_keying() const {
void AnimationKeyEditor::_query_insert(const InsertData& p_id) {
- if (insert_frame!=OS::get_singleton()->get_frames_drawn()) {
+ if (insert_frame!=Engine::get_singleton()->get_frames_drawn()) {
//clear insert list for the frame if frame changed
- if (insert_confirm->is_visible())
+ if (insert_confirm->is_visible_in_tree())
return; //do nothing
insert_data.clear();
insert_query=false;
}
- insert_frame=OS::get_singleton()->get_frames_drawn();
+ insert_frame=Engine::get_singleton()->get_frames_drawn();
for (List<InsertData>::Element *E=insert_data.front();E;E=E->next()) {
//prevent insertion of multiple tracks
@@ -3233,7 +3314,7 @@ void AnimationKeyEditor::_query_insert(const InsertData& p_id) {
insert_data.push_back(p_id);
if (p_id.track_idx==-1) {
- if (bool(EDITOR_DEF("animation/confirm_insert_track",true))) {
+ if (bool(EDITOR_DEF("editors/animation/confirm_insert_track",true))) {
//potential new key, does not exist
if (insert_data.size()==1)
insert_confirm->set_text(vformat(TTR("Create NEW track for %s and insert key?"),p_id.query));
@@ -3451,7 +3532,7 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id,int p_last_track) {
h.type==Variant::VECTOR2 ||
h.type==Variant::RECT2 ||
h.type==Variant::VECTOR3 ||
- h.type==Variant::_AABB ||
+ h.type==Variant::RECT3 ||
h.type==Variant::QUAT ||
h.type==Variant::COLOR ||
h.type==Variant::TRANSFORM ) {
@@ -3626,7 +3707,7 @@ void AnimationKeyEditor::_pane_drag(const Point2& p_delta) {
ecs.y-=p_delta.y;
if (ecs.y<100)
ecs.y=100;
- ec->set_custom_minimum_size(ecs);;
+ ec->set_custom_minimum_size(ecs);
}
@@ -3710,7 +3791,7 @@ void AnimationKeyEditor::_scale() {
}
- float s = scale->get_val();
+ float s = scale->get_value();
if (s==0) {
ERR_PRINT("Can't scale to 0");
}
@@ -3841,48 +3922,48 @@ void AnimationKeyEditor::cleanup() {
void AnimationKeyEditor::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("_root_removed"),&AnimationKeyEditor::_root_removed);
- ObjectTypeDB::bind_method(_MD("_scale"),&AnimationKeyEditor::_scale);
- ObjectTypeDB::bind_method(_MD("set_root"),&AnimationKeyEditor::set_root);
+ ClassDB::bind_method(_MD("_root_removed"),&AnimationKeyEditor::_root_removed);
+ ClassDB::bind_method(_MD("_scale"),&AnimationKeyEditor::_scale);
+ ClassDB::bind_method(_MD("set_root"),&AnimationKeyEditor::set_root);
-// ObjectTypeDB::bind_method(_MD("_confirm_insert"),&AnimationKeyEditor::_confirm_insert);
- ObjectTypeDB::bind_method(_MD("_confirm_insert_list"),&AnimationKeyEditor::_confirm_insert_list);
+ //ClassDB::bind_method(_MD("_confirm_insert"),&AnimationKeyEditor::_confirm_insert);
+ ClassDB::bind_method(_MD("_confirm_insert_list"),&AnimationKeyEditor::_confirm_insert_list);
- ObjectTypeDB::bind_method(_MD("_update_paths"),&AnimationKeyEditor::_update_paths);
- ObjectTypeDB::bind_method(_MD("_track_editor_draw"),&AnimationKeyEditor::_track_editor_draw);
+ ClassDB::bind_method(_MD("_update_paths"),&AnimationKeyEditor::_update_paths);
+ ClassDB::bind_method(_MD("_track_editor_draw"),&AnimationKeyEditor::_track_editor_draw);
- ObjectTypeDB::bind_method(_MD("_animation_changed"),&AnimationKeyEditor::_animation_changed);
- ObjectTypeDB::bind_method(_MD("_scroll_changed"),&AnimationKeyEditor::_scroll_changed);
- ObjectTypeDB::bind_method(_MD("_track_editor_input_event"),&AnimationKeyEditor::_track_editor_input_event);
- ObjectTypeDB::bind_method(_MD("_track_name_changed"),&AnimationKeyEditor::_track_name_changed);
- ObjectTypeDB::bind_method(_MD("_track_menu_selected"),&AnimationKeyEditor::_track_menu_selected);
- ObjectTypeDB::bind_method(_MD("_menu_add_track"),&AnimationKeyEditor::_menu_add_track);
- ObjectTypeDB::bind_method(_MD("_menu_track"),&AnimationKeyEditor::_menu_track);
- ObjectTypeDB::bind_method(_MD("_clear_selection_for_anim"),&AnimationKeyEditor::_clear_selection_for_anim);
- ObjectTypeDB::bind_method(_MD("_select_at_anim"),&AnimationKeyEditor::_select_at_anim);
- ObjectTypeDB::bind_method(_MD("_track_pos_draw"),&AnimationKeyEditor::_track_pos_draw);
- ObjectTypeDB::bind_method(_MD("_insert_delay"),&AnimationKeyEditor::_insert_delay);
- ObjectTypeDB::bind_method(_MD("_step_changed"),&AnimationKeyEditor::_step_changed);
+ ClassDB::bind_method(_MD("_animation_changed"),&AnimationKeyEditor::_animation_changed);
+ ClassDB::bind_method(_MD("_scroll_changed"),&AnimationKeyEditor::_scroll_changed);
+ ClassDB::bind_method(_MD("_track_editor_gui_input"),&AnimationKeyEditor::_track_editor_gui_input);
+ ClassDB::bind_method(_MD("_track_name_changed"),&AnimationKeyEditor::_track_name_changed);
+ ClassDB::bind_method(_MD("_track_menu_selected"),&AnimationKeyEditor::_track_menu_selected);
+ ClassDB::bind_method(_MD("_menu_add_track"),&AnimationKeyEditor::_menu_add_track);
+ ClassDB::bind_method(_MD("_menu_track"),&AnimationKeyEditor::_menu_track);
+ ClassDB::bind_method(_MD("_clear_selection_for_anim"),&AnimationKeyEditor::_clear_selection_for_anim);
+ ClassDB::bind_method(_MD("_select_at_anim"),&AnimationKeyEditor::_select_at_anim);
+ ClassDB::bind_method(_MD("_track_pos_draw"),&AnimationKeyEditor::_track_pos_draw);
+ ClassDB::bind_method(_MD("_insert_delay"),&AnimationKeyEditor::_insert_delay);
+ ClassDB::bind_method(_MD("_step_changed"),&AnimationKeyEditor::_step_changed);
- ObjectTypeDB::bind_method(_MD("_animation_loop_changed"),&AnimationKeyEditor::_animation_loop_changed);
- ObjectTypeDB::bind_method(_MD("_animation_len_changed"),&AnimationKeyEditor::_animation_len_changed);
- ObjectTypeDB::bind_method(_MD("_create_value_item"),&AnimationKeyEditor::_create_value_item);
- ObjectTypeDB::bind_method(_MD("_pane_drag"),&AnimationKeyEditor::_pane_drag);
+ ClassDB::bind_method(_MD("_animation_loop_changed"),&AnimationKeyEditor::_animation_loop_changed);
+ ClassDB::bind_method(_MD("_animation_len_changed"),&AnimationKeyEditor::_animation_len_changed);
+ ClassDB::bind_method(_MD("_create_value_item"),&AnimationKeyEditor::_create_value_item);
+ ClassDB::bind_method(_MD("_pane_drag"),&AnimationKeyEditor::_pane_drag);
- ObjectTypeDB::bind_method(_MD("_animation_len_update"),&AnimationKeyEditor::_animation_len_update);
+ ClassDB::bind_method(_MD("_animation_len_update"),&AnimationKeyEditor::_animation_len_update);
- ObjectTypeDB::bind_method(_MD("set_animation"),&AnimationKeyEditor::set_animation);
- ObjectTypeDB::bind_method(_MD("_animation_optimize"),&AnimationKeyEditor::_animation_optimize);
- ObjectTypeDB::bind_method(_MD("_curve_transition_changed"),&AnimationKeyEditor::_curve_transition_changed);
- ObjectTypeDB::bind_method(_MD("_toggle_edit_curves"),&AnimationKeyEditor::_toggle_edit_curves);
- ObjectTypeDB::bind_method(_MD("_add_call_track"),&AnimationKeyEditor::_add_call_track);
+ ClassDB::bind_method(_MD("set_animation"),&AnimationKeyEditor::set_animation);
+ ClassDB::bind_method(_MD("_animation_optimize"),&AnimationKeyEditor::_animation_optimize);
+ ClassDB::bind_method(_MD("_curve_transition_changed"),&AnimationKeyEditor::_curve_transition_changed);
+ ClassDB::bind_method(_MD("_toggle_edit_curves"),&AnimationKeyEditor::_toggle_edit_curves);
+ ClassDB::bind_method(_MD("_add_call_track"),&AnimationKeyEditor::_add_call_track);
ADD_SIGNAL( MethodInfo("resource_selected", PropertyInfo( Variant::OBJECT, "res"),PropertyInfo( Variant::STRING, "prop") ) );
@@ -3914,7 +3995,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
h_scroll = memnew( HScrollBar );
h_scroll->connect("value_changed",this,"_scroll_changed");
add_child(h_scroll);
- h_scroll->set_val(0);
+ h_scroll->set_value(0);
HBoxContainer *hb = memnew( HBoxContainer );
@@ -3927,7 +4008,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
//menu->set_pos(Point2());
//add_child(menu);
- zoomicon = memnew( TextureFrame );
+ zoomicon = memnew( TextureRect );
hb->add_child(zoomicon);
zoomicon->set_tooltip(TTR("Animation zoom."));
@@ -3936,7 +4017,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
zoom->set_step(0.01);
zoom->set_min(0.0);
zoom->set_max(2.0);
- zoom->set_val(1.0);
+ zoom->set_value(1.0);
zoom->set_h_size_flags(SIZE_EXPAND_FILL);
zoom->set_stretch_ratio(2);
hb->add_child(zoom);
@@ -3968,7 +4049,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
step->set_min(0.00);
step->set_max(128);
step->set_step(0.01);
- step->set_val(0.0);
+ step->set_value(0.0);
step->set_h_size_flags(SIZE_EXPAND_FILL);
step->set_stretch_ratio(1);
step->set_tooltip(TTR("Cursor step snap (in seconds)."));
@@ -3986,7 +4067,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
menu_add_track = memnew( MenuButton );
hb->add_child(menu_add_track);
- menu_add_track->get_popup()->connect("item_pressed",this,"_menu_add_track");
+ menu_add_track->get_popup()->connect("id_pressed",this,"_menu_add_track");
menu_add_track->set_tooltip(TTR("Add new tracks."));
move_up_button = memnew( ToolButton );
@@ -4014,7 +4095,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
menu_track = memnew( MenuButton );
hb->add_child(menu_track);
- menu_track->get_popup()->connect("item_pressed",this,"_menu_track");
+ menu_track->get_popup()->connect("id_pressed",this,"_menu_track");
menu_track->set_tooltip(TTR("Track tools"));
edit_button = memnew( ToolButton );
@@ -4030,18 +4111,18 @@ AnimationKeyEditor::AnimationKeyEditor() {
optimize_dialog->set_title(TTR("Anim. Optimizer"));
VBoxContainer *optimize_vb = memnew( VBoxContainer );
optimize_dialog->add_child(optimize_vb);
- optimize_dialog->set_child_rect(optimize_vb);
+
optimize_linear_error = memnew( SpinBox );
optimize_linear_error->set_max(1.0);
optimize_linear_error->set_min(0.001);
optimize_linear_error->set_step(0.001);
- optimize_linear_error->set_val(0.05);
+ optimize_linear_error->set_value(0.05);
optimize_vb->add_margin_child(TTR("Max. Linear Error:"),optimize_linear_error);
optimize_angular_error = memnew( SpinBox );
optimize_angular_error->set_max(1.0);
optimize_angular_error->set_min(0.001);
optimize_angular_error->set_step(0.001);
- optimize_angular_error->set_val(0.01);
+ optimize_angular_error->set_value(0.01);
optimize_vb->add_margin_child(TTR("Max. Angular Error:"),optimize_angular_error);
optimize_max_angle = memnew( SpinBox );
@@ -4049,7 +4130,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
optimize_max_angle->set_max(360.0);
optimize_max_angle->set_min(0.0);
optimize_max_angle->set_step(0.1);
- optimize_max_angle->set_val(22);
+ optimize_max_angle->set_value(22);
optimize_dialog->get_ok()->set_text(TTR("Optimize"));
@@ -4069,9 +4150,9 @@ AnimationKeyEditor::AnimationKeyEditor() {
/* l = memnew( Label );
l->set_text("Base: ");
l->set_pos(Point2(0,3));
-// dr_panel->add_child(l);*/
+ //dr_panel->add_child(l);*/
-// menu->get_popup()->connect("item_pressed",this,"_menu_callback");
+ //menu->get_popup()->connect("id_pressed",this,"_menu_callback");
hb = memnew( HBoxContainer);
@@ -4082,7 +4163,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
track_editor = memnew( Control );
track_editor->connect("draw",this,"_track_editor_draw");
hb->add_child(track_editor);
- track_editor->connect("input_event",this,"_track_editor_input_event");
+ track_editor->connect("gui_input",this,"_track_editor_gui_input");
track_editor->set_focus_mode(Control::FOCUS_ALL);
track_editor->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -4090,7 +4171,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
track_pos = memnew( Control );
track_pos->set_area_as_parent_rect();
- track_pos->set_ignore_mouse(true);
+ track_pos->set_mouse_filter(MOUSE_FILTER_IGNORE);
track_editor->add_child(track_pos);
track_pos->connect("draw",this,"_track_pos_draw");
@@ -4107,7 +4188,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
v_scroll = memnew( VScrollBar );
hb->add_child(v_scroll);
v_scroll->connect("value_changed",this,"_scroll_changed");
- v_scroll->set_val(0);
+ v_scroll->set_value(0);
key_editor_tab = memnew(TabContainer);
hb->add_child(key_editor_tab);
@@ -4127,7 +4208,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
add_child(type_menu);
for(int i=0;i<Variant::VARIANT_MAX;i++)
type_menu->add_item(Variant::get_type_name(Variant::Type(i)),i);
- type_menu->connect("item_pressed",this,"_create_value_item");
+ type_menu->connect("id_pressed",this,"_create_value_item");
VBoxContainer *curve_vb = memnew( VBoxContainer );
curve_vb->set_name(TTR("Transition"));
@@ -4166,7 +4247,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
track_name->connect("text_entered",this,"_track_name_changed");
track_menu = memnew( PopupMenu );
add_child(track_menu);
- track_menu->connect("item_pressed",this,"_track_menu_selected");
+ track_menu->connect("id_pressed",this,"_track_menu_selected");
key_editor_tab->hide();
@@ -4198,7 +4279,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
scale_dialog = memnew( ConfirmationDialog );
VBoxContainer *vbc = memnew( VBoxContainer );
scale_dialog->add_child(vbc);
- scale_dialog->set_child_rect(vbc);
+
scale = memnew( SpinBox );
scale->set_min(-99999);
scale->set_max(99999);
@@ -4215,7 +4296,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
add_child(cleanup_dialog);
VBoxContainer *cleanup_vb = memnew( VBoxContainer );
cleanup_dialog->add_child(cleanup_vb);
- cleanup_dialog->set_child_rect(cleanup_vb);
+
cleanup_keys = memnew( CheckButton );
cleanup_keys->set_text(TTR("Remove invalid keys"));
cleanup_keys->set_pressed(true);
@@ -4237,6 +4318,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
add_constant_override("separation",get_constant("separation","VBoxContainer"));
+ track_editor->set_clip_contents(true);
}