diff options
-rw-r--r-- | core/math/math_2d.cpp | 2 | ||||
-rw-r--r-- | core/math/math_2d.h | 8 | ||||
-rw-r--r-- | core/math/matrix3.cpp | 13 | ||||
-rw-r--r-- | core/math/quat.cpp | 2 | ||||
-rw-r--r-- | core/math/vector3.cpp | 2 | ||||
-rw-r--r-- | core/variant_parser.cpp | 4 | ||||
-rw-r--r-- | doc/base/classes.xml | 9 | ||||
-rw-r--r-- | tools/editor/project_settings.cpp | 33 |
8 files changed, 46 insertions, 27 deletions
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp index 0e2060008c..cf01e972a4 100644 --- a/core/math/math_2d.cpp +++ b/core/math/math_2d.cpp @@ -658,5 +658,5 @@ Matrix32 Matrix32::interpolate_with(const Matrix32& p_transform, float p_c) cons Matrix32::operator String() const { - return String(String()+elements[0]+", "+elements[1]+", "+elements[2]); + return "("+String(String()+elements[0]+", "+elements[1]+", "+elements[2])+")"; } diff --git a/core/math/math_2d.h b/core/math/math_2d.h index ad4655b8f7..5f511c933e 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -157,7 +157,7 @@ struct Vector2 { float get_aspect() const { return width/height; } - operator String() const { return String::num(x)+","+String::num(y); } + operator String() const { return "("+String::num(x)+", "+String::num(y)+")"; } _FORCE_INLINE_ Vector2(float p_x,float p_y) { x=p_x; y=p_y; } _FORCE_INLINE_ Vector2() { x=0; y=0; } @@ -356,7 +356,7 @@ struct Rect2 { } - operator String() const { return String(pos)+","+String(size); } + operator String() const { return "("+String(pos)+", "+String(size)+")"; } Rect2() {} Rect2( float p_x, float p_y, float p_width, float p_height) { pos=Point2(p_x,p_y); size=Size2( p_width, p_height ); } @@ -409,7 +409,7 @@ struct Point2i { float get_aspect() const { return width/(float)height; } - operator String() const { return String::num(x)+","+String::num(y); } + operator String() const { return "("+String::num(x)+", "+String::num(y)+")"; } operator Vector2() const { return Vector2(x,y); } inline Point2i(const Vector2& p_vec2) { x=(int)p_vec2.x; y=(int)p_vec2.y; } @@ -540,7 +540,7 @@ struct Rect2i { } - operator String() const { return String(pos)+","+String(size); } + operator String() const { return "("+String(pos)+", "+String(size)+")"; } operator Rect2() const { return Rect2(pos,size); } Rect2i(const Rect2& p_r2) { pos=p_r2.pos; size=p_r2.size; } diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp index 71e6b62212..7b811c245c 100644 --- a/core/math/matrix3.cpp +++ b/core/math/matrix3.cpp @@ -233,19 +233,26 @@ bool Matrix3::operator!=(const Matrix3& p_matrix) const { Matrix3::operator String() const { - String mtx; + String mtx("("); for (int i=0;i<3;i++) { + if (i!=0) + mtx+=", "; + + mtx+="("; + for (int j=0;j<3;j++) { - if (i!=0 || j!=0) + if (j!=0) mtx+=", "; mtx+=rtos( elements[i][j] ); } + + mtx+=")"; } - return mtx; + return mtx+")"; } Matrix3::operator Quat() const { diff --git a/core/math/quat.cpp b/core/math/quat.cpp index c6c12129b3..5457638ada 100644 --- a/core/math/quat.cpp +++ b/core/math/quat.cpp @@ -252,7 +252,7 @@ Quat Quat::cubic_slerp(const Quat& q, const Quat& prep, const Quat& postq,const Quat::operator String() const { - return String::num(x)+","+String::num(y)+","+ String::num(z)+","+ String::num(w); + return "("+String::num(x)+", "+String::num(y)+", "+ String::num(z)+", "+ String::num(w)+")"; } Quat::Quat(const Vector3& axis, const real_t& angle) { diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index 8afd73f482..8a0a6e963d 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -182,5 +182,5 @@ Vector3 Vector3::cubic_interpolate(const Vector3& p_b,const Vector3& p_pre_a, co # endif Vector3::operator String() const { - return (rtos(x)+", "+rtos(y)+", "+rtos(z)); + return "("+(rtos(x)+", "+rtos(y)+", "+rtos(z))+")"; } diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index dce873a306..023605a952 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -1233,7 +1233,9 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in } get_token(p_stream,token,line,r_err_str); - if (token.type!=TK_STRING) { + if (token.type==TK_PARENTHESIS_CLOSE) { + break; + } else if (token.type!=TK_STRING) { r_err_str="Expected string"; return ERR_PARSE_ERROR; } diff --git a/doc/base/classes.xml b/doc/base/classes.xml index d741dbbb65..dc24231dd0 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -4546,6 +4546,15 @@ Searches the array in reverse order for a value and returns its index or -1 if not found. </description> </method> + <method name="has"> + <return type="bool"> + </return> + <argument index="0" name="value" type="var"> + </argument> + <description> + Return true if the array contains given value. [code][ "inside", 7 ].has("inside") == true, [ "inside", 7 ].has("outside") == false, [ "inside", 7 ].has(7) == true, [ "inside", 7 ].has("7") == false[/code] + </description> + </method> <method name="hash"> <return type="int"> </return> diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 6be1abf52f..e8d22143ee 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -1375,34 +1375,35 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { input_base->set_area_as_parent_rect();; tab_container->add_child(input_base); + VBoxContainer *vbc = memnew( VBoxContainer ); + input_base->add_child(vbc); + vbc->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 5 ); + vbc->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 5 ); + vbc->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 ); + vbc->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 ); + l = memnew( Label ); - input_base->add_child(l); + vbc->add_child(l); l->set_pos(Point2(6,5)); l->set_text(TTR("Action:")); + hbc = memnew( HBoxContainer ); + vbc->add_child(hbc); + action_name = memnew( LineEdit ); - action_name->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); - action_name->set_begin( Point2(5,25) ); - action_name->set_end( Point2(0.85,26) ); - input_base->add_child(action_name); + action_name->set_h_size_flags(SIZE_EXPAND_FILL); + hbc->add_child(action_name); action_name->connect("text_entered",this,"_action_adds"); add = memnew( Button ); - input_base->add_child(add); - add->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); - add->set_begin( Point2(0.86,25) ); - add->set_anchor(MARGIN_RIGHT,ANCHOR_END); - add->set_end( Point2(5,26) ); + hbc->add_child(add); + add->set_custom_minimum_size(Size2(150, 0)); add->set_text(TTR("Add")); add->connect("pressed",this,"_action_add"); input_editor = memnew( Tree ); - input_base->add_child(input_editor); - input_editor->set_area_as_parent_rect(); - input_editor->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 55 ); - input_editor->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); - input_editor->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 ); - input_editor->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 ); + vbc->add_child(input_editor); + input_editor->set_v_size_flags(SIZE_EXPAND_FILL); input_editor->connect("item_edited",this,"_action_edited"); input_editor->connect("cell_selected",this,"_action_selected"); input_editor->connect("button_pressed",this,"_action_button_pressed"); |