From 2060e6616cb39362cddc3c57a94292896f9f4525 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Wed, 4 May 2016 15:04:12 +0200 Subject: [PATCH 1/2] Add missing Vector2Array case to Variant::operator String() - Correcly display Vector2Array default arguments in the documentation --- core/variant.cpp | 12 ++++++++++++ tools/doc/doc_data.cpp | 1 + 2 files changed, 13 insertions(+) diff --git a/core/variant.cpp b/core/variant.cpp index 527a0d238f4..ea5a378ad04 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -1556,6 +1556,18 @@ Variant::operator String() const { return str; } break; + case VECTOR2_ARRAY: { + + DVector vec = operator DVector(); + String str; + for(int i=0;i0) + str+=", "; + str=str+Variant( vec[i] ); + } + return str; + } break; case VECTOR3_ARRAY: { DVector vec = operator DVector(); diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp index 2d0d7617c2f..0bf69c1cdd3 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/doc/doc_data.cpp @@ -267,6 +267,7 @@ void DocData::generate(bool p_basic_types) { case Variant::INT_ARRAY: case Variant::REAL_ARRAY: case Variant::STRING_ARRAY: //25 + case Variant::VECTOR2_ARRAY: case Variant::VECTOR3_ARRAY: case Variant::COLOR_ARRAY: default_arg_text=Variant::get_type_name(default_arg.get_type())+"("+default_arg_text+")"; From 1e752c01203b2560ef3ed28993aac9c98c053cb8 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Wed, 4 May 2016 15:15:51 +0200 Subject: [PATCH 2/2] Fix wrong return and argument types in documentation --- scene/2d/canvas_item.cpp | 6 +++--- scene/3d/spatial_stream_player.cpp | 4 ++-- scene/gui/item_list.cpp | 2 +- scene/gui/tree.cpp | 2 +- scene/gui/video_player.cpp | 4 ++-- scene/main/canvas_layer.cpp | 2 +- scene/main/node.cpp | 2 +- scene/resources/surface_tool.cpp | 2 +- servers/physics_2d_server.cpp | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 483feea5c40..21615b7f552 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -1085,9 +1085,9 @@ void CanvasItem::_bind_methods() { ObjectTypeDB::bind_method(_MD("draw_texture_rect","texture:Texture","rect","tile","modulate","transpose"),&CanvasItem::draw_texture_rect,DEFVAL(Color(1,1,1)),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("draw_texture_rect_region","texture:Texture","rect","src_rect","modulate","transpose"),&CanvasItem::draw_texture_rect_region,DEFVAL(Color(1,1,1)),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("draw_style_box","style_box:StyleBox","rect"),&CanvasItem::draw_style_box); - ObjectTypeDB::bind_method(_MD("draw_primitive","points","colors","uvs","texture:Texture","width"),&CanvasItem::draw_primitive,DEFVAL(Array()),DEFVAL(Ref()),DEFVAL(1.0)); - ObjectTypeDB::bind_method(_MD("draw_polygon","points","colors","uvs","texture:Texture"),&CanvasItem::draw_polygon,DEFVAL(Array()),DEFVAL(Ref())); - ObjectTypeDB::bind_method(_MD("draw_colored_polygon","points","color","uvs","texture:Texture"),&CanvasItem::draw_colored_polygon,DEFVAL(Array()),DEFVAL(Ref())); + ObjectTypeDB::bind_method(_MD("draw_primitive","points","colors","uvs","texture:Texture","width"),&CanvasItem::draw_primitive,DEFVAL(Variant()),DEFVAL(1.0)); + ObjectTypeDB::bind_method(_MD("draw_polygon","points","colors","uvs","texture:Texture"),&CanvasItem::draw_polygon,DEFVAL(Vector2Array()),DEFVAL(Variant())); + ObjectTypeDB::bind_method(_MD("draw_colored_polygon","points","color","uvs","texture:Texture"),&CanvasItem::draw_colored_polygon,DEFVAL(Vector2Array()),DEFVAL(Variant())); ObjectTypeDB::bind_method(_MD("draw_string","font:Font","pos","text","modulate","clip_w"),&CanvasItem::draw_string,DEFVAL(Color(1,1,1)),DEFVAL(-1)); ObjectTypeDB::bind_method(_MD("draw_char","font:Font","pos","char","next","modulate"),&CanvasItem::draw_char,DEFVAL(Color(1,1,1))); diff --git a/scene/3d/spatial_stream_player.cpp b/scene/3d/spatial_stream_player.cpp index dfef0faf4bd..11debb9bce1 100644 --- a/scene/3d/spatial_stream_player.cpp +++ b/scene/3d/spatial_stream_player.cpp @@ -329,8 +329,8 @@ int SpatialStreamPlayer::get_buffering_msec() const{ void SpatialStreamPlayer::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_stream","stream:Stream"),&SpatialStreamPlayer::set_stream); - ObjectTypeDB::bind_method(_MD("get_stream:Stream"),&SpatialStreamPlayer::get_stream); + ObjectTypeDB::bind_method(_MD("set_stream","stream:AudioStream"),&SpatialStreamPlayer::set_stream); + ObjectTypeDB::bind_method(_MD("get_stream:AudioStream"),&SpatialStreamPlayer::get_stream); ObjectTypeDB::bind_method(_MD("play","offset"),&SpatialStreamPlayer::play,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("stop"),&SpatialStreamPlayer::stop); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 171dd94bfae..4bf9d96c5ab 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1093,7 +1093,7 @@ int ItemList::find_metadata(const Variant& p_metadata) const { void ItemList::_bind_methods(){ - ObjectTypeDB::bind_method(_MD("add_item","text","icon:Texture","selectable"),&ItemList::add_item,DEFVAL(Ref()),DEFVAL(true)); + ObjectTypeDB::bind_method(_MD("add_item","text","icon:Texture","selectable"),&ItemList::add_item,DEFVAL(Variant()),DEFVAL(true)); ObjectTypeDB::bind_method(_MD("add_icon_item","icon:Texture","selectable"),&ItemList::add_icon_item,DEFVAL(true)); ObjectTypeDB::bind_method(_MD("set_item_text","idx","text"),&ItemList::set_item_text); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 278e6584fa4..c4efe82eaa3 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3252,7 +3252,7 @@ void Tree::_bind_methods() { ObjectTypeDB::bind_method(_MD("_scroll_moved"),&Tree::_scroll_moved); ObjectTypeDB::bind_method(_MD("clear"),&Tree::clear); - ObjectTypeDB::bind_method(_MD("create_item:TreeItem","parent:TreeItem"),&Tree::_create_item,DEFVAL((Object*)NULL)); + ObjectTypeDB::bind_method(_MD("create_item:TreeItem","parent:TreeItem"),&Tree::_create_item,DEFVAL(Variant())); ObjectTypeDB::bind_method(_MD("get_root:TreeItem"),&Tree::get_root); ObjectTypeDB::bind_method(_MD("set_column_min_width","column","min_width"),&Tree::set_column_min_width); diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index fc7cc0a3625..89dacc65776 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -360,8 +360,8 @@ bool VideoPlayer::has_autoplay() const { void VideoPlayer::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_stream","stream:Stream"),&VideoPlayer::set_stream); - ObjectTypeDB::bind_method(_MD("get_stream:Stream"),&VideoPlayer::get_stream); + ObjectTypeDB::bind_method(_MD("set_stream","stream:VideoStream"),&VideoPlayer::set_stream); + ObjectTypeDB::bind_method(_MD("get_stream:VideoStream"),&VideoPlayer::get_stream); ObjectTypeDB::bind_method(_MD("play"),&VideoPlayer::play); ObjectTypeDB::bind_method(_MD("stop"),&VideoPlayer::stop); diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index e921795628a..bc37cde4a27 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -225,7 +225,7 @@ void CanvasLayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_scale","scale"),&CanvasLayer::set_scale); ObjectTypeDB::bind_method(_MD("get_scale"),&CanvasLayer::get_scale); - ObjectTypeDB::bind_method(_MD("get_world_2d:Canvas"),&CanvasLayer::get_world_2d); + ObjectTypeDB::bind_method(_MD("get_world_2d:World2D"),&CanvasLayer::get_world_2d); ObjectTypeDB::bind_method(_MD("get_viewport"),&CanvasLayer::get_viewport); ADD_PROPERTY( PropertyInfo(Variant::INT,"layer",PROPERTY_HINT_RANGE,"-128,128,1"),_SCS("set_layer"),_SCS("get_layer") ); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index f4c41256db1..8475ca0b39e 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2022,7 +2022,7 @@ void Node::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_child:Node","idx"),&Node::get_child); ObjectTypeDB::bind_method(_MD("has_node","path"),&Node::has_node); ObjectTypeDB::bind_method(_MD("get_node:Node","path"),&Node::get_node); - ObjectTypeDB::bind_method(_MD("get_parent:Parent"),&Node::get_parent); + ObjectTypeDB::bind_method(_MD("get_parent:Node"),&Node::get_parent); ObjectTypeDB::bind_method(_MD("find_node:Node","mask","recursive","owned"),&Node::find_node,DEFVAL(true),DEFVAL(true)); ObjectTypeDB::bind_method(_MD("has_node_and_resource","path"),&Node::has_node_and_resource); ObjectTypeDB::bind_method(_MD("get_node_and_resource","path"),&Node::_get_node_and_resource); diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index de4bb4122d4..12382e66788 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -862,7 +862,7 @@ void SurfaceTool::_bind_methods() { ObjectTypeDB::bind_method(_MD("deindex"),&SurfaceTool::deindex); ///ObjectTypeDB::bind_method(_MD("generate_flat_normals"),&SurfaceTool::generate_flat_normals); ObjectTypeDB::bind_method(_MD("generate_normals"),&SurfaceTool::generate_normals); - ObjectTypeDB::bind_method(_MD("commit:Mesh","existing:Mesh"),&SurfaceTool::commit,DEFVAL( RefPtr() )); + ObjectTypeDB::bind_method(_MD("commit:Mesh","existing:Mesh"),&SurfaceTool::commit,DEFVAL(Variant())); ObjectTypeDB::bind_method(_MD("clear"),&SurfaceTool::clear); } diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index a85fefe5ada..411b99ebc86 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -630,7 +630,7 @@ void Physics2DServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("groove_joint_create","groove1_a","groove2_a","anchor_b","body_a","body_b"),&Physics2DServer::groove_joint_create,DEFVAL(RID()),DEFVAL(RID())); ObjectTypeDB::bind_method(_MD("damped_spring_joint_create","anchor_a","anchor_b","body_a","body_b"),&Physics2DServer::damped_spring_joint_create,DEFVAL(RID())); - ObjectTypeDB::bind_method(_MD("damped_string_joint_set_param","joint","param","value"),&Physics2DServer::damped_string_joint_set_param,DEFVAL(RID())); + ObjectTypeDB::bind_method(_MD("damped_string_joint_set_param","joint","param","value"),&Physics2DServer::damped_string_joint_set_param); ObjectTypeDB::bind_method(_MD("damped_string_joint_get_param","joint","param"),&Physics2DServer::damped_string_joint_get_param); ObjectTypeDB::bind_method(_MD("joint_get_type","joint"),&Physics2DServer::joint_get_type);