diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/physics_body_2d.cpp | 16 | ||||
-rw-r--r-- | scene/2d/physics_body_2d.h | 5 | ||||
-rw-r--r-- | scene/3d/sprite_3d.cpp | 2 | ||||
-rw-r--r-- | scene/animation/tween.cpp | 216 | ||||
-rw-r--r-- | scene/animation/tween.h | 21 | ||||
-rw-r--r-- | scene/gui/file_dialog.cpp | 1 | ||||
-rw-r--r-- | scene/gui/label.cpp | 88 | ||||
-rw-r--r-- | scene/gui/label.h | 3 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 4 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 9 | ||||
-rw-r--r-- | scene/main/node.h | 1 | ||||
-rw-r--r-- | scene/resources/animation.cpp | 4 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 2 | ||||
-rw-r--r-- | scene/resources/shader_graph.cpp | 4 | ||||
-rw-r--r-- | scene/resources/theme.cpp | 18 |
15 files changed, 335 insertions, 59 deletions
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 6fb798714f..9fd4a25e7f 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -925,6 +925,19 @@ Variant KinematicBody2D::_get_collider() const { return obj; } +void KinematicBody2D::revert_motion() { + + Matrix32 gt = get_global_transform(); + gt.elements[2]-=travel; + travel=Vector2(); + set_global_transform(gt); + +} + +Vector2 KinematicBody2D::get_travel() const { + + return travel; +} Vector2 KinematicBody2D::move(const Vector2& p_motion) { @@ -942,6 +955,7 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) { Matrix32 gt = get_global_transform(); gt.elements[2]+=result.motion; set_global_transform(gt); + travel=result.motion; return result.remainder; #else @@ -1173,6 +1187,8 @@ void KinematicBody2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("move_to","position"),&KinematicBody2D::move_to); ObjectTypeDB::bind_method(_MD("test_move","rel_vec"),&KinematicBody2D::test_move); + ObjectTypeDB::bind_method(_MD("get_travel"),&KinematicBody2D::get_travel); + ObjectTypeDB::bind_method(_MD("revert_motion"),&KinematicBody2D::revert_motion); ObjectTypeDB::bind_method(_MD("is_colliding"),&KinematicBody2D::is_colliding); diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index 3cb94b95da..b6be07500f 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -280,6 +280,7 @@ class KinematicBody2D : public PhysicsBody2D { ObjectID collider; int collider_shape; Variant collider_metadata; + Vector2 travel; Variant _get_collider() const; @@ -294,6 +295,10 @@ public: bool test_move(const Vector2& p_motion); bool is_colliding() const; + + Vector2 get_travel() const; + void revert_motion(); + Vector2 get_collision_pos() const; Vector2 get_collision_normal() const; Vector2 get_collider_velocity() const; diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 35f6523c6a..4952f742df 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -292,7 +292,7 @@ SpriteBase3D::SpriteBase3D() { parent_sprite=NULL; pI=NULL; - for(int i=0;i<4;i++) + for(int i=0;i<FLAG_MAX;i++) flags[i]=i==FLAG_TRANSPARENT; axis=Vector3::AXIS_Z; diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index a7a4129a5f..73d93e50ec 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -29,6 +29,81 @@ #include "tween.h" #include "method_bind_ext.inc" +void Tween::_add_pending_command(StringName p_key + ,const Variant& p_arg1 ,const Variant& p_arg2 ,const Variant& p_arg3 ,const Variant& p_arg4 ,const Variant& p_arg5 + ,const Variant& p_arg6 ,const Variant& p_arg7 ,const Variant& p_arg8 ,const Variant& p_arg9 ,const Variant& p_arg10 +) { + + pending_commands.push_back(PendingCommand()); + PendingCommand& cmd = pending_commands.back()->get(); + + cmd.key = p_key; + int& count = cmd.args; + if(p_arg10.get_type() != Variant::NIL) + count = 10; + else if(p_arg9.get_type() != Variant::NIL) + count = 9; + else if(p_arg8.get_type() != Variant::NIL) + count = 8; + else if(p_arg7.get_type() != Variant::NIL) + count = 7; + else if(p_arg6.get_type() != Variant::NIL) + count = 6; + else if(p_arg5.get_type() != Variant::NIL) + count = 5; + else if(p_arg4.get_type() != Variant::NIL) + count = 4; + else if(p_arg3.get_type() != Variant::NIL) + count = 3; + else if(p_arg2.get_type() != Variant::NIL) + count = 2; + else if(p_arg1.get_type() != Variant::NIL) + count = 1; + if(count > 0) + cmd.arg[0] = p_arg1; + if(count > 1) + cmd.arg[1] = p_arg2; + if(count > 2) + cmd.arg[2] = p_arg3; + if(count > 3) + cmd.arg[3] = p_arg4; + if(count > 4) + cmd.arg[4] = p_arg5; + if(count > 5) + cmd.arg[5] = p_arg6; + if(count > 6) + cmd.arg[6] = p_arg7; + if(count > 7) + cmd.arg[7] = p_arg8; + if(count > 8) + cmd.arg[8] = p_arg9; + if(count > 9) + cmd.arg[9] = p_arg10; +} + +void Tween::_process_pending_commands() { + + for(List<PendingCommand>::Element *E=pending_commands.front();E;E=E->next()) { + + PendingCommand& cmd = E->get(); + Variant::CallError err; + Variant *arg[10] = { + &cmd.arg[0], + &cmd.arg[1], + &cmd.arg[2], + &cmd.arg[3], + &cmd.arg[4], + &cmd.arg[5], + &cmd.arg[6], + &cmd.arg[7], + &cmd.arg[8], + &cmd.arg[9], + }; + this->call(cmd.key, (const Variant **) arg, cmd.args, err); + } + pending_commands.clear(); +} + bool Tween::_set(const StringName& p_name, const Variant& p_value) { String name=p_name; @@ -456,6 +531,8 @@ bool Tween::_apply_tween_value(InterpolateData& p_data, Variant& value) { void Tween::_tween_process(float p_delta) { + _process_pending_commands(); + if (speed_scale == 0) return; p_delta *= speed_scale; @@ -551,8 +628,12 @@ void Tween::_tween_process(float p_delta) { _apply_tween_value(data, result); - if(data.finish) + if (data.finish) { emit_signal("tween_complete",object,data.key); + // not repeat mode, remove completed action + if (!repeat) + call_deferred("remove", object, data.key); + } } pending_update --; } @@ -734,7 +815,10 @@ bool Tween::resume_all() { bool Tween::remove(Object *p_object, String p_key) { - ERR_FAIL_COND_V(pending_update != 0, false); + if(pending_update != 0) { + call_deferred("remove", p_object, p_key); + return true; + } for(List<InterpolateData>::Element *E=interpolates.front();E;E=E->next()) { InterpolateData& data = E->get(); @@ -751,7 +835,10 @@ bool Tween::remove(Object *p_object, String p_key) { bool Tween::remove_all() { - ERR_FAIL_COND_V(pending_update != 0, false); + if(pending_update != 0) { + call_deferred("remove_all"); + return true; + } set_active(false); _set_process(false); interpolates.clear(); @@ -940,7 +1027,19 @@ bool Tween::interpolate_property(Object *p_object , EaseType p_ease_type , real_t p_delay ) { - ERR_FAIL_COND_V(pending_update != 0, false); + if(pending_update != 0) { + _add_pending_command("interpolate_property" + , p_object + , p_property + , p_initial_val + , p_final_val + , p_times_in_sec + , p_trans_type + , p_ease_type + , p_delay + ); + return true; + } // convert INT to REAL is better for interpolaters if(p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); if(p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); @@ -987,7 +1086,19 @@ bool Tween::interpolate_method(Object *p_object , EaseType p_ease_type , real_t p_delay ) { - ERR_FAIL_COND_V(pending_update != 0, false); + if(pending_update != 0) { + _add_pending_command("interpolate_method" + , p_object + , p_method + , p_initial_val + , p_final_val + , p_times_in_sec + , p_trans_type + , p_ease_type + , p_delay + ); + return true; + } // convert INT to REAL is better for interpolaters if(p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); if(p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); @@ -999,6 +1110,7 @@ bool Tween::interpolate_method(Object *p_object ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); ERR_FAIL_COND_V(p_delay < 0, false); + ERR_EXPLAIN("Object has no method named: %s" + p_method); ERR_FAIL_COND_V(!p_object->has_method(p_method), false); InterpolateData data; @@ -1029,10 +1141,23 @@ bool Tween::interpolate_callback(Object *p_object , VARIANT_ARG_DECLARE ) { - ERR_FAIL_COND_V(pending_update != 0, false); + if(pending_update != 0) { + _add_pending_command("interpolate_callback" + , p_object + , p_times_in_sec + , p_callback + , p_arg1 + , p_arg2 + , p_arg3 + , p_arg4 + , p_arg5 + ); + return true; + } ERR_FAIL_COND_V(p_object == NULL, false); ERR_FAIL_COND_V(p_times_in_sec < 0, false); + ERR_EXPLAIN("Object has no callback named: %s" + p_callback); ERR_FAIL_COND_V(!p_object->has_method(p_callback), false); InterpolateData data; @@ -1080,10 +1205,23 @@ bool Tween::interpolate_deferred_callback(Object *p_object , VARIANT_ARG_DECLARE ) { - ERR_FAIL_COND_V(pending_update != 0, false); + if(pending_update != 0) { + _add_pending_command("interpolate_deferred_callback" + , p_object + , p_times_in_sec + , p_callback + , p_arg1 + , p_arg2 + , p_arg3 + , p_arg4 + , p_arg5 + ); + return true; + } ERR_FAIL_COND_V(p_object == NULL, false); ERR_FAIL_COND_V(p_times_in_sec < 0, false); + ERR_EXPLAIN("Object has no callback named: %s" + p_callback); ERR_FAIL_COND_V(!p_object->has_method(p_callback), false); InterpolateData data; @@ -1135,7 +1273,20 @@ bool Tween::follow_property(Object *p_object , EaseType p_ease_type , real_t p_delay ) { - ERR_FAIL_COND_V(pending_update != 0, false); + if(pending_update != 0) { + _add_pending_command("follow_property" + , p_object + , p_property + , p_initial_val + , p_target + , p_target_property + , p_times_in_sec + , p_trans_type + , p_ease_type + , p_delay + ); + return true; + } // convert INT to REAL is better for interpolaters if(p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); @@ -1188,7 +1339,20 @@ bool Tween::follow_method(Object *p_object , EaseType p_ease_type , real_t p_delay ) { - ERR_FAIL_COND_V(pending_update != 0, false); + if(pending_update != 0) { + _add_pending_command("follow_method" + , p_object + , p_method + , p_initial_val + , p_target + , p_target_method + , p_times_in_sec + , p_trans_type + , p_ease_type + , p_delay + ); + return true; + } // convert INT to REAL is better for interpolaters if(p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); @@ -1199,7 +1363,9 @@ bool Tween::follow_method(Object *p_object ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); ERR_FAIL_COND_V(p_delay < 0, false); + ERR_EXPLAIN("Object has no method named: %s" + p_method); ERR_FAIL_COND_V(!p_object->has_method(p_method), false); + ERR_EXPLAIN("Target has no method named: %s" + p_target_method); ERR_FAIL_COND_V(!p_target->has_method(p_target_method), false); Variant::CallError error; @@ -1240,7 +1406,20 @@ bool Tween::targeting_property(Object *p_object , EaseType p_ease_type , real_t p_delay ) { - ERR_FAIL_COND_V(pending_update != 0, false); + if(pending_update != 0) { + _add_pending_command("targeting_property" + , p_object + , p_property + , p_initial + , p_initial_property + , p_final_val + , p_times_in_sec + , p_trans_type + , p_ease_type + , p_delay + ); + return true; + } // convert INT to REAL is better for interpolaters if(p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); @@ -1298,7 +1477,20 @@ bool Tween::targeting_method(Object *p_object , EaseType p_ease_type , real_t p_delay ) { - ERR_FAIL_COND_V(pending_update != 0, false); + if(pending_update != 0) { + _add_pending_command("targeting_method" + , p_object + , p_method + , p_initial + , p_initial_method + , p_final_val + , p_times_in_sec + , p_trans_type + , p_ease_type + , p_delay + ); + return true; + } // convert INT to REAL is better for interpolaters if(p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); @@ -1309,7 +1501,9 @@ bool Tween::targeting_method(Object *p_object ERR_FAIL_COND_V(p_ease_type < 0 || p_ease_type >= EASE_COUNT, false); ERR_FAIL_COND_V(p_delay < 0, false); + ERR_EXPLAIN("Object has no method named: %s" + p_method); ERR_FAIL_COND_V(!p_object->has_method(p_method), false); + ERR_EXPLAIN("Initial Object has no method named: %s" + p_initial_method); ERR_FAIL_COND_V(!p_initial->has_method(p_initial_method), false); Variant::CallError error; diff --git a/scene/animation/tween.h b/scene/animation/tween.h index 76402bcd73..d504c63d8a 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -110,6 +110,27 @@ private: List<InterpolateData> interpolates; + struct PendingCommand { + StringName key; + int args; + Variant arg[10]; + }; + List<PendingCommand> pending_commands; + + void _add_pending_command(StringName p_key + ,const Variant& p_arg1=Variant() + ,const Variant& p_arg2=Variant() + ,const Variant& p_arg3=Variant() + ,const Variant& p_arg4=Variant() + ,const Variant& p_arg5=Variant() + ,const Variant& p_arg6=Variant() + ,const Variant& p_arg7=Variant() + ,const Variant& p_arg8=Variant() + ,const Variant& p_arg9=Variant() + ,const Variant& p_arg10=Variant() + ); + void _process_pending_commands(); + typedef real_t (*interpolater)(real_t t, real_t b, real_t c, real_t d); static interpolater interpolaters[TRANS_COUNT][EASE_COUNT]; diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 50ce657d2e..13cf87ac2b 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -92,7 +92,6 @@ void FileDialog::_file_entered(const String& p_file) { } void FileDialog::_save_confirm_pressed() { - String f=dir_access->get_current_dir().plus_file(file->get_text()); emit_signal("file_selected",f); hide(); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 6afff81fde..1751d335ee 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -99,7 +99,7 @@ void Label::_notification(int p_what) { int chars_total=0; int vbegin=0,vsep=0; - + if (lines_total && lines_total < lines_visible) { @@ -136,10 +136,9 @@ void Label::_notification(int p_what) { if (!wc) return; - + int c = 0; int line=0; while(wc) { - /* handle lines not meant to be drawn quickly */ if (line>line_to) break; @@ -170,8 +169,8 @@ void Label::_notification(int p_what) { while(to && to->char_pos>=0) { taken+=to->pixel_width; - if (to!=from) { - spaces++; + if (to!=from && to->space_count) { + spaces+=to->space_count; } to=to->next; } @@ -212,15 +211,15 @@ void Label::_notification(int p_what) { ERR_PRINT("BUG"); return; } - if (from!=wc) { + if (from->space_count) { /* spacing */ - x_ofs+=space_w; + x_ofs+=space_w*from->space_count; if (can_fill && align==ALIGN_FILL && spaces) { - + x_ofs+=int((size.width-(taken+space_w*spaces))/spaces); } - - + + } @@ -253,7 +252,7 @@ void Label::_notification(int p_what) { } for (int i=0;i<from->word_len;i++) { - + if (visible_chars < 0 || chars_total<visible_chars) { CharType c = text[i+pos]; CharType n = text[i+pos+1]; @@ -361,11 +360,12 @@ void Label::regenerate_word_cache() { int width=autowrap?get_size().width:get_longest_line_width(); Ref<Font> font = get_font("font"); - + int current_word_size=0; int word_pos=0; int line_width=0; - int last_width=0; + int space_count=0; + int space_width=font->get_char_size(' ').width; line_count=1; total_char_cache=0; @@ -374,16 +374,17 @@ void Label::regenerate_word_cache() { for (int i=0;i<text.size()+1;i++) { CharType current=i<text.length()?text[i]:' '; //always a space at the end, so the algo works - + if (uppercase) current=String::char_uppercase(current); + bool not_latin = current>=33 && (current < 65||current >90) && (current<97||current>122) && (current<48||current>57); bool insert_newline=false; - + int char_width; + if (current<33) { - + if (current_word_size>0) { - WordCache *wc = memnew( WordCache ); if (word_cache) { last->next=wc; @@ -391,14 +392,16 @@ void Label::regenerate_word_cache() { word_cache=wc; } last=wc; - + wc->pixel_width=current_word_size; wc->char_pos=word_pos; wc->word_len=i-word_pos; + wc->space_count = space_count; current_word_size=0; - + space_count=0; + } - + if (current=='\n') { insert_newline=true; @@ -408,26 +411,49 @@ void Label::regenerate_word_cache() { if (i<text.length() && text[i] == ' ') { total_char_cache--; // do not count spaces + if (line_width > 0 || last==NULL || last->char_pos!=WordCache::CHAR_WRAPLINE) { + space_count++; + line_width+=space_width; + }else { + space_count=0; + } } } else { - + // latin characters if (current_word_size==0) { - if (line_width>0) // add a space before the new word if a word existed before - line_width+=font->get_char_size(' ').width; word_pos=i; } - int char_width=font->get_char_size(current).width; + char_width=font->get_char_size(current).width; current_word_size+=char_width; line_width+=char_width; total_char_cache++; } - - if ((autowrap && line_width>=width && last_width<width) || insert_newline) { - + + if ((autowrap && line_width>=width && (last && last->char_pos >= 0 || not_latin)) || insert_newline) { + if (not_latin) { + if (current_word_size>0) { + WordCache *wc = memnew( WordCache ); + if (word_cache) { + last->next=wc; + } else { + word_cache=wc; + } + last=wc; + + wc->pixel_width=current_word_size-char_width; + wc->char_pos=word_pos; + wc->word_len=i-word_pos; + wc->space_count = space_count; + current_word_size=char_width; + space_count=0; + word_pos=i; + } + } + WordCache *wc = memnew( WordCache ); if (word_cache) { last->next=wc; @@ -435,18 +461,16 @@ void Label::regenerate_word_cache() { word_cache=wc; } last=wc; - + wc->pixel_width=0; wc->char_pos=insert_newline?WordCache::CHAR_NEWLINE:WordCache::CHAR_WRAPLINE; line_width=current_word_size; line_count++; + space_count=0; - } - last_width=line_width; - } //total_char_cache -= line_count + 1; // do not count new lines (including the first one) @@ -465,7 +489,7 @@ void Label::regenerate_word_cache() { set_max(line_count); word_cache_dirty=false; - + } diff --git a/scene/gui/label.h b/scene/gui/label.h index 3b0dddc1a3..81e3ab5676 100644 --- a/scene/gui/label.h +++ b/scene/gui/label.h @@ -75,8 +75,9 @@ private: int char_pos; // if -1, then newline int word_len; int pixel_width; + int space_count; WordCache *next; - WordCache() { char_pos=0; word_len=0; pixel_width=0; next=0; } + WordCache() { char_pos=0; word_len=0; pixel_width=0; next=0; space_count=0;} }; bool word_cache_dirty; diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 4be53839be..3489b02598 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -268,7 +268,9 @@ if (m_height > line_height) {\ } if (found_space) { - fw+=l.offset_caches[line]/l.space_caches[line]; + int ln = MIN(l.offset_caches.size()-1,line); + + fw+=l.offset_caches[ln]/l.space_caches[ln]; } } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 1e82432165..681c33652e 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -489,7 +489,7 @@ void TextEdit::_notification(int p_what) { CharType cc = text[i][j]; //ignore any brackets inside a string - if (cc== '"' | cc == '\'') { + if (cc== '"' || cc == '\'') { CharType quotation = cc; do { j++; @@ -560,7 +560,7 @@ void TextEdit::_notification(int p_what) { CharType cc = text[i][j]; //ignore any brackets inside a string - if (cc== '"' | cc == '\'') { + if (cc== '"' || cc == '\'') { CharType quotation = cc; do { j--; @@ -1249,7 +1249,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { } - if (!mb.doubleclick && (OS::get_singleton()->get_ticks_msec()-last_dblclk)<600) { + if (!mb.doubleclick && (OS::get_singleton()->get_ticks_msec()-last_dblclk)<600 && cursor.line==prev_line) { //tripleclick select line select(cursor.line,0,cursor.line,text[cursor.line].length()); last_dblclk=0; @@ -3494,6 +3494,9 @@ void TextEdit::set_line(int line, String new_text) return; _remove_text(line, 0, line, text[line].length()); _insert_text(line, 0, new_text); + if (cursor.line==line) { + cursor.column=MIN(cursor.column,new_text.length()); + } } void TextEdit::insert_at(const String &p_text, int at) diff --git a/scene/main/node.h b/scene/main/node.h index aeada3c5bb..4d0a84d347 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -170,6 +170,7 @@ public: NOTIFICATION_PROCESS = 17, NOTIFICATION_PARENTED=18, NOTIFICATION_UNPARENTED=19, + NOTIFICATION_INSTANCED=20, }; /* NODE/TREE */ diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 0f11a66703..095406dad9 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1216,8 +1216,8 @@ T Animation::_interpolate( const Vector< TKey<T> >& p_keys, float p_time, Inter if (p_ok) *p_ok=true; - - int next; + + int next=0; float c=0; // prepare for all cases of interpolation diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 9f36510739..a1cb1205e5 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -182,6 +182,8 @@ Node *PackedScene::instance(bool p_gen_edit_state) const { if (get_path()!="" && get_path().find("::")==-1) s->set_filename(get_path()); + + s->notification(Node::NOTIFICATION_INSTANCED); return ret_nodes[0]; } diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 131b0e193f..24d5978856 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -2160,7 +2160,7 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector<Str "floor($)", "round($)", "ceil($)", - "frac($)", + "fract($)", "min(max($,0),1)", "-($)", }; @@ -2378,7 +2378,7 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector<Str String name = p_node->param1; Vector3 dv=p_node->param2; - code +="uniform float "+name+"=vec3("+rtos(dv.x)+","+rtos(dv.y)+","+rtos(dv.z)+");\n"; + code +="uniform vec3 "+name+"=vec3("+rtos(dv.x)+","+rtos(dv.y)+","+rtos(dv.z)+");\n"; code += OUTNAME(p_node->id,0)+"="+name+";\n"; }break; case NODE_RGB_INPUT: { diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 8350bf8cc8..21bdb6c0ab 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -105,6 +105,9 @@ bool Theme::_get(const StringName& p_name,Variant &r_ret) const { void Theme::_get_property_list( List<PropertyInfo> *p_list) const { + + List<PropertyInfo> list; + const StringName *key=NULL; while((key=icon_map.next(key))) { @@ -113,7 +116,7 @@ void Theme::_get_property_list( List<PropertyInfo> *p_list) const { while((key2=icon_map[*key].next(key2))) { - p_list->push_back( PropertyInfo( Variant::OBJECT, String()+*key+"/icons/"+*key2, PROPERTY_HINT_RESOURCE_TYPE, "Texture" ) ); + list.push_back( PropertyInfo( Variant::OBJECT, String()+*key+"/icons/"+*key2, PROPERTY_HINT_RESOURCE_TYPE, "Texture" ) ); } } @@ -125,7 +128,7 @@ void Theme::_get_property_list( List<PropertyInfo> *p_list) const { while((key2=style_map[*key].next(key2))) { - p_list->push_back( PropertyInfo( Variant::OBJECT, String()+*key+"/styles/"+*key2, PROPERTY_HINT_RESOURCE_TYPE, "StyleBox" ) ); + list.push_back( PropertyInfo( Variant::OBJECT, String()+*key+"/styles/"+*key2, PROPERTY_HINT_RESOURCE_TYPE, "StyleBox" ) ); } } @@ -138,7 +141,7 @@ void Theme::_get_property_list( List<PropertyInfo> *p_list) const { while((key2=font_map[*key].next(key2))) { - p_list->push_back( PropertyInfo( Variant::OBJECT, String()+*key+"/fonts/"+*key2, PROPERTY_HINT_RESOURCE_TYPE, "Font" ) ); + list.push_back( PropertyInfo( Variant::OBJECT, String()+*key+"/fonts/"+*key2, PROPERTY_HINT_RESOURCE_TYPE, "Font" ) ); } } @@ -150,7 +153,7 @@ void Theme::_get_property_list( List<PropertyInfo> *p_list) const { while((key2=color_map[*key].next(key2))) { - p_list->push_back( PropertyInfo( Variant::COLOR, String()+*key+"/colors/"+*key2 ) ); + list.push_back( PropertyInfo( Variant::COLOR, String()+*key+"/colors/"+*key2 ) ); } } @@ -162,9 +165,14 @@ void Theme::_get_property_list( List<PropertyInfo> *p_list) const { while((key2=constant_map[*key].next(key2))) { - p_list->push_back( PropertyInfo( Variant::INT, String()+*key+"/constants/"+*key2 ) ); + list.push_back( PropertyInfo( Variant::INT, String()+*key+"/constants/"+*key2 ) ); } } + + list.sort(); + for(List<PropertyInfo>::Element *E=list.front();E;E=E->next()) { + p_list->push_back(E->get()); + } } |