summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/sample_player_2d.cpp2
-rw-r--r--scene/3d/spatial_sample_player.cpp2
-rw-r--r--scene/animation/animation_cache.cpp2
-rw-r--r--scene/animation/animation_player.cpp26
-rw-r--r--scene/animation/animation_tree_player.cpp2
-rw-r--r--scene/audio/sample_player.cpp2
-rw-r--r--scene/gui/color_picker.cpp5
-rw-r--r--scene/gui/color_picker.h2
-rw-r--r--scene/gui/line_edit.cpp291
-rw-r--r--scene/gui/line_edit.h2
-rw-r--r--scene/gui/tab_container.cpp5
-rw-r--r--scene/gui/text_edit.cpp4
-rw-r--r--scene/resources/animation.cpp62
-rw-r--r--scene/resources/animation.h23
-rw-r--r--scene/resources/dynamic_font.cpp13
-rw-r--r--scene/resources/dynamic_font.h4
-rw-r--r--scene/resources/mesh.cpp6
17 files changed, 335 insertions, 118 deletions
diff --git a/scene/2d/sample_player_2d.cpp b/scene/2d/sample_player_2d.cpp
index 4d719b532b..7c997b3f12 100644
--- a/scene/2d/sample_player_2d.cpp
+++ b/scene/2d/sample_player_2d.cpp
@@ -81,7 +81,7 @@ void SamplePlayer2D::_get_property_list(List<PropertyInfo> *p_list) const {
}
}
- p_list->push_back( PropertyInfo( Variant::STRING, "play/play", PROPERTY_HINT_ENUM, en,PROPERTY_USAGE_EDITOR));
+ p_list->push_back( PropertyInfo( Variant::STRING, "play/play", PROPERTY_HINT_ENUM, en,PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_ANIMATE_AS_TRIGGER));
}
void SamplePlayer2D::_notification(int p_what) {
diff --git a/scene/3d/spatial_sample_player.cpp b/scene/3d/spatial_sample_player.cpp
index 0df921f208..4c5b2c240e 100644
--- a/scene/3d/spatial_sample_player.cpp
+++ b/scene/3d/spatial_sample_player.cpp
@@ -82,7 +82,7 @@ void SpatialSamplePlayer::_get_property_list(List<PropertyInfo> *p_list) const {
}
}
- p_list->push_back( PropertyInfo( Variant::STRING, "play/play", PROPERTY_HINT_ENUM, en,PROPERTY_USAGE_EDITOR));
+ p_list->push_back( PropertyInfo( Variant::STRING, "play/play", PROPERTY_HINT_ENUM, en,PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_ANIMATE_AS_TRIGGER));
}
void SpatialSamplePlayer::_notification(int p_what) {
diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp
index b1123897b2..113e2c2278 100644
--- a/scene/animation/animation_cache.cpp
+++ b/scene/animation/animation_cache.cpp
@@ -301,7 +301,7 @@ void AnimationCache::set_all(float p_time, float p_delta) {
} break;
case Animation::TYPE_VALUE: {
- if (animation->value_track_is_continuous(i)) {
+ if (animation->value_track_get_update_mode(i)==Animation::UPDATE_CONTINUOUS || (animation->value_track_get_update_mode(i)==Animation::UPDATE_DISCRETE && p_delta==0)) {
Variant v = animation->value_track_interpolate(i,p_time);
set_track_value(i,v);
} else {
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 2399bee539..0ff6931dcd 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -174,7 +174,7 @@ void AnimationPlayer::_get_property_list( List<PropertyInfo> *p_list) const {
hint+=E->get();
}
- p_list->push_back( PropertyInfo( Variant::STRING, "playback/play", PROPERTY_HINT_ENUM, hint,PROPERTY_USAGE_EDITOR) );
+ p_list->push_back( PropertyInfo( Variant::STRING, "playback/play", PROPERTY_HINT_ENUM, hint,PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_ANIMATE_AS_TRIGGER) );
p_list->push_back( PropertyInfo( Variant::BOOL, "playback/active", PROPERTY_HINT_NONE,"" ) );
p_list->push_back( PropertyInfo( Variant::REAL, "playback/speed", PROPERTY_HINT_RANGE, "-64,64,0.01") );
@@ -421,12 +421,13 @@ void AnimationPlayer::_animation_process_animation(AnimationData* p_anim,float p
TrackNodeCache::PropertyAnim *pa = &E->get();
- if (a->value_track_is_continuous(i) || p_delta==0) { //delta == 0 means seek
+ if (a->value_track_get_update_mode(i)==Animation::UPDATE_CONTINUOUS || (p_delta==0 && a->value_track_get_update_mode(i)==Animation::UPDATE_DISCRETE)) { //delta == 0 means seek
Variant value=a->value_track_interpolate(i,p_time);
- if (p_delta==0 && value.get_type()==Variant::STRING)
- continue; // doing this with strings is messy, should find another way
+ //thanks to trigger mode, this should be solved now..
+ //if (p_delta==0 && value.get_type()==Variant::STRING)
+ // continue; // doing this with strings is messy, should find another way
if (pa->accum_pass!=accum_pass) {
ERR_CONTINUE( cache_update_prop_size >= NODE_CACHE_UPDATE_MAX );
cache_update_prop[cache_update_prop_size++]=pa;
@@ -437,11 +438,12 @@ void AnimationPlayer::_animation_process_animation(AnimationData* p_anim,float p
}
- } else if (p_allow_discrete) {
+ } else if (p_allow_discrete && p_delta!=0) {
List<int> indices;
a->value_track_get_key_indices(i,p_time,p_delta,&indices);
+
for(List<int>::Element *F=indices.front();F;F=F->next()) {
Variant value=a->track_get_key_value(i,F->get());
@@ -538,6 +540,7 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd,float p_delta,flo
float len=cd.from->animation->get_length();
bool loop=cd.from->animation->has_loop();
+ bool loop_interpolation=cd.from->animation->has_loop_interpolation();
if (!loop) {
@@ -563,10 +566,21 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd,float p_delta,flo
}
- } else {
+ } else if (loop_interpolation) {
next_pos=Math::fposmod(next_pos,len);
+ } else {
+
+ if (next_pos<0 or next_pos>len) {
+ if (!backwards)
+ next_pos=0;
+ else if (backwards)
+ next_pos=len;
+ }
+ // fix delta - not sure if needed here
+ delta=next_pos-cd.pos;
+
}
cd.pos=next_pos;
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp
index 0f7ed1cb29..628edf09de 100644
--- a/scene/animation/animation_tree_player.cpp
+++ b/scene/animation/animation_tree_player.cpp
@@ -825,7 +825,7 @@ void AnimationTreePlayer::_process_animation(float p_delta) {
} break;
case Animation::TYPE_VALUE: { ///< Set a value in a property, can be interpolated.
- if (a->value_track_is_continuous(tr.local_track)) {
+ if (a->value_track_get_update_mode(tr.local_track)==Animation::UPDATE_CONTINUOUS) {
Variant value = a->value_track_interpolate(tr.local_track,anim_list->time);
Variant::blend(tr.track->value,value,blend,tr.track->value);
} else {
diff --git a/scene/audio/sample_player.cpp b/scene/audio/sample_player.cpp
index bcd4354975..3827d40a71 100644
--- a/scene/audio/sample_player.cpp
+++ b/scene/audio/sample_player.cpp
@@ -152,7 +152,7 @@ void SamplePlayer::_get_property_list(List<PropertyInfo> *p_list) const {
}
}
- p_list->push_back( PropertyInfo( Variant::STRING, "play/play", PROPERTY_HINT_ENUM, en,PROPERTY_USAGE_EDITOR));
+ p_list->push_back( PropertyInfo( Variant::STRING, "play/play", PROPERTY_HINT_ENUM, en,PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_ANIMATE_AS_TRIGGER));
p_list->push_back( PropertyInfo( Variant::INT, "config/polyphony", PROPERTY_HINT_RANGE, "1,256,1"));
p_list->push_back( PropertyInfo( Variant::OBJECT, "config/samples", PROPERTY_HINT_RESOURCE_TYPE, "SampleLibrary"));
p_list->push_back( PropertyInfo( Variant::REAL, "default/volume_db", PROPERTY_HINT_RANGE, "-80,24,0.01"));
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index bd24b43761..d6bbdf2d21 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -664,10 +664,15 @@ bool ColorPickerButton::is_editing_alpha() const{
}
+ColorPicker *ColorPickerButton::get_picker() {
+ return picker;
+}
+
void ColorPickerButton::_bind_methods(){
ObjectTypeDB::bind_method(_MD("set_color","color"),&ColorPickerButton::set_color);
ObjectTypeDB::bind_method(_MD("get_color"),&ColorPickerButton::get_color);
+ ObjectTypeDB::bind_method(_MD("get_picker:ColorPicker"),&ColorPickerButton::get_picker);
ObjectTypeDB::bind_method(_MD("set_edit_alpha","show"),&ColorPickerButton::set_edit_alpha);
ObjectTypeDB::bind_method(_MD("is_editing_alpha"),&ColorPickerButton::is_editing_alpha);
ObjectTypeDB::bind_method(_MD("_color_changed"),&ColorPickerButton::_color_changed);
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index 4559bc7391..f5de982200 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -133,6 +133,8 @@ public:
void set_edit_alpha(bool p_show);
bool is_editing_alpha() const;
+ ColorPicker *get_picker();
+
ColorPickerButton();
};
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index ab556ede0c..52ef57cf1c 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -32,6 +32,11 @@
#include "print_string.h"
#include "label.h"
+static bool _is_text_char(CharType c) {
+
+ return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='_';
+}
+
void LineEdit::_input_event(InputEvent p_event) {
@@ -54,26 +59,36 @@ void LineEdit::_input_event(InputEvent p_event) {
if (b.pressed) {
+ shift_selection_check_pre(b.mod.shift);
+
set_cursor_at_pixel_pos(b.x);
- if (b.doubleclick) {
+ if (b.mod.shift) {
- selection.enabled=true;
- selection.begin=0;
- selection.end=text.length();
- selection.doubleclick=true;
- }
+ selection_fill_at_cursor();
+ selection.creating=true;
- selection.drag_attempt=false;
+ } else {
- if ((cursor_pos<selection.begin) || (cursor_pos>selection.end) || !selection.enabled) {
+ if (b.doubleclick) {
- selection_clear();
- selection.cursor_start=cursor_pos;
- selection.creating=true;
- } else if (selection.enabled) {
+ selection.enabled=true;
+ selection.begin=0;
+ selection.end=text.length();
+ selection.doubleclick=true;
+ }
+
+ selection.drag_attempt=false;
+
+ if ((cursor_pos<selection.begin) || (cursor_pos>selection.end) || !selection.enabled) {
+
+ selection_clear();
+ selection.cursor_start=cursor_pos;
+ selection.creating=true;
+ } else if (selection.enabled) {
- selection.drag_attempt=true;
+ selection.drag_attempt=true;
+ }
}
// if (!editable)
@@ -124,7 +139,7 @@ void LineEdit::_input_event(InputEvent p_event) {
case (KEY_X): { // CUT
- if(k.mod.command && editable) {
+ if(editable) {
cut_text();
}
@@ -132,15 +147,13 @@ void LineEdit::_input_event(InputEvent p_event) {
case (KEY_C): { // COPY
- if(k.mod.command) {
- copy_text();
- }
+ copy_text();
} break;
case (KEY_V): { // PASTE
- if(k.mod.command && editable) {
+ if(editable) {
paste_text();
}
@@ -149,7 +162,7 @@ void LineEdit::_input_event(InputEvent p_event) {
case (KEY_Z): { // Simple One level undo
- if( k.mod.command && editable) {
+ if(editable) {
undo();
@@ -160,7 +173,7 @@ void LineEdit::_input_event(InputEvent p_event) {
case (KEY_U): { // Delete from start to cursor
- if( k.mod.command && editable) {
+ if(editable) {
selection_clear();
undo_text = text;
@@ -184,7 +197,7 @@ void LineEdit::_input_event(InputEvent p_event) {
case (KEY_Y): { // PASTE (Yank for unix users)
- if(k.mod.command && editable) {
+ if(editable) {
paste_text();
}
@@ -192,7 +205,7 @@ void LineEdit::_input_event(InputEvent p_event) {
} break;
case (KEY_K): { // Delete from cursor_pos to end
- if(k.mod.command && editable) {
+ if(editable) {
selection_clear();
undo_text = text;
@@ -215,7 +228,7 @@ void LineEdit::_input_event(InputEvent p_event) {
}
- if (!k.mod.alt && !k.mod.meta && !k.mod.command) {
+ if (!k.mod.meta) {
bool handled=true;
switch (code) {
@@ -232,13 +245,45 @@ void LineEdit::_input_event(InputEvent p_event) {
case KEY_BACKSPACE: {
- if (editable) {
- undo_text = text;
- if (selection.enabled)
- selection_delete();
- else
- delete_char();
+ if (!editable)
+ break;
+
+ if (selection.enabled) {
+ undo_text=text;
+ selection_delete();
+ break;
+ }
+
+#ifdef APPLE_STYLE_KEYS
+ if (k.mod.alt) {
+#else
+ if (k.mod.alt) {
+ handled=false;
+ break;
+ } else if (k.mod.command) {
+#endif
+ int cc=cursor_pos;
+ bool prev_char=false;
+
+ while (cc>0) {
+ bool ischar=_is_text_char(text[cc-1]);
+
+ if (prev_char && !ischar)
+ break;
+
+ prev_char=ischar;
+ cc--;
+ }
+
+ delete_text(cc, cursor_pos);
+
+ set_cursor_pos(cc);
+
+ } else {
+ undo_text=text;
+ delete_char();
}
+
} break;
case KEY_KP_4: {
if (k.unicode != 0) {
@@ -248,8 +293,39 @@ void LineEdit::_input_event(InputEvent p_event) {
// numlock disabled. fallthrough to key_left
}
case KEY_LEFT: {
+
shift_selection_check_pre(k.mod.shift);
- set_cursor_pos(get_cursor_pos()-1);
+
+#ifdef APPLE_STYLE_KEYS
+ if (k.mod.command) {
+ set_cursor_pos(0);
+ } else if (k.mod.alt) {
+
+#else
+ if (k.mod.alt) {
+ handled=false;
+ break;
+ } else if (k.mod.command) {
+#endif
+ bool prev_char=false;
+ int cc=cursor_pos;
+
+ while (cc>0) {
+ bool ischar=_is_text_char(text[cc-1]);
+
+ if (prev_char && !ischar)
+ break;
+
+ prev_char=ischar;
+ cc--;
+ }
+
+ set_cursor_pos(cc);
+
+ } else {
+ set_cursor_pos(get_cursor_pos()-1);
+ }
+
shift_selection_check_post(k.mod.shift);
} break;
@@ -263,25 +339,88 @@ void LineEdit::_input_event(InputEvent p_event) {
case KEY_RIGHT: {
shift_selection_check_pre(k.mod.shift);
- set_cursor_pos(get_cursor_pos()+1);
+
+#ifdef APPLE_STYLE_KEYS
+ if (k.mod.command) {
+ set_cursor_pos(text.length());
+ } else if (k.mod.alt) {
+#else
+ if (k.mod.alt) {
+ handled=false;
+ break;
+ } else if (k.mod.command) {
+#endif
+ bool prev_char=false;
+ int cc=cursor_pos;
+
+ while (cc<text.length()) {
+ bool ischar=_is_text_char(text[cc]);
+
+ if (prev_char && !ischar)
+ break;
+
+ prev_char=ischar;
+ cc++;
+ }
+
+ set_cursor_pos(cc);
+
+ } else {
+ set_cursor_pos(get_cursor_pos()+1);
+ }
+
shift_selection_check_post(k.mod.shift);
+
} break;
case KEY_DELETE: {
- if (k.mod.shift && !k.mod.command && !k.mod.alt && editable) {
+ if (!editable)
+ break;
+
+ if (k.mod.shift && !k.mod.command && !k.mod.alt) {
cut_text();
break;
}
- if (editable) {
- undo_text = text;
- if (selection.enabled)
- selection_delete();
- else if (cursor_pos<text.length()) {
+ if (selection.enabled) {
+ undo_text=text;
+ selection_delete();
+ break;
+ }
+
+ int text_len = text.length();
+
+ if (cursor_pos==text_len)
+ break; // nothing to do
+
+#ifdef APPLE_STYLE_KEYS
+ if (k.mod.alt) {
+#else
+ if (k.mod.alt) {
+ handled=false;
+ break;
+ } else if (k.mod.command) {
+#endif
+ int cc=cursor_pos;
+
+ bool prev_char=false;
+
+ while (cc<text.length()) {
- set_cursor_pos(get_cursor_pos()+1);
- delete_char();
+ bool ischar=_is_text_char(text[cc]);
+
+ if (prev_char && !ischar)
+ break;
+ prev_char=ischar;
+ cc++;
}
+
+ delete_text(cursor_pos,cc);
+
+ } else {
+ undo_text=text;
+ set_cursor_pos(cursor_pos+1);
+ delete_char();
}
} break;
@@ -339,8 +478,6 @@ void LineEdit::_input_event(InputEvent p_event) {
}
}
-
- selection.old_shift=k.mod.shift;
update();
}
@@ -577,7 +714,7 @@ void LineEdit::undo() {
void LineEdit::shift_selection_check_pre(bool p_shift) {
- if (!selection.old_shift && p_shift) {
+ if (!selection.enabled && p_shift) {
selection.cursor_start=cursor_pos;
}
if (!p_shift)
@@ -673,6 +810,39 @@ void LineEdit::delete_char() {
_change_notify("text");
}
+void LineEdit::delete_text(int p_from_column, int p_to_column) {
+
+ undo_text = text;
+
+ if (text.size() > 0)
+ {
+ Ref<Font> font = get_font("font");
+ if (font != NULL) {
+ for (int i = p_from_column; i < p_to_column; i++)
+ cached_width -= font->get_char_size(text[i]).width;
+ }
+ }
+ else
+ {
+ cached_width = 0;
+ }
+
+ text.erase(p_from_column,p_to_column-p_from_column);
+ cursor_pos-=CLAMP( cursor_pos-p_from_column, 0, p_to_column-p_from_column);
+
+ if (cursor_pos>=text.length()) {
+
+ cursor_pos=text.length();
+ }
+ if (window_pos>cursor_pos) {
+
+ window_pos=cursor_pos;
+ }
+
+ emit_signal("text_changed",text);
+ _change_notify("text");
+}
+
void LineEdit::set_text(String p_text) {
clear_internal();
@@ -820,46 +990,14 @@ void LineEdit::selection_clear() {
selection.cursor_start=0;
selection.enabled=false;
selection.creating=false;
- selection.old_shift=false;
selection.doubleclick=false;
update();
}
-
void LineEdit::selection_delete() {
- if (selection.enabled) {
-
- undo_text = text;
-
- if (text.size() > 0)
- {
- Ref<Font> font = get_font("font");
- if (font != NULL) {
- for (int i = selection.begin; i < selection.end; i++)
- cached_width -= font->get_char_size(text[i]).width;
- }
- }
- else
- {
- cached_width = 0;
- }
-
- text.erase(selection.begin,selection.end-selection.begin);
- cursor_pos-=CLAMP( cursor_pos-selection.begin, 0, selection.end-selection.begin);
-
- if (cursor_pos>=text.length()) {
-
- cursor_pos=text.length();
- }
- if (window_pos>cursor_pos) {
-
- window_pos=cursor_pos;
- }
-
- emit_signal("text_changed",text);
- _change_notify("text");
- };
+ if (selection.enabled)
+ delete_text(selection.begin,selection.end);
selection_clear();
}
@@ -946,7 +1084,6 @@ void LineEdit::select(int p_from, int p_to) {
selection.begin=p_from;
selection.end=p_to;
selection.creating=false;
- selection.old_shift=false;
selection.doubleclick=false;
update();
}
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 586a54e950..ce3958db02 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -83,7 +83,6 @@ private:
int cursor_start;
bool enabled;
bool creating;
- bool old_shift;
bool doubleclick;
bool drag_attempt;
} selection;
@@ -123,6 +122,7 @@ public:
void select_all();
void delete_char();
+ void delete_text(int p_from_column, int p_to_column);
void set_text(String p_text);
String get_text() const;
void set_cursor_pos(int p_pos);
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 37c68a295d..5eb579f1d2 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -412,8 +412,9 @@ void TabContainer::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
-
- call_deferred("set_current_tab",get_current_tab()); //wait until all changed theme
+ if (get_tab_count() > 0) {
+ call_deferred("set_current_tab",get_current_tab()); //wait until all changed theme
+ }
} break;
}
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 49d7527786..c08247095a 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1452,10 +1452,10 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
}
if (mb.pressed) {
- if (mb.button_index==BUTTON_WHEEL_UP) {
+ if (mb.button_index==BUTTON_WHEEL_UP && !mb.mod.command) {
v_scroll->set_val( v_scroll->get_val() -3 );
}
- if (mb.button_index==BUTTON_WHEEL_DOWN) {
+ if (mb.button_index==BUTTON_WHEEL_DOWN && !mb.mod.command) {
v_scroll->set_val( v_scroll->get_val() +3 );
}
if (mb.button_index==BUTTON_WHEEL_LEFT) {
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index f7d5ddc744..b6fc3eb419 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -38,6 +38,8 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) {
set_length(p_value);
else if (name=="loop")
set_loop(p_value);
+ else if (name=="loop_interpolation")
+ set_loop_interpolation(p_value);
else if (name=="step")
set_step(p_value);
else if (name.begins_with("tracks/")) {
@@ -154,8 +156,20 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) {
Dictionary d = p_value;
ERR_FAIL_COND_V(!d.has("times"),false);
ERR_FAIL_COND_V(!d.has("values"),false);
- if (d.has("cont"))
- vt->continuous=d["cont"];
+ if (d.has("cont")) {
+ bool v = d["cont"];
+ vt->update_mode=v?UPDATE_CONTINUOUS:UPDATE_DISCRETE;
+ }
+
+ if (d.has("update")) {
+ int um =d["update"];
+ if (um<0)
+ um=0;
+ else if (um>2)
+ um=2;
+ vt->update_mode=UpdateMode(um);
+ }
+
DVector<float> times=d["times"];
Array values=d["values"];
@@ -353,7 +367,7 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const {
d["transitions"]=key_transitions;
d["values"]=key_values;
if (track_get_type(track)==TYPE_VALUE) {
- d["cont"]=value_track_is_continuous(track);
+ d["update"]=value_track_get_update_mode(track);
}
r_ret=d;
@@ -394,7 +408,7 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const {
d["transitions"]=key_transitions;
d["values"]=key_values;
if (track_get_type(track)==TYPE_VALUE) {
- d["cont"]=value_track_is_continuous(track);
+ d["update"]=value_track_get_update_mode(track);
}
r_ret=d;
@@ -1221,7 +1235,7 @@ T Animation::_interpolate( const Vector< TKey<T> >& p_keys, float p_time, Inter
float c=0;
// prepare for all cases of interpolation
- if (loop) {
+ if (loop and loop_interpolation) {
// loop
if (idx>=0) {
@@ -1373,7 +1387,7 @@ Variant Animation::value_track_interpolate(int p_track, float p_time) const {
bool ok;
- Variant res = _interpolate( vt->values, p_time, vt->interpolation, &ok );
+ Variant res = _interpolate( vt->values, p_time, vt->update_mode==UPDATE_CONTINUOUS?vt->interpolation:INTERPOLATION_NEAREST, &ok );
if (ok) {
@@ -1461,28 +1475,30 @@ void Animation::value_track_get_key_indices(int p_track, float p_time, float p_d
}
-void Animation::value_track_set_continuous(int p_track, bool p_continuous) {
+void Animation::value_track_set_update_mode(int p_track, UpdateMode p_mode) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t=tracks[p_track];
ERR_FAIL_COND( t->type != TYPE_VALUE );
+ ERR_FAIL_INDEX(p_mode,3);
ValueTrack * vt = static_cast<ValueTrack*>(t);
- vt->continuous=p_continuous;
+ vt->update_mode=p_mode;
}
-bool Animation::value_track_is_continuous(int p_track) const{
+Animation::UpdateMode Animation::value_track_get_update_mode(int p_track) const {
- ERR_FAIL_INDEX_V(p_track, tracks.size(), false);
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), UPDATE_CONTINUOUS);
Track *t=tracks[p_track];
- ERR_FAIL_COND_V( t->type != TYPE_VALUE, false );
+ ERR_FAIL_COND_V( t->type != TYPE_VALUE, UPDATE_CONTINUOUS );
ValueTrack * vt = static_cast<ValueTrack*>(t);
- return vt->continuous;
+ return vt->update_mode;
}
+
void Animation::_method_track_get_key_indices_in_range(const MethodTrack * mt, float from_time, float to_time,List<int> *p_indices) const {
if (from_time!=length && to_time==length)
@@ -1607,10 +1623,19 @@ void Animation::set_loop(bool p_enabled) {
loop=p_enabled;
emit_changed();
}
+void Animation::set_loop_interpolation(bool p_enabled) {
+
+ loop_interpolation=p_enabled;
+ emit_changed();
+}
bool Animation::has_loop() const {
return loop;
}
+bool Animation::has_loop_interpolation() const {
+
+ return loop_interpolation;
+}
void Animation::track_move_up(int p_track) {
@@ -1676,8 +1701,8 @@ void Animation::_bind_methods() {
ObjectTypeDB::bind_method(_MD("transform_track_interpolate","idx","time_sec"),&Animation::_transform_track_interpolate);
- ObjectTypeDB::bind_method(_MD("value_track_set_continuous","idx","continuous"),&Animation::value_track_set_continuous);
- ObjectTypeDB::bind_method(_MD("value_track_is_continuous","idx"),&Animation::value_track_is_continuous);
+ ObjectTypeDB::bind_method(_MD("value_track_set_update_mode","idx","mode"),&Animation::value_track_set_update_mode);
+ ObjectTypeDB::bind_method(_MD("value_track_get_update_mode","idx"),&Animation::value_track_get_update_mode);
ObjectTypeDB::bind_method(_MD("value_track_get_key_indices","idx","time_sec","delta"),&Animation::_value_track_get_key_indices);
@@ -1689,7 +1714,9 @@ void Animation::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_length"),&Animation::get_length);
ObjectTypeDB::bind_method(_MD("set_loop","enabled"),&Animation::set_loop);
+ ObjectTypeDB::bind_method(_MD("set_loop_interpolation","enabled"),&Animation::set_loop_interpolation);
ObjectTypeDB::bind_method(_MD("has_loop"),&Animation::has_loop);
+ ObjectTypeDB::bind_method(_MD("has_loop_interpolation"),&Animation::has_loop_interpolation);
ObjectTypeDB::bind_method(_MD("set_step","size_sec"),&Animation::set_step);
ObjectTypeDB::bind_method(_MD("get_step"),&Animation::get_step);
@@ -1704,6 +1731,11 @@ void Animation::_bind_methods() {
BIND_CONSTANT( INTERPOLATION_LINEAR );
BIND_CONSTANT( INTERPOLATION_CUBIC );
+ BIND_CONSTANT( UPDATE_CONTINUOUS );
+ BIND_CONSTANT( UPDATE_DISCRETE );
+ BIND_CONSTANT( UPDATE_TRIGGER );
+
+
}
void Animation::clear() {
@@ -1712,6 +1744,7 @@ void Animation::clear() {
memdelete( tracks[i] );
tracks.clear();
loop=false;
+ loop_interpolation=true;
length=1;
}
@@ -1971,6 +2004,7 @@ Animation::Animation() {
step=0.1;
loop=false;
+ loop_interpolation=true;
length=1;
}
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index 1f2d9b80ab..8b677fe0da 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -58,6 +58,13 @@ public:
INTERPOLATION_CUBIC
};
+ enum UpdateMode {
+ UPDATE_CONTINUOUS,
+ UPDATE_DISCRETE,
+ UPDATE_TRIGGER,
+
+ };
+
private:
struct Track {
@@ -105,10 +112,11 @@ private:
struct ValueTrack : public Track {
- bool continuous;
+ UpdateMode update_mode;
+ bool update_on_seek;
Vector< TKey<Variant> > values;
- ValueTrack() { type=TYPE_VALUE; continuous=true; }
+ ValueTrack() { type=TYPE_VALUE; update_mode=UPDATE_CONTINUOUS; }
};
@@ -163,6 +171,7 @@ private:
float length;
float step;
bool loop;
+ bool loop_interpolation;
// bind helpers
private:
@@ -253,8 +262,9 @@ public:
Variant value_track_interpolate(int p_track, float p_time) const;
void value_track_get_key_indices(int p_track, float p_time, float p_delta,List<int> *p_indices) const;
- void value_track_set_continuous(int p_track, bool p_continuous);
- bool value_track_is_continuous(int p_track) const;
+ void value_track_set_update_mode(int p_track, UpdateMode p_mode);
+ UpdateMode value_track_get_update_mode(int p_track) const;
+
void method_track_get_key_indices(int p_track, float p_time, float p_delta,List<int> *p_indices) const;
Vector<Variant> method_track_get_params(int p_track,int p_key_idx) const;
@@ -265,7 +275,9 @@ public:
float get_length() const;
void set_loop(bool p_enabled);
+ void set_loop_interpolation(bool p_enabled);
bool has_loop() const;
+ bool has_loop_interpolation() const;
void set_step(float p_step);
float get_step() const;
@@ -281,5 +293,8 @@ public:
VARIANT_ENUM_CAST( Animation::TrackType );
VARIANT_ENUM_CAST( Animation::InterpolationType );
+VARIANT_ENUM_CAST( Animation::UpdateMode );
+
+
#endif
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 3503d3bdb1..bb40c5ed93 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -66,11 +66,22 @@ void DynamicFontData::set_font_path(const String& p_path) {
font_path=p_path;
}
+String DynamicFontData::get_font_path() const {
+ return font_path;
+}
+
void DynamicFontData::set_force_autohinter(bool p_force) {
force_autohinter=p_force;
}
+void DynamicFontData::_bind_methods() {
+ ObjectTypeDB::bind_method(_MD("set_font_path","path"),&DynamicFontData::set_font_path);
+ ObjectTypeDB::bind_method(_MD("get_font_path"),&DynamicFontData::get_font_path);
+
+ ADD_PROPERTY(PropertyInfo(Variant::STRING,"font_path",PROPERTY_HINT_FILE,"*.ttf,*.otf"),_SCS("set_font_path"),_SCS("get_font_path"));
+}
+
DynamicFontData::DynamicFontData()
{
@@ -544,7 +555,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
if (tex.texture.is_null()) {
tex.texture.instance();
- tex.texture->create_from_image(img,0/*Texture::FLAG_FILTER*/);
+ tex.texture->create_from_image(img,Texture::FLAG_VIDEO_SURFACE);
} else {
tex.texture->set_data(img); //update
}
diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h
index 87a59abf06..508d630218 100644
--- a/scene/resources/dynamic_font.h
+++ b/scene/resources/dynamic_font.h
@@ -60,10 +60,14 @@ friend class DynamicFont;
Ref<DynamicFontAtSize> _get_dynamic_font_at_size(int p_size);
+protected:
+
+ static void _bind_methods();
public:
void set_font_ptr(const uint8_t* p_font_mem,int p_font_mem_size);
void set_font_path(const String& p_path);
+ String get_font_path() const;
void set_force_autohinter(bool p_force);
DynamicFontData();
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index e6356d3366..a1a1f0a935 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -149,12 +149,6 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) {
return true;
}
- if (what=="custom_aabb") {
-
- surface_set_custom_aabb(idx,p_value);
- return true;
- }
-
return false;
}