diff options
Diffstat (limited to 'scene')
109 files changed, 1003 insertions, 626 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index b10ee85da5..366c3a8bd8 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -223,10 +223,10 @@ void SpriteFrames::_bind_methods() { ClassDB::bind_method(D_METHOD("set_animation_loop", "anim", "loop"), &SpriteFrames::set_animation_loop); ClassDB::bind_method(D_METHOD("get_animation_loop", "anim"), &SpriteFrames::get_animation_loop); - ClassDB::bind_method(D_METHOD("add_frame", "anim", "frame:Texture", "atpos"), &SpriteFrames::add_frame, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("add_frame", "anim", "frame", "atpos"), &SpriteFrames::add_frame, DEFVAL(-1)); ClassDB::bind_method(D_METHOD("get_frame_count", "anim"), &SpriteFrames::get_frame_count); - ClassDB::bind_method(D_METHOD("get_frame:Texture", "anim", "idx"), &SpriteFrames::get_frame); - ClassDB::bind_method(D_METHOD("set_frame", "anim", "idx", "txt:Texture"), &SpriteFrames::set_frame); + ClassDB::bind_method(D_METHOD("get_frame", "anim", "idx"), &SpriteFrames::get_frame); + ClassDB::bind_method(D_METHOD("set_frame", "anim", "idx", "txt"), &SpriteFrames::set_frame); ClassDB::bind_method(D_METHOD("remove_frame", "anim", "idx"), &SpriteFrames::remove_frame); ClassDB::bind_method(D_METHOD("clear", "anim"), &SpriteFrames::clear); ClassDB::bind_method(D_METHOD("clear_all"), &SpriteFrames::clear_all); @@ -617,8 +617,8 @@ String AnimatedSprite::get_configuration_warning() const { void AnimatedSprite::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames:SpriteFrames"), &AnimatedSprite::set_sprite_frames); - ClassDB::bind_method(D_METHOD("get_sprite_frames:SpriteFrames"), &AnimatedSprite::get_sprite_frames); + ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames"), &AnimatedSprite::set_sprite_frames); + ClassDB::bind_method(D_METHOD("get_sprite_frames"), &AnimatedSprite::get_sprite_frames); ClassDB::bind_method(D_METHOD("set_animation", "animation"), &AnimatedSprite::set_animation); ClassDB::bind_method(D_METHOD("get_animation"), &AnimatedSprite::get_animation); diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index cef473dcdf..1423a804ff 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -400,7 +400,7 @@ uint32_t AudioStreamPlayer2D::get_area_mask() const { void AudioStreamPlayer2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_stream", "stream:AudioStream"), &AudioStreamPlayer2D::set_stream); + ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer2D::set_stream); ClassDB::bind_method(D_METHOD("get_stream"), &AudioStreamPlayer2D::get_stream); ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer2D::set_volume_db); diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 93bfc6f705..b11c1dd642 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -679,8 +679,8 @@ void Camera2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_zoom", "zoom"), &Camera2D::set_zoom); ClassDB::bind_method(D_METHOD("get_zoom"), &Camera2D::get_zoom); - ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport:Viewport"), &Camera2D::set_custom_viewport); - ClassDB::bind_method(D_METHOD("get_custom_viewport:Viewport"), &Camera2D::get_custom_viewport); + ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport"), &Camera2D::set_custom_viewport); + ClassDB::bind_method(D_METHOD("get_custom_viewport"), &Camera2D::get_custom_viewport); ClassDB::bind_method(D_METHOD("set_follow_smoothing", "follow_smoothing"), &Camera2D::set_follow_smoothing); ClassDB::bind_method(D_METHOD("get_follow_smoothing"), &Camera2D::get_follow_smoothing); diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 40c25c8bf6..3d0b5047ae 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -939,7 +939,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_callback"), &CanvasItem::_update_callback); ClassDB::bind_method(D_METHOD("edit_set_state", "state"), &CanvasItem::edit_set_state); - ClassDB::bind_method(D_METHOD("edit_get_state:Variant"), &CanvasItem::edit_get_state); + ClassDB::bind_method(D_METHOD("edit_get_state"), &CanvasItem::edit_get_state); ClassDB::bind_method(D_METHOD("edit_set_rect", "rect"), &CanvasItem::edit_set_rect); ClassDB::bind_method(D_METHOD("edit_rotate", "degrees"), &CanvasItem::edit_rotate); @@ -980,15 +980,15 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("draw_polyline_colors", "points", "colors", "width", "antialiased"), &CanvasItem::draw_polyline_colors, DEFVAL(1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_rect", "rect", "color", "filled"), &CanvasItem::draw_rect, DEFVAL(true)); ClassDB::bind_method(D_METHOD("draw_circle", "pos", "radius", "color"), &CanvasItem::draw_circle); - ClassDB::bind_method(D_METHOD("draw_texture", "texture:Texture", "pos", "modulate", "normal_map:Texture"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_texture_rect", "texture:Texture", "rect", "tile", "modulate", "transpose", "normal_map:Texture"), &CanvasItem::draw_texture_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture:Texture", "rect", "src_rect", "modulate", "transpose", "normal_map:Texture", "clip_uv"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("draw_style_box", "style_box:StyleBox", "rect"), &CanvasItem::draw_style_box); - ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture:Texture", "width", "normal_map:Texture"), &CanvasItem::draw_primitive, DEFVAL(Variant()), DEFVAL(1.0), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture:Texture", "normal_map:Texture"), &CanvasItem::draw_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture:Texture", "normal_map:Texture"), &CanvasItem::draw_colored_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_string", "font:Font", "pos", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1)), DEFVAL(-1)); - ClassDB::bind_method(D_METHOD("draw_char", "font:Font", "pos", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1))); + ClassDB::bind_method(D_METHOD("draw_texture", "texture", "pos", "modulate", "normal_map"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_texture_rect", "texture", "rect", "tile", "modulate", "transpose", "normal_map"), &CanvasItem::draw_texture_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("draw_style_box", "style_box", "rect"), &CanvasItem::draw_style_box); + ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture", "width", "normal_map"), &CanvasItem::draw_primitive, DEFVAL(Variant()), DEFVAL(1.0), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture", "normal_map"), &CanvasItem::draw_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture", "normal_map"), &CanvasItem::draw_colored_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_string", "font", "pos", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1)), DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("draw_char", "font", "pos", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1))); ClassDB::bind_method(D_METHOD("draw_set_transform", "pos", "rot", "scale"), &CanvasItem::draw_set_transform); ClassDB::bind_method(D_METHOD("draw_set_transform_matrix", "xform"), &CanvasItem::draw_set_transform_matrix); @@ -1001,11 +1001,11 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("get_local_mouse_pos"), &CanvasItem::get_local_mouse_pos); ClassDB::bind_method(D_METHOD("get_global_mouse_position"), &CanvasItem::get_global_mouse_position); ClassDB::bind_method(D_METHOD("get_canvas"), &CanvasItem::get_canvas); - ClassDB::bind_method(D_METHOD("get_world_2d:World2D"), &CanvasItem::get_world_2d); + ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasItem::get_world_2d); //ClassDB::bind_method(D_METHOD("get_viewport"),&CanvasItem::get_viewport); - ClassDB::bind_method(D_METHOD("set_material", "material:Material"), &CanvasItem::set_material); - ClassDB::bind_method(D_METHOD("get_material:Material"), &CanvasItem::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &CanvasItem::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &CanvasItem::get_material); ClassDB::bind_method(D_METHOD("set_use_parent_material", "enable"), &CanvasItem::set_use_parent_material); ClassDB::bind_method(D_METHOD("get_use_parent_material"), &CanvasItem::get_use_parent_material); @@ -1018,7 +1018,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("make_canvas_pos_local", "screen_point"), &CanvasItem::make_canvas_pos_local); - ClassDB::bind_method(D_METHOD("make_input_local:InputEvent", "event:InputEvent"), &CanvasItem::make_input_local); + ClassDB::bind_method(D_METHOD("make_input_local", "event"), &CanvasItem::make_input_local); BIND_VMETHOD(MethodInfo("_draw")); diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 45f956ea97..d3bb5a8d4e 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -333,17 +333,17 @@ void CollisionObject2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pickable", "enabled"), &CollisionObject2D::set_pickable); ClassDB::bind_method(D_METHOD("is_pickable"), &CollisionObject2D::is_pickable); - ClassDB::bind_method(D_METHOD("create_shape_owner", "owner:Object"), &CollisionObject2D::create_shape_owner); + ClassDB::bind_method(D_METHOD("create_shape_owner", "owner"), &CollisionObject2D::create_shape_owner); ClassDB::bind_method(D_METHOD("remove_shape_owner", "owner_id"), &CollisionObject2D::remove_shape_owner); ClassDB::bind_method(D_METHOD("get_shape_owners"), &CollisionObject2D::_get_shape_owners); - ClassDB::bind_method(D_METHOD("shape_owner_set_transform", "owner_id", "transform:Transform2D"), &CollisionObject2D::shape_owner_set_transform); + ClassDB::bind_method(D_METHOD("shape_owner_set_transform", "owner_id", "transform"), &CollisionObject2D::shape_owner_set_transform); ClassDB::bind_method(D_METHOD("shape_owner_get_transform", "owner_id"), &CollisionObject2D::shape_owner_get_transform); ClassDB::bind_method(D_METHOD("shape_owner_get_owner", "owner_id"), &CollisionObject2D::shape_owner_get_owner); ClassDB::bind_method(D_METHOD("shape_owner_set_disabled", "owner_id", "disabled"), &CollisionObject2D::shape_owner_set_disabled); ClassDB::bind_method(D_METHOD("is_shape_owner_disabled", "owner_id"), &CollisionObject2D::is_shape_owner_disabled); ClassDB::bind_method(D_METHOD("shape_owner_set_one_way_collision", "owner_id", "enable"), &CollisionObject2D::shape_owner_set_one_way_collision); ClassDB::bind_method(D_METHOD("is_shape_owner_one_way_collision_enabled", "owner_id"), &CollisionObject2D::is_shape_owner_one_way_collision_enabled); - ClassDB::bind_method(D_METHOD("shape_owner_add_shape", "owner_id", "shape:Shape2D"), &CollisionObject2D::shape_owner_add_shape); + ClassDB::bind_method(D_METHOD("shape_owner_add_shape", "owner_id", "shape"), &CollisionObject2D::shape_owner_add_shape); ClassDB::bind_method(D_METHOD("shape_owner_get_shape_count", "owner_id"), &CollisionObject2D::shape_owner_get_shape_count); ClassDB::bind_method(D_METHOD("shape_owner_get_shape", "owner_id", "shape_id"), &CollisionObject2D::shape_owner_get_shape); ClassDB::bind_method(D_METHOD("shape_owner_get_shape_index", "owner_id", "shape_id"), &CollisionObject2D::shape_owner_get_shape_index); diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index 890ac0c1f3..ff4aa245ec 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -201,8 +201,8 @@ bool CollisionShape2D::is_one_way_collision_enabled() const { void CollisionShape2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shape", "shape:Shape2D"), &CollisionShape2D::set_shape); - ClassDB::bind_method(D_METHOD("get_shape:Shape2D"), &CollisionShape2D::get_shape); + ClassDB::bind_method(D_METHOD("set_shape", "shape"), &CollisionShape2D::set_shape); + ClassDB::bind_method(D_METHOD("get_shape"), &CollisionShape2D::get_shape); ClassDB::bind_method(D_METHOD("set_disabled", "disabled"), &CollisionShape2D::set_disabled); ClassDB::bind_method(D_METHOD("is_disabled"), &CollisionShape2D::is_disabled); ClassDB::bind_method(D_METHOD("set_one_way_collision", "enabled"), &CollisionShape2D::set_one_way_collision); diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index 044cb06c02..ffe69fa93f 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -355,8 +355,8 @@ void Light2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_editor_only", "editor_only"), &Light2D::set_editor_only); ClassDB::bind_method(D_METHOD("is_editor_only"), &Light2D::is_editor_only); - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Light2D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Light2D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Light2D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Light2D::get_texture); ClassDB::bind_method(D_METHOD("set_texture_offset", "texture_offset"), &Light2D::set_texture_offset); ClassDB::bind_method(D_METHOD("get_texture_offset"), &Light2D::get_texture_offset); @@ -416,7 +416,7 @@ void Light2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "is_editor_only"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_texture_offset", "get_texture_offset"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "scale", PROPERTY_HINT_RANGE, "0.01,50,0.01"), "set_texture_scale", "get_texture_scale"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_scale", PROPERTY_HINT_RANGE, "0.01,50,0.01"), "set_texture_scale", "get_texture_scale"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0.01,100,0.01"), "set_energy", "get_energy"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Add,Sub,Mix,Mask"), "set_mode", "get_mode"); diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index f1df2b0daf..a1a8e7d9c4 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -212,8 +212,8 @@ String LightOccluder2D::get_configuration_warning() const { void LightOccluder2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_occluder_polygon", "polygon:OccluderPolygon2D"), &LightOccluder2D::set_occluder_polygon); - ClassDB::bind_method(D_METHOD("get_occluder_polygon:OccluderPolygon2D"), &LightOccluder2D::get_occluder_polygon); + ClassDB::bind_method(D_METHOD("set_occluder_polygon", "polygon"), &LightOccluder2D::set_occluder_polygon); + ClassDB::bind_method(D_METHOD("get_occluder_polygon"), &LightOccluder2D::get_occluder_polygon); ClassDB::bind_method(D_METHOD("set_occluder_light_mask", "mask"), &LightOccluder2D::set_occluder_light_mask); ClassDB::bind_method(D_METHOD("get_occluder_light_mask"), &LightOccluder2D::get_occluder_light_mask); diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 22e54cfb54..5438557d0b 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -283,11 +283,11 @@ void Line2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_default_color", "color"), &Line2D::set_default_color); ClassDB::bind_method(D_METHOD("get_default_color"), &Line2D::get_default_color); - ClassDB::bind_method(D_METHOD("set_gradient", "color:Gradient"), &Line2D::set_gradient); - ClassDB::bind_method(D_METHOD("get_gradient:Gradient"), &Line2D::get_gradient); + ClassDB::bind_method(D_METHOD("set_gradient", "color"), &Line2D::set_gradient); + ClassDB::bind_method(D_METHOD("get_gradient"), &Line2D::get_gradient); - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Line2D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Line2D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Line2D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Line2D::get_texture); ClassDB::bind_method(D_METHOD("set_texture_mode", "mode"), &Line2D::set_texture_mode); ClassDB::bind_method(D_METHOD("get_texture_mode"), &Line2D::get_texture_mode); diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp index bfe5a359f7..e579838903 100644 --- a/scene/2d/navigation2d.cpp +++ b/scene/2d/navigation2d.cpp @@ -763,7 +763,7 @@ Object *Navigation2D::get_closest_point_owner(const Vector2 &p_point) { void Navigation2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("navpoly_create", "mesh:NavigationPolygon", "xform", "owner"), &Navigation2D::navpoly_create, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("navpoly_create", "mesh", "xform", "owner"), &Navigation2D::navpoly_create, DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("navpoly_set_transform", "id", "xform"), &Navigation2D::navpoly_set_transform); ClassDB::bind_method(D_METHOD("navpoly_remove", "id"), &Navigation2D::navpoly_remove); diff --git a/scene/2d/navigation2d.h b/scene/2d/navigation2d.h index e5d71f48c3..54e89de9e2 100644 --- a/scene/2d/navigation2d.h +++ b/scene/2d/navigation2d.h @@ -57,9 +57,9 @@ class Navigation2D : public Node2D { return (a.key == p_key.a.key) ? (b.key < p_key.b.key) : (a.key < p_key.a.key); }; - EdgeKey(const Point &p_a = Point(), const Point &p_b = Point()) { - a = p_a; - b = p_b; + EdgeKey(const Point &p_a = Point(), const Point &p_b = Point()) + : a(p_a), + b(p_b) { if (a.key > b.key) { SWAP(a, b); } diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 807f72e81f..779751c1c5 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -459,8 +459,8 @@ String NavigationPolygonInstance::get_configuration_warning() const { void NavigationPolygonInstance::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly:NavigationPolygon"), &NavigationPolygonInstance::set_navigation_polygon); - ClassDB::bind_method(D_METHOD("get_navigation_polygon:NavigationPolygon"), &NavigationPolygonInstance::get_navigation_polygon); + ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationPolygonInstance::set_navigation_polygon); + ClassDB::bind_method(D_METHOD("get_navigation_polygon"), &NavigationPolygonInstance::get_navigation_polygon); ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationPolygonInstance::set_enabled); ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationPolygonInstance::is_enabled); diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 82efe1d7fb..98d6a467b1 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -457,7 +457,7 @@ void Node2D::_bind_methods() { ClassDB::bind_method(D_METHOD("edit_set_pivot", "pivot"), &Node2D::edit_set_pivot); - ClassDB::bind_method(D_METHOD("get_relative_transform_to_parent", "parent:Node"), &Node2D::get_relative_transform_to_parent); + ClassDB::bind_method(D_METHOD("get_relative_transform_to_parent", "parent"), &Node2D::get_relative_transform_to_parent); ADD_GROUP("Transform", ""); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "position"), "set_position", "get_position"); diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index 572195b570..a2ec33f403 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -55,6 +55,8 @@ void Particles2D::set_one_shot(bool p_enable) { one_shot = p_enable; VS::get_singleton()->particles_set_one_shot(particles, one_shot); + if (!one_shot && emitting) + VisualServer::get_singleton()->particles_restart(particles); } void Particles2D::set_pre_process_time(float p_time) { @@ -327,7 +329,7 @@ void Particles2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &Particles2D::set_use_local_coordinates); ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &Particles2D::set_fixed_fps); ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &Particles2D::set_fractional_delta); - ClassDB::bind_method(D_METHOD("set_process_material", "material:Material"), &Particles2D::set_process_material); + ClassDB::bind_method(D_METHOD("set_process_material", "material"), &Particles2D::set_process_material); ClassDB::bind_method(D_METHOD("set_speed_scale", "scale"), &Particles2D::set_speed_scale); ClassDB::bind_method(D_METHOD("is_emitting"), &Particles2D::is_emitting); @@ -341,17 +343,17 @@ void Particles2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &Particles2D::get_use_local_coordinates); ClassDB::bind_method(D_METHOD("get_fixed_fps"), &Particles2D::get_fixed_fps); ClassDB::bind_method(D_METHOD("get_fractional_delta"), &Particles2D::get_fractional_delta); - ClassDB::bind_method(D_METHOD("get_process_material:Material"), &Particles2D::get_process_material); + ClassDB::bind_method(D_METHOD("get_process_material"), &Particles2D::get_process_material); ClassDB::bind_method(D_METHOD("get_speed_scale"), &Particles2D::get_speed_scale); ClassDB::bind_method(D_METHOD("set_draw_order", "order"), &Particles2D::set_draw_order); ClassDB::bind_method(D_METHOD("get_draw_order"), &Particles2D::get_draw_order); - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Particles2D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Particles2D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Particles2D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Particles2D::get_texture); - ClassDB::bind_method(D_METHOD("set_normal_map", "texture:Texture"), &Particles2D::set_normal_map); - ClassDB::bind_method(D_METHOD("get_normal_map:Texture"), &Particles2D::get_normal_map); + ClassDB::bind_method(D_METHOD("set_normal_map", "texture"), &Particles2D::set_normal_map); + ClassDB::bind_method(D_METHOD("get_normal_map"), &Particles2D::get_normal_map); ClassDB::bind_method(D_METHOD("capture_rect"), &Particles2D::capture_rect); diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 0b486bd821..6b30e97de8 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -82,8 +82,8 @@ Ref<Curve2D> Path2D::get_curve() const { void Path2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_curve", "curve:Curve2D"), &Path2D::set_curve); - ClassDB::bind_method(D_METHOD("get_curve:Curve2D", "curve"), &Path2D::get_curve); + ClassDB::bind_method(D_METHOD("set_curve", "curve"), &Path2D::set_curve); + ClassDB::bind_method(D_METHOD("get_curve"), &Path2D::get_curve); ClassDB::bind_method(D_METHOD("_curve_changed"), &Path2D::_curve_changed); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve2D"), "set_curve", "get_curve"); diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index d5527fc9ca..6ec1642138 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -70,8 +70,8 @@ void PhysicsBody2D::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_layers", "mask"), &PhysicsBody2D::_set_layers); ClassDB::bind_method(D_METHOD("_get_layers"), &PhysicsBody2D::_get_layers); - ClassDB::bind_method(D_METHOD("add_collision_exception_with", "body:PhysicsBody2D"), &PhysicsBody2D::add_collision_exception_with); - ClassDB::bind_method(D_METHOD("remove_collision_exception_with", "body:PhysicsBody2D"), &PhysicsBody2D::remove_collision_exception_with); + ClassDB::bind_method(D_METHOD("add_collision_exception_with", "body"), &PhysicsBody2D::add_collision_exception_with); + ClassDB::bind_method(D_METHOD("remove_collision_exception_with", "body"), &PhysicsBody2D::remove_collision_exception_with); ADD_PROPERTY(PropertyInfo(Variant::INT, "layers", PROPERTY_HINT_LAYERS_2D_PHYSICS, "", 0), "_set_layers", "_get_layers"); //for backwards compat ADD_GROUP("Collision", "collision_"); @@ -896,7 +896,7 @@ void RigidBody2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_can_sleep", "able_to_sleep"), &RigidBody2D::set_can_sleep); ClassDB::bind_method(D_METHOD("is_able_to_sleep"), &RigidBody2D::is_able_to_sleep); - ClassDB::bind_method(D_METHOD("test_motion", "motion", "margin", "result:Physics2DTestMotionResult"), &RigidBody2D::_test_motion, DEFVAL(0.08), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("test_motion", "motion", "margin", "result"), &RigidBody2D::_test_motion, DEFVAL(0.08), DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("_direct_state_changed"), &RigidBody2D::_direct_state_changed); ClassDB::bind_method(D_METHOD("_body_enter_tree"), &RigidBody2D::_body_enter_tree); @@ -982,11 +982,12 @@ Dictionary KinematicBody2D::_move(const Vector2 &p_motion) { if (move(p_motion, col)) { Dictionary d; d["position"] = col.collision; - d["normal"] = col.collision; + d["normal"] = col.normal; d["local_shape"] = col.local_shape; d["travel"] = col.travel; d["remainder"] = col.remainder; d["collider_id"] = col.collider; + d["collider_velocity"] = col.collider_vel; if (col.collider) { d["collider"] = ObjectDB::get_instance(col.collider); } else { @@ -1204,7 +1205,7 @@ void KinematicBody2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_floor_velocity"), &KinematicBody2D::get_floor_velocity); ClassDB::bind_method(D_METHOD("set_safe_margin", "pixels"), &KinematicBody2D::set_safe_margin); - ClassDB::bind_method(D_METHOD("get_safe_margin", "pixels"), &KinematicBody2D::get_safe_margin); + ClassDB::bind_method(D_METHOD("get_safe_margin"), &KinematicBody2D::get_safe_margin); ClassDB::bind_method(D_METHOD("get_collision_count"), &KinematicBody2D::get_collision_count); ClassDB::bind_method(D_METHOD("get_collision_position", "collision"), &KinematicBody2D::get_collision_position); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 4a68df5706..5c1c953a37 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -330,8 +330,8 @@ void Polygon2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_vertex_colors", "vertex_colors"), &Polygon2D::set_vertex_colors); ClassDB::bind_method(D_METHOD("get_vertex_colors"), &Polygon2D::get_vertex_colors); - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Polygon2D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Polygon2D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Polygon2D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Polygon2D::get_texture); ClassDB::bind_method(D_METHOD("set_texture_offset", "texture_offset"), &Polygon2D::set_texture_offset); ClassDB::bind_method(D_METHOD("get_texture_offset"), &Polygon2D::get_texture_offset); diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index 24c9137807..37139b2b93 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -356,17 +356,17 @@ bool TouchScreenButton::is_passby_press_enabled() const { void TouchScreenButton::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &TouchScreenButton::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &TouchScreenButton::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &TouchScreenButton::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &TouchScreenButton::get_texture); - ClassDB::bind_method(D_METHOD("set_texture_pressed", "texture_pressed:Texture"), &TouchScreenButton::set_texture_pressed); - ClassDB::bind_method(D_METHOD("get_texture_pressed:Texture"), &TouchScreenButton::get_texture_pressed); + ClassDB::bind_method(D_METHOD("set_texture_pressed", "texture_pressed"), &TouchScreenButton::set_texture_pressed); + ClassDB::bind_method(D_METHOD("get_texture_pressed"), &TouchScreenButton::get_texture_pressed); - ClassDB::bind_method(D_METHOD("set_bitmask", "bitmask:BitMap"), &TouchScreenButton::set_bitmask); - ClassDB::bind_method(D_METHOD("get_bitmask:BitMap"), &TouchScreenButton::get_bitmask); + ClassDB::bind_method(D_METHOD("set_bitmask", "bitmask"), &TouchScreenButton::set_bitmask); + ClassDB::bind_method(D_METHOD("get_bitmask"), &TouchScreenButton::get_bitmask); - ClassDB::bind_method(D_METHOD("set_shape", "shape:Shape2D"), &TouchScreenButton::set_shape); - ClassDB::bind_method(D_METHOD("get_shape:Shape2D"), &TouchScreenButton::get_shape); + ClassDB::bind_method(D_METHOD("set_shape", "shape"), &TouchScreenButton::set_shape); + ClassDB::bind_method(D_METHOD("get_shape"), &TouchScreenButton::get_shape); ClassDB::bind_method(D_METHOD("set_shape_centered", "bool"), &TouchScreenButton::set_shape_centered); ClassDB::bind_method(D_METHOD("is_shape_centered"), &TouchScreenButton::is_shape_centered); diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 01d101a89c..2ec529a166 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -298,11 +298,11 @@ void Sprite::_validate_property(PropertyInfo &property) const { void Sprite::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Sprite::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Sprite::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Sprite::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Sprite::get_texture); - ClassDB::bind_method(D_METHOD("set_normal_map", "normal_map:Texture"), &Sprite::set_normal_map); - ClassDB::bind_method(D_METHOD("get_normal_map:Texture"), &Sprite::get_normal_map); + ClassDB::bind_method(D_METHOD("set_normal_map", "normal_map"), &Sprite::set_normal_map); + ClassDB::bind_method(D_METHOD("get_normal_map"), &Sprite::get_normal_map); ClassDB::bind_method(D_METHOD("set_centered", "centered"), &Sprite::set_centered); ClassDB::bind_method(D_METHOD("is_centered"), &Sprite::is_centered); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index f8bf3edb99..e4494742a1 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1208,8 +1208,8 @@ void TileMap::set_light_mask(int p_light_mask) { void TileMap::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_tileset", "tileset:TileSet"), &TileMap::set_tileset); - ClassDB::bind_method(D_METHOD("get_tileset:TileSet"), &TileMap::get_tileset); + ClassDB::bind_method(D_METHOD("set_tileset", "tileset"), &TileMap::set_tileset); + ClassDB::bind_method(D_METHOD("get_tileset"), &TileMap::get_tileset); ClassDB::bind_method(D_METHOD("set_mode", "mode"), &TileMap::set_mode); ClassDB::bind_method(D_METHOD("get_mode"), &TileMap::get_mode); diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 87ea018425..6abc2caac8 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -807,7 +807,7 @@ AudioStreamPlayer3D::DopplerTracking AudioStreamPlayer3D::get_doppler_tracking() void AudioStreamPlayer3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_stream", "stream:AudioStream"), &AudioStreamPlayer3D::set_stream); + ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer3D::set_stream); ClassDB::bind_method(D_METHOD("get_stream"), &AudioStreamPlayer3D::get_stream); ClassDB::bind_method(D_METHOD("set_unit_db", "unit_db"), &AudioStreamPlayer3D::set_unit_db); diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 697d91c863..3c5eb21d38 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -556,8 +556,8 @@ void Camera::_bind_methods() { ClassDB::bind_method(D_METHOD("get_v_offset"), &Camera::get_v_offset); ClassDB::bind_method(D_METHOD("set_cull_mask", "mask"), &Camera::set_cull_mask); ClassDB::bind_method(D_METHOD("get_cull_mask"), &Camera::get_cull_mask); - ClassDB::bind_method(D_METHOD("set_environment", "env:Environment"), &Camera::set_environment); - ClassDB::bind_method(D_METHOD("get_environment:Environment"), &Camera::get_environment); + ClassDB::bind_method(D_METHOD("set_environment", "env"), &Camera::set_environment); + ClassDB::bind_method(D_METHOD("get_environment"), &Camera::get_environment); ClassDB::bind_method(D_METHOD("set_keep_aspect_mode", "mode"), &Camera::set_keep_aspect_mode); ClassDB::bind_method(D_METHOD("get_keep_aspect_mode"), &Camera::get_keep_aspect_mode); ClassDB::bind_method(D_METHOD("set_doppler_tracking", "mode"), &Camera::set_doppler_tracking); diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp index 2686cd81df..1aba26673c 100644 --- a/scene/3d/collision_object.cpp +++ b/scene/3d/collision_object.cpp @@ -128,15 +128,15 @@ void CollisionObject::_bind_methods() { ClassDB::bind_method(D_METHOD("set_capture_input_on_drag", "enable"), &CollisionObject::set_capture_input_on_drag); ClassDB::bind_method(D_METHOD("get_capture_input_on_drag"), &CollisionObject::get_capture_input_on_drag); ClassDB::bind_method(D_METHOD("get_rid"), &CollisionObject::get_rid); - ClassDB::bind_method(D_METHOD("create_shape_owner", "owner:Object"), &CollisionObject::create_shape_owner); + ClassDB::bind_method(D_METHOD("create_shape_owner", "owner"), &CollisionObject::create_shape_owner); ClassDB::bind_method(D_METHOD("remove_shape_owner", "owner_id"), &CollisionObject::remove_shape_owner); ClassDB::bind_method(D_METHOD("get_shape_owners"), &CollisionObject::_get_shape_owners); - ClassDB::bind_method(D_METHOD("shape_owner_set_transform", "owner_id", "transform:Transform"), &CollisionObject::shape_owner_set_transform); + ClassDB::bind_method(D_METHOD("shape_owner_set_transform", "owner_id", "transform"), &CollisionObject::shape_owner_set_transform); ClassDB::bind_method(D_METHOD("shape_owner_get_transform", "owner_id"), &CollisionObject::shape_owner_get_transform); ClassDB::bind_method(D_METHOD("shape_owner_get_owner", "owner_id"), &CollisionObject::shape_owner_get_owner); ClassDB::bind_method(D_METHOD("shape_owner_set_disabled", "owner_id", "disabled"), &CollisionObject::shape_owner_set_disabled); ClassDB::bind_method(D_METHOD("is_shape_owner_disabled", "owner_id"), &CollisionObject::is_shape_owner_disabled); - ClassDB::bind_method(D_METHOD("shape_owner_add_shape", "owner_id", "shape:Shape"), &CollisionObject::shape_owner_add_shape); + ClassDB::bind_method(D_METHOD("shape_owner_add_shape", "owner_id", "shape"), &CollisionObject::shape_owner_add_shape); ClassDB::bind_method(D_METHOD("shape_owner_get_shape_count", "owner_id"), &CollisionObject::shape_owner_get_shape_count); ClassDB::bind_method(D_METHOD("shape_owner_get_shape", "owner_id", "shape_id"), &CollisionObject::shape_owner_get_shape); ClassDB::bind_method(D_METHOD("shape_owner_get_shape_index", "owner_id", "shape_id"), &CollisionObject::shape_owner_get_shape_index); diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp index a7cfc6fef2..4fd215bd1a 100644 --- a/scene/3d/collision_shape.cpp +++ b/scene/3d/collision_shape.cpp @@ -127,9 +127,9 @@ String CollisionShape::get_configuration_warning() const { void CollisionShape::_bind_methods() { //not sure if this should do anything - ClassDB::bind_method(D_METHOD("resource_changed", "resource:Resource"), &CollisionShape::resource_changed); - ClassDB::bind_method(D_METHOD("set_shape", "shape:Shape"), &CollisionShape::set_shape); - ClassDB::bind_method(D_METHOD("get_shape:Shape"), &CollisionShape::get_shape); + ClassDB::bind_method(D_METHOD("resource_changed", "resource"), &CollisionShape::resource_changed); + ClassDB::bind_method(D_METHOD("set_shape", "shape"), &CollisionShape::set_shape); + ClassDB::bind_method(D_METHOD("get_shape"), &CollisionShape::get_shape); ClassDB::bind_method(D_METHOD("set_disabled", "enable"), &CollisionShape::set_disabled); ClassDB::bind_method(D_METHOD("is_disabled"), &CollisionShape::is_disabled); ClassDB::bind_method(D_METHOD("make_convex_from_brothers"), &CollisionShape::make_convex_from_brothers); diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 7aaf4a6e3d..2174f924ac 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -1443,8 +1443,8 @@ PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const { void GIProbe::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_probe_data", "data:GIProbeData"), &GIProbe::set_probe_data); - ClassDB::bind_method(D_METHOD("get_probe_data:GIProbeData"), &GIProbe::get_probe_data); + ClassDB::bind_method(D_METHOD("set_probe_data", "data"), &GIProbe::set_probe_data); + ClassDB::bind_method(D_METHOD("get_probe_data"), &GIProbe::get_probe_data); ClassDB::bind_method(D_METHOD("set_subdiv", "subdiv"), &GIProbe::set_subdiv); ClassDB::bind_method(D_METHOD("get_subdiv"), &GIProbe::get_subdiv); @@ -1473,7 +1473,7 @@ void GIProbe::_bind_methods() { ClassDB::bind_method(D_METHOD("set_compress", "enable"), &GIProbe::set_compress); ClassDB::bind_method(D_METHOD("is_compressed"), &GIProbe::is_compressed); - ClassDB::bind_method(D_METHOD("bake", "from_node:Node", "create_visual_debug"), &GIProbe::bake, DEFVAL(Variant()), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("bake", "from_node", "create_visual_debug"), &GIProbe::bake, DEFVAL(Variant()), DEFVAL(false)); ClassDB::bind_method(D_METHOD("debug_bake"), &GIProbe::_debug_bake); ClassDB::set_method_flags(get_class_static(), _scs_create("debug_bake"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR); diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp index 128c8b44c3..060e088750 100644 --- a/scene/3d/immediate_geometry.cpp +++ b/scene/3d/immediate_geometry.cpp @@ -143,7 +143,7 @@ void ImmediateGeometry::add_sphere(int p_lats, int p_lons, float p_radius, bool void ImmediateGeometry::_bind_methods() { - ClassDB::bind_method(D_METHOD("begin", "primitive", "texture:Texture"), &ImmediateGeometry::begin, DEFVAL(Ref<Texture>())); + ClassDB::bind_method(D_METHOD("begin", "primitive", "texture"), &ImmediateGeometry::begin, DEFVAL(Ref<Texture>())); ClassDB::bind_method(D_METHOD("set_normal", "normal"), &ImmediateGeometry::set_normal); ClassDB::bind_method(D_METHOD("set_tangent", "tangent"), &ImmediateGeometry::set_tangent); ClassDB::bind_method(D_METHOD("set_color", "color"), &ImmediateGeometry::set_color); diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index 3855244787..36a6660bf9 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -132,7 +132,7 @@ void InterpolatedCamera::_bind_methods() { ClassDB::bind_method(D_METHOD("set_target_path", "target_path"), &InterpolatedCamera::set_target_path); ClassDB::bind_method(D_METHOD("get_target_path"), &InterpolatedCamera::get_target_path); - ClassDB::bind_method(D_METHOD("set_target", "target:Camera"), &InterpolatedCamera::_set_target); + ClassDB::bind_method(D_METHOD("set_target", "target"), &InterpolatedCamera::_set_target); ClassDB::bind_method(D_METHOD("set_speed", "speed"), &InterpolatedCamera::set_speed); ClassDB::bind_method(D_METHOD("get_speed"), &InterpolatedCamera::get_speed); diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index 51237c0bc3..da25afbf57 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -352,13 +352,13 @@ void MeshInstance::create_debug_tangents() { void MeshInstance::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_mesh", "mesh:Mesh"), &MeshInstance::set_mesh); - ClassDB::bind_method(D_METHOD("get_mesh:Mesh"), &MeshInstance::get_mesh); - ClassDB::bind_method(D_METHOD("set_skeleton_path", "skeleton_path:NodePath"), &MeshInstance::set_skeleton_path); - ClassDB::bind_method(D_METHOD("get_skeleton_path:NodePath"), &MeshInstance::get_skeleton_path); + ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &MeshInstance::set_mesh); + ClassDB::bind_method(D_METHOD("get_mesh"), &MeshInstance::get_mesh); + ClassDB::bind_method(D_METHOD("set_skeleton_path", "skeleton_path"), &MeshInstance::set_skeleton_path); + ClassDB::bind_method(D_METHOD("get_skeleton_path"), &MeshInstance::get_skeleton_path); - ClassDB::bind_method(D_METHOD("set_surface_material", "surface", "material:Material"), &MeshInstance::set_surface_material); - ClassDB::bind_method(D_METHOD("get_surface_material:Material", "surface"), &MeshInstance::get_surface_material); + ClassDB::bind_method(D_METHOD("set_surface_material", "surface", "material"), &MeshInstance::set_surface_material); + ClassDB::bind_method(D_METHOD("get_surface_material", "surface"), &MeshInstance::get_surface_material); ClassDB::bind_method(D_METHOD("create_trimesh_collision"), &MeshInstance::create_trimesh_collision); ClassDB::set_method_flags("MeshInstance", "create_trimesh_collision", METHOD_FLAGS_DEFAULT); diff --git a/scene/3d/multimesh_instance.cpp b/scene/3d/multimesh_instance.cpp index b4558698cc..b51953f27c 100644 --- a/scene/3d/multimesh_instance.cpp +++ b/scene/3d/multimesh_instance.cpp @@ -31,8 +31,8 @@ void MultiMeshInstance::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_multimesh", "multimesh:MultiMesh"), &MultiMeshInstance::set_multimesh); - ClassDB::bind_method(D_METHOD("get_multimesh:MultiMesh"), &MultiMeshInstance::get_multimesh); + ClassDB::bind_method(D_METHOD("set_multimesh", "multimesh"), &MultiMeshInstance::set_multimesh); + ClassDB::bind_method(D_METHOD("get_multimesh"), &MultiMeshInstance::get_multimesh); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multimesh", PROPERTY_HINT_RESOURCE_TYPE, "MultiMesh"), "set_multimesh", "get_multimesh"); } diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index de6b242bfe..a1183326d7 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -690,7 +690,7 @@ Vector3 Navigation::get_up_vector() const { void Navigation::_bind_methods() { - ClassDB::bind_method(D_METHOD("navmesh_create", "mesh:NavigationMesh", "xform", "owner"), &Navigation::navmesh_create, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("navmesh_create", "mesh", "xform", "owner"), &Navigation::navmesh_create, DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("navmesh_set_transform", "id", "xform"), &Navigation::navmesh_set_transform); ClassDB::bind_method(D_METHOD("navmesh_remove", "id"), &Navigation::navmesh_remove); diff --git a/scene/3d/navigation.h b/scene/3d/navigation.h index 53e0b6399a..80699fce72 100644 --- a/scene/3d/navigation.h +++ b/scene/3d/navigation.h @@ -58,9 +58,9 @@ class Navigation : public Spatial { return (a.key == p_key.a.key) ? (b.key < p_key.b.key) : (a.key < p_key.a.key); }; - EdgeKey(const Point &p_a = Point(), const Point &p_b = Point()) { - a = p_a; - b = p_b; + EdgeKey(const Point &p_a = Point(), const Point &p_b = Point()) + : a(p_a), + b(p_b) { if (a.key > b.key) { SWAP(a, b); } diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 7392998d57..4c93bcfb5e 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -374,8 +374,8 @@ String NavigationMeshInstance::get_configuration_warning() const { void NavigationMeshInstance::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh:NavigationMesh"), &NavigationMeshInstance::set_navigation_mesh); - ClassDB::bind_method(D_METHOD("get_navigation_mesh:NavigationMesh"), &NavigationMeshInstance::get_navigation_mesh); + ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationMeshInstance::set_navigation_mesh); + ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationMeshInstance::get_navigation_mesh); ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationMeshInstance::set_enabled); ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationMeshInstance::is_enabled); diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index c0db07e309..e46c941daa 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -63,6 +63,8 @@ void Particles::set_one_shot(bool p_one_shot) { one_shot = p_one_shot; VS::get_singleton()->particles_set_one_shot(particles, one_shot); + if (!one_shot && emitting) + VisualServer::get_singleton()->particles_restart(particles); } void Particles::set_pre_process_time(float p_time) { @@ -291,7 +293,7 @@ void Particles::_bind_methods() { ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &Particles::set_use_local_coordinates); ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &Particles::set_fixed_fps); ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &Particles::set_fractional_delta); - ClassDB::bind_method(D_METHOD("set_process_material", "material:Material"), &Particles::set_process_material); + ClassDB::bind_method(D_METHOD("set_process_material", "material"), &Particles::set_process_material); ClassDB::bind_method(D_METHOD("set_speed_scale", "scale"), &Particles::set_speed_scale); ClassDB::bind_method(D_METHOD("is_emitting"), &Particles::is_emitting); @@ -305,7 +307,7 @@ void Particles::_bind_methods() { ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &Particles::get_use_local_coordinates); ClassDB::bind_method(D_METHOD("get_fixed_fps"), &Particles::get_fixed_fps); ClassDB::bind_method(D_METHOD("get_fractional_delta"), &Particles::get_fractional_delta); - ClassDB::bind_method(D_METHOD("get_process_material:Material"), &Particles::get_process_material); + ClassDB::bind_method(D_METHOD("get_process_material"), &Particles::get_process_material); ClassDB::bind_method(D_METHOD("get_speed_scale"), &Particles::get_speed_scale); ClassDB::bind_method(D_METHOD("set_draw_order", "order"), &Particles::set_draw_order); @@ -313,10 +315,10 @@ void Particles::_bind_methods() { ClassDB::bind_method(D_METHOD("get_draw_order"), &Particles::get_draw_order); ClassDB::bind_method(D_METHOD("set_draw_passes", "passes"), &Particles::set_draw_passes); - ClassDB::bind_method(D_METHOD("set_draw_pass_mesh", "pass", "mesh:Mesh"), &Particles::set_draw_pass_mesh); + ClassDB::bind_method(D_METHOD("set_draw_pass_mesh", "pass", "mesh"), &Particles::set_draw_pass_mesh); ClassDB::bind_method(D_METHOD("get_draw_passes"), &Particles::get_draw_passes); - ClassDB::bind_method(D_METHOD("get_draw_pass_mesh:Mesh", "pass"), &Particles::get_draw_pass_mesh); + ClassDB::bind_method(D_METHOD("get_draw_pass_mesh", "pass"), &Particles::get_draw_pass_mesh); ClassDB::bind_method(D_METHOD("restart"), &Particles::restart); ClassDB::bind_method(D_METHOD("capture_aabb"), &Particles::capture_aabb); @@ -1371,8 +1373,8 @@ void ParticlesMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_color", "color"), &ParticlesMaterial::set_color); ClassDB::bind_method(D_METHOD("get_color"), &ParticlesMaterial::get_color); - ClassDB::bind_method(D_METHOD("set_color_ramp", "ramp:Texture"), &ParticlesMaterial::set_color_ramp); - ClassDB::bind_method(D_METHOD("get_color_ramp:Texture"), &ParticlesMaterial::get_color_ramp); + ClassDB::bind_method(D_METHOD("set_color_ramp", "ramp"), &ParticlesMaterial::set_color_ramp); + ClassDB::bind_method(D_METHOD("get_color_ramp"), &ParticlesMaterial::get_color_ramp); ClassDB::bind_method(D_METHOD("set_flag", "flag", "enable"), &ParticlesMaterial::set_flag); ClassDB::bind_method(D_METHOD("get_flag", "flag"), &ParticlesMaterial::get_flag); @@ -1386,14 +1388,14 @@ void ParticlesMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_emission_box_extents", "extents"), &ParticlesMaterial::set_emission_box_extents); ClassDB::bind_method(D_METHOD("get_emission_box_extents"), &ParticlesMaterial::get_emission_box_extents); - ClassDB::bind_method(D_METHOD("set_emission_point_texture", "texture:Texture"), &ParticlesMaterial::set_emission_point_texture); - ClassDB::bind_method(D_METHOD("get_emission_point_texture:Texture"), &ParticlesMaterial::get_emission_point_texture); + ClassDB::bind_method(D_METHOD("set_emission_point_texture", "texture"), &ParticlesMaterial::set_emission_point_texture); + ClassDB::bind_method(D_METHOD("get_emission_point_texture"), &ParticlesMaterial::get_emission_point_texture); - ClassDB::bind_method(D_METHOD("set_emission_normal_texture", "texture:Texture"), &ParticlesMaterial::set_emission_normal_texture); - ClassDB::bind_method(D_METHOD("get_emission_normal_texture:Texture"), &ParticlesMaterial::get_emission_normal_texture); + ClassDB::bind_method(D_METHOD("set_emission_normal_texture", "texture"), &ParticlesMaterial::set_emission_normal_texture); + ClassDB::bind_method(D_METHOD("get_emission_normal_texture"), &ParticlesMaterial::get_emission_normal_texture); - ClassDB::bind_method(D_METHOD("set_emission_color_texture", "texture:Texture"), &ParticlesMaterial::set_emission_color_texture); - ClassDB::bind_method(D_METHOD("get_emission_color_texture:Texture"), &ParticlesMaterial::get_emission_color_texture); + ClassDB::bind_method(D_METHOD("set_emission_color_texture", "texture"), &ParticlesMaterial::set_emission_color_texture); + ClassDB::bind_method(D_METHOD("get_emission_color_texture"), &ParticlesMaterial::get_emission_color_texture); ClassDB::bind_method(D_METHOD("set_emission_point_count", "point_count"), &ParticlesMaterial::set_emission_point_count); ClassDB::bind_method(D_METHOD("get_emission_point_count"), &ParticlesMaterial::get_emission_point_count); @@ -1401,11 +1403,11 @@ void ParticlesMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_trail_divisor", "divisor"), &ParticlesMaterial::set_trail_divisor); ClassDB::bind_method(D_METHOD("get_trail_divisor"), &ParticlesMaterial::get_trail_divisor); - ClassDB::bind_method(D_METHOD("set_trail_size_modifier", "texture:CurveTexture"), &ParticlesMaterial::set_trail_size_modifier); - ClassDB::bind_method(D_METHOD("get_trail_size_modifier:CurveTexture"), &ParticlesMaterial::get_trail_size_modifier); + ClassDB::bind_method(D_METHOD("set_trail_size_modifier", "texture"), &ParticlesMaterial::set_trail_size_modifier); + ClassDB::bind_method(D_METHOD("get_trail_size_modifier"), &ParticlesMaterial::get_trail_size_modifier); - ClassDB::bind_method(D_METHOD("set_trail_color_modifier", "texture:GradientTexture"), &ParticlesMaterial::set_trail_color_modifier); - ClassDB::bind_method(D_METHOD("get_trail_color_modifier:GradientTexture"), &ParticlesMaterial::get_trail_color_modifier); + ClassDB::bind_method(D_METHOD("set_trail_color_modifier", "texture"), &ParticlesMaterial::set_trail_color_modifier); + ClassDB::bind_method(D_METHOD("get_trail_color_modifier"), &ParticlesMaterial::get_trail_color_modifier); ClassDB::bind_method(D_METHOD("get_gravity"), &ParticlesMaterial::get_gravity); ClassDB::bind_method(D_METHOD("set_gravity", "accel_vec"), &ParticlesMaterial::set_gravity); diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index 5c29918118..f8df21004e 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -78,8 +78,8 @@ Ref<Curve3D> Path::get_curve() const { void Path::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_curve", "curve:Curve3D"), &Path::set_curve); - ClassDB::bind_method(D_METHOD("get_curve:Curve3D", "curve"), &Path::get_curve); + ClassDB::bind_method(D_METHOD("set_curve", "curve"), &Path::set_curve); + ClassDB::bind_method(D_METHOD("get_curve"), &Path::get_curve); ClassDB::bind_method(D_METHOD("_curve_changed"), &Path::_curve_changed); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve3D"), "set_curve", "get_curve"); diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 9feed2fe7b..dc8f72d77e 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -229,8 +229,8 @@ void StaticBody::_bind_methods() { ClassDB::bind_method(D_METHOD("set_bounce", "bounce"), &StaticBody::set_bounce); ClassDB::bind_method(D_METHOD("get_bounce"), &StaticBody::get_bounce); - ClassDB::bind_method(D_METHOD("add_collision_exception_with", "body:PhysicsBody"), &PhysicsBody::add_collision_exception_with); - ClassDB::bind_method(D_METHOD("remove_collision_exception_with", "body:PhysicsBody"), &PhysicsBody::remove_collision_exception_with); + ClassDB::bind_method(D_METHOD("add_collision_exception_with", "body"), &PhysicsBody::add_collision_exception_with); + ClassDB::bind_method(D_METHOD("remove_collision_exception_with", "body"), &PhysicsBody::remove_collision_exception_with); ADD_PROPERTY(PropertyInfo(Variant::REAL, "friction", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_friction", "get_friction"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "bounce", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_bounce", "get_bounce"); @@ -1138,7 +1138,7 @@ void KinematicBody::_bind_methods() { ClassDB::bind_method(D_METHOD("get_floor_velocity"), &KinematicBody::get_floor_velocity); ClassDB::bind_method(D_METHOD("set_safe_margin", "pixels"), &KinematicBody::set_safe_margin); - ClassDB::bind_method(D_METHOD("get_safe_margin", "pixels"), &KinematicBody::get_safe_margin); + ClassDB::bind_method(D_METHOD("get_safe_margin"), &KinematicBody::get_safe_margin); ClassDB::bind_method(D_METHOD("get_collision_count"), &KinematicBody::get_collision_count); ClassDB::bind_method(D_METHOD("get_collision_position", "collision"), &KinematicBody::get_collision_position); diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index 7827768c09..c5ea6c54da 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -143,8 +143,8 @@ void Room::_bounds_changed() { void Room::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_room", "room:Room"), &Room::set_room); - ClassDB::bind_method(D_METHOD("get_room:Room"), &Room::get_room); + ClassDB::bind_method(D_METHOD("set_room", "room"), &Room::set_room); + ClassDB::bind_method(D_METHOD("get_room"), &Room::get_room); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "room/room", PROPERTY_HINT_RESOURCE_TYPE, "Area"), "set_room", "get_room"); } diff --git a/scene/3d/scenario_fx.cpp b/scene/3d/scenario_fx.cpp index abc7766ecb..0780ce22ff 100644 --- a/scene/3d/scenario_fx.cpp +++ b/scene/3d/scenario_fx.cpp @@ -93,8 +93,8 @@ String WorldEnvironment::get_configuration_warning() const { void WorldEnvironment::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_environment", "env:Environment"), &WorldEnvironment::set_environment); - ClassDB::bind_method(D_METHOD("get_environment:Environment"), &WorldEnvironment::get_environment); + ClassDB::bind_method(D_METHOD("set_environment", "env"), &WorldEnvironment::set_environment); + ClassDB::bind_method(D_METHOD("get_environment"), &WorldEnvironment::get_environment); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment"); } diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index ea5d21cd4e..0d91014314 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -518,8 +518,8 @@ void Skeleton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_bone_disable_rest", "bone_idx", "disable"), &Skeleton::set_bone_disable_rest); ClassDB::bind_method(D_METHOD("is_bone_rest_disabled", "bone_idx"), &Skeleton::is_bone_rest_disabled); - ClassDB::bind_method(D_METHOD("bind_child_node_to_bone", "bone_idx", "node:Node"), &Skeleton::bind_child_node_to_bone); - ClassDB::bind_method(D_METHOD("unbind_child_node_from_bone", "bone_idx", "node:Node"), &Skeleton::unbind_child_node_from_bone); + ClassDB::bind_method(D_METHOD("bind_child_node_to_bone", "bone_idx", "node"), &Skeleton::bind_child_node_to_bone); + ClassDB::bind_method(D_METHOD("unbind_child_node_from_bone", "bone_idx", "node"), &Skeleton::unbind_child_node_from_bone); ClassDB::bind_method(D_METHOD("get_bound_child_nodes_to_bone", "bone_idx"), &Skeleton::_get_bound_child_nodes_to_bone); ClassDB::bind_method(D_METHOD("clear_bones"), &Skeleton::clear_bones); diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 6106b0904a..848b08eb8f 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -72,8 +72,12 @@ SpatialGizmo::SpatialGizmo() { void Spatial::_notify_dirty() { +#ifdef TOOLS_ENABLED + if ((data.gizmo.is_valid() || data.notify_transform) && !data.ignore_notification && !xform_change.in_list()) { +#else if (data.notify_transform && !data.ignore_notification && !xform_change.in_list()) { +#endif get_tree()->xform_change_list.add(&xform_change); } } @@ -104,9 +108,11 @@ void Spatial::_propagate_transform_changed(Spatial *p_origin) { continue; //don't propagate to a toplevel E->get()->_propagate_transform_changed(p_origin); } - +#ifdef TOOLS_ENABLED + if ((data.gizmo.is_valid() || data.notify_transform) && !data.ignore_notification && !xform_change.in_list()) { +#else if (data.notify_transform && !data.ignore_notification && !xform_change.in_list()) { - +#endif get_tree()->xform_change_list.add(&xform_change); } data.dirty |= DIRTY_GLOBAL; @@ -714,11 +720,11 @@ void Spatial::_bind_methods() { ClassDB::bind_method(D_METHOD("get_scale"), &Spatial::get_scale); ClassDB::bind_method(D_METHOD("set_global_transform", "global"), &Spatial::set_global_transform); ClassDB::bind_method(D_METHOD("get_global_transform"), &Spatial::get_global_transform); - ClassDB::bind_method(D_METHOD("get_parent_spatial:Spatial"), &Spatial::get_parent_spatial); + ClassDB::bind_method(D_METHOD("get_parent_spatial"), &Spatial::get_parent_spatial); ClassDB::bind_method(D_METHOD("set_ignore_transform_notification", "enabled"), &Spatial::set_ignore_transform_notification); ClassDB::bind_method(D_METHOD("set_as_toplevel", "enable"), &Spatial::set_as_toplevel); ClassDB::bind_method(D_METHOD("is_set_as_toplevel"), &Spatial::is_set_as_toplevel); - ClassDB::bind_method(D_METHOD("get_world:World"), &Spatial::get_world); + ClassDB::bind_method(D_METHOD("get_world"), &Spatial::get_world); // TODO: Obsolete those two methods (old name) properly (GH-4397) ClassDB::bind_method(D_METHOD("_set_rotation_deg", "rotation_deg"), &Spatial::_set_rotation_deg); @@ -729,8 +735,8 @@ void Spatial::_bind_methods() { #endif ClassDB::bind_method(D_METHOD("update_gizmo"), &Spatial::update_gizmo); - ClassDB::bind_method(D_METHOD("set_gizmo", "gizmo:SpatialGizmo"), &Spatial::set_gizmo); - ClassDB::bind_method(D_METHOD("get_gizmo:SpatialGizmo"), &Spatial::get_gizmo); + ClassDB::bind_method(D_METHOD("set_gizmo", "gizmo"), &Spatial::set_gizmo); + ClassDB::bind_method(D_METHOD("get_gizmo"), &Spatial::get_gizmo); ClassDB::bind_method(D_METHOD("set_visible", "visible"), &Spatial::set_visible); ClassDB::bind_method(D_METHOD("is_visible"), &Spatial::is_visible); diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 1b9b58ceb1..978662f7dc 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -389,7 +389,7 @@ void Sprite3D::_draw() { int axis = get_axis(); normal[axis] = 1.0; - RID mat = VS::get_singleton()->material_2d_get(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); + RID mat = SpatialMaterial::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); VS::get_singleton()->immediate_set_material(immediate, mat); VS::get_singleton()->immediate_begin(immediate, VS::PRIMITIVE_TRIANGLE_FAN, texture->get_rid()); @@ -562,8 +562,8 @@ void Sprite3D::_validate_property(PropertyInfo &property) const { void Sprite3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Sprite3D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Sprite3D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Sprite3D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Sprite3D::get_texture); ClassDB::bind_method(D_METHOD("set_region", "enabled"), &Sprite3D::set_region); ClassDB::bind_method(D_METHOD("is_region"), &Sprite3D::is_region); @@ -724,8 +724,8 @@ void AnimatedSprite3D::_draw() { void AnimatedSprite3D::_bind_methods(){ - ClassDB::bind_method(D_METHOD("set_sprite_frames","sprite_frames:SpriteFrames"),&AnimatedSprite3D::set_sprite_frames); - ClassDB::bind_method(D_METHOD("get_sprite_frames:Texture"),&AnimatedSprite3D::get_sprite_frames); + ClassDB::bind_method(D_METHOD("set_sprite_frames","sprite_frames"),&AnimatedSprite3D::set_sprite_frames); + ClassDB::bind_method(D_METHOD("get_sprite_frames"),&AnimatedSprite3D::get_sprite_frames); ClassDB::bind_method(D_METHOD("set_frame","frame"),&AnimatedSprite3D::set_frame); ClassDB::bind_method(D_METHOD("get_frame"),&AnimatedSprite3D::get_frame); @@ -892,7 +892,8 @@ void AnimatedSprite3D::_draw() { int axis = get_axis(); normal[axis] = 1.0; - RID mat = VS::get_singleton()->material_2d_get(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); + RID mat = SpatialMaterial::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); + VS::get_singleton()->immediate_set_material(immediate, mat); VS::get_singleton()->immediate_begin(immediate, VS::PRIMITIVE_TRIANGLE_FAN, texture->get_rid()); @@ -1245,8 +1246,8 @@ String AnimatedSprite3D::get_configuration_warning() const { void AnimatedSprite3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames:SpriteFrames"), &AnimatedSprite3D::set_sprite_frames); - ClassDB::bind_method(D_METHOD("get_sprite_frames:SpriteFrames"), &AnimatedSprite3D::get_sprite_frames); + ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames"), &AnimatedSprite3D::set_sprite_frames); + ClassDB::bind_method(D_METHOD("get_sprite_frames"), &AnimatedSprite3D::get_sprite_frames); ClassDB::bind_method(D_METHOD("set_animation", "animation"), &AnimatedSprite3D::set_animation); ClassDB::bind_method(D_METHOD("get_animation"), &AnimatedSprite3D::get_animation); diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 7173a820b4..e2a0636466 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1215,11 +1215,11 @@ void AnimationPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationPlayer::_node_removed); ClassDB::bind_method(D_METHOD("_animation_changed"), &AnimationPlayer::_animation_changed); - ClassDB::bind_method(D_METHOD("add_animation", "name", "animation:Animation"), &AnimationPlayer::add_animation); + ClassDB::bind_method(D_METHOD("add_animation", "name", "animation"), &AnimationPlayer::add_animation); ClassDB::bind_method(D_METHOD("remove_animation", "name"), &AnimationPlayer::remove_animation); ClassDB::bind_method(D_METHOD("rename_animation", "name", "newname"), &AnimationPlayer::rename_animation); ClassDB::bind_method(D_METHOD("has_animation", "name"), &AnimationPlayer::has_animation); - ClassDB::bind_method(D_METHOD("get_animation:Animation", "name"), &AnimationPlayer::get_animation); + ClassDB::bind_method(D_METHOD("get_animation", "name"), &AnimationPlayer::get_animation); ClassDB::bind_method(D_METHOD("get_animation_list"), &AnimationPlayer::_get_animation_list); ClassDB::bind_method(D_METHOD("animation_set_next", "anim_from", "anim_to"), &AnimationPlayer::animation_set_next); @@ -1256,7 +1256,7 @@ void AnimationPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("seek", "pos_sec", "update"), &AnimationPlayer::seek, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_pos"), &AnimationPlayer::get_current_animation_pos); - ClassDB::bind_method(D_METHOD("find_animation", "animation:Animation"), &AnimationPlayer::find_animation); + ClassDB::bind_method(D_METHOD("find_animation", "animation"), &AnimationPlayer::find_animation); ClassDB::bind_method(D_METHOD("clear_caches"), &AnimationPlayer::clear_caches); diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index 6a9c2587d5..c12e97c4a5 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -1709,8 +1709,8 @@ void AnimationTreePlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("node_get_input_count", "id"), &AnimationTreePlayer::node_get_input_count); ClassDB::bind_method(D_METHOD("node_get_input_source", "id", "idx"), &AnimationTreePlayer::node_get_input_source); - ClassDB::bind_method(D_METHOD("animation_node_set_animation", "id", "animation:Animation"), &AnimationTreePlayer::animation_node_set_animation); - ClassDB::bind_method(D_METHOD("animation_node_get_animation:Animation", "id"), &AnimationTreePlayer::animation_node_get_animation); + ClassDB::bind_method(D_METHOD("animation_node_set_animation", "id", "animation"), &AnimationTreePlayer::animation_node_set_animation); + ClassDB::bind_method(D_METHOD("animation_node_get_animation", "id"), &AnimationTreePlayer::animation_node_get_animation); ClassDB::bind_method(D_METHOD("animation_node_set_master_animation", "id", "source"), &AnimationTreePlayer::animation_node_set_master_animation); ClassDB::bind_method(D_METHOD("animation_node_get_master_animation", "id"), &AnimationTreePlayer::animation_node_get_master_animation); diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp index fdf61c40d8..a8ddcbbb45 100644 --- a/scene/audio/audio_player.cpp +++ b/scene/audio/audio_player.cpp @@ -262,8 +262,8 @@ void AudioStreamPlayer::_bus_layout_changed() { void AudioStreamPlayer::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_stream", "stream:AudioStream"), &AudioStreamPlayer::set_stream); - ClassDB::bind_method(D_METHOD("get_stream:AudioStream"), &AudioStreamPlayer::get_stream); + ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer::set_stream); + ClassDB::bind_method(D_METHOD("get_stream"), &AudioStreamPlayer::get_stream); ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer::set_volume_db); ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer::get_volume_db); diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 4d55d8df75..9c20decef0 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -493,11 +493,11 @@ void BaseButton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_enabled_focus_mode", "mode"), &BaseButton::set_enabled_focus_mode); ClassDB::bind_method(D_METHOD("get_enabled_focus_mode"), &BaseButton::get_enabled_focus_mode); - ClassDB::bind_method(D_METHOD("set_shortcut", "shortcut:ShortCut"), &BaseButton::set_shortcut); - ClassDB::bind_method(D_METHOD("get_shortcut:ShortCut"), &BaseButton::get_shortcut); + ClassDB::bind_method(D_METHOD("set_shortcut", "shortcut"), &BaseButton::set_shortcut); + ClassDB::bind_method(D_METHOD("get_shortcut"), &BaseButton::get_shortcut); - ClassDB::bind_method(D_METHOD("set_button_group", "button_group:ButtonGroup"), &BaseButton::set_button_group); - ClassDB::bind_method(D_METHOD("get_button_group:ButtonGroup"), &BaseButton::get_button_group); + ClassDB::bind_method(D_METHOD("set_button_group", "button_group"), &BaseButton::set_button_group); + ClassDB::bind_method(D_METHOD("get_button_group"), &BaseButton::get_button_group); BIND_VMETHOD(MethodInfo("_pressed")); BIND_VMETHOD(MethodInfo("_toggled", PropertyInfo(Variant::BOOL, "pressed"))); @@ -563,7 +563,7 @@ BaseButton *ButtonGroup::get_pressed_button() { void ButtonGroup::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_pressed_button:BaseButton"), &ButtonGroup::get_pressed_button); + ClassDB::bind_method(D_METHOD("get_pressed_button"), &ButtonGroup::get_pressed_button); } ButtonGroup::ButtonGroup() { diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 03798c01a2..9a0b3b3c89 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -236,8 +236,8 @@ void Button::_bind_methods() { ClassDB::bind_method(D_METHOD("set_text", "text"), &Button::set_text); ClassDB::bind_method(D_METHOD("get_text"), &Button::get_text); - ClassDB::bind_method(D_METHOD("set_button_icon", "texture:Texture"), &Button::set_icon); - ClassDB::bind_method(D_METHOD("get_button_icon:Texture"), &Button::get_icon); + ClassDB::bind_method(D_METHOD("set_button_icon", "texture"), &Button::set_icon); + ClassDB::bind_method(D_METHOD("get_button_icon"), &Button::get_icon); ClassDB::bind_method(D_METHOD("set_flat", "enabled"), &Button::set_flat); ClassDB::bind_method(D_METHOD("set_clip_text", "enabled"), &Button::set_clip_text); ClassDB::bind_method(D_METHOD("get_clip_text"), &Button::get_clip_text); diff --git a/scene/gui/button_group.cpp b/scene/gui/button_group.cpp index 75fe438448..e54e810d7d 100644 --- a/scene/gui/button_group.cpp +++ b/scene/gui/button_group.cpp @@ -152,12 +152,12 @@ int ButtonGroup::get_pressed_button_index() const { void ButtonGroup::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_pressed_button:BaseButton"),&ButtonGroup::get_pressed_button); + ClassDB::bind_method(D_METHOD("get_pressed_button"),&ButtonGroup::get_pressed_button); ClassDB::bind_method(D_METHOD("get_pressed_button_index"),&ButtonGroup::get_pressed_button_index); - ClassDB::bind_method(D_METHOD("get_focused_button:BaseButton"),&ButtonGroup::get_focused_button); + ClassDB::bind_method(D_METHOD("get_focused_button"),&ButtonGroup::get_focused_button); ClassDB::bind_method(D_METHOD("get_button_list"),&ButtonGroup::_get_button_list); ClassDB::bind_method(D_METHOD("_pressed"),&ButtonGroup::_pressed); - ClassDB::bind_method(D_METHOD("set_pressed_button","button:BaseButton"),&ButtonGroup::_pressed); + ClassDB::bind_method(D_METHOD("set_pressed_button","button"),&ButtonGroup::_pressed); ADD_SIGNAL( MethodInfo("button_selected",PropertyInfo(Variant::OBJECT,"button",PROPERTY_HINT_RESOURCE_TYPE,"BaseButton"))); } diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 48cac69956..dddd53dd95 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -674,7 +674,7 @@ void ColorPickerButton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pick_color", "color"), &ColorPickerButton::set_pick_color); ClassDB::bind_method(D_METHOD("get_pick_color"), &ColorPickerButton::get_pick_color); - ClassDB::bind_method(D_METHOD("get_picker:ColorPicker"), &ColorPickerButton::get_picker); + ClassDB::bind_method(D_METHOD("get_picker"), &ColorPickerButton::get_picker); ClassDB::bind_method(D_METHOD("set_edit_alpha", "show"), &ColorPickerButton::set_edit_alpha); ClassDB::bind_method(D_METHOD("is_editing_alpha"), &ColorPickerButton::is_editing_alpha); ClassDB::bind_method(D_METHOD("_color_changed"), &ColorPickerButton::_color_changed); diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index 2a96f8260c..4bbe15ed7e 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -168,7 +168,7 @@ void Container::_bind_methods() { ClassDB::bind_method(D_METHOD("_child_minsize_changed"), &Container::_child_minsize_changed); ClassDB::bind_method(D_METHOD("queue_sort"), &Container::queue_sort); - ClassDB::bind_method(D_METHOD("fit_child_in_rect", "child:Control", "rect"), &Container::fit_child_in_rect); + ClassDB::bind_method(D_METHOD("fit_child_in_rect", "child", "rect"), &Container::fit_child_in_rect); BIND_CONSTANT(NOTIFICATION_SORT_CHILDREN); ADD_SIGNAL(MethodInfo("sort_children")); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 339b4e079e..f68132f4ff 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -51,6 +51,12 @@ Variant Control::edit_get_state() const { s["rect"] = get_rect(); s["rot"] = get_rotation(); s["scale"] = get_scale(); + Array anchors; + anchors.push_back(get_anchor(MARGIN_LEFT)); + anchors.push_back(get_anchor(MARGIN_TOP)); + anchors.push_back(get_anchor(MARGIN_RIGHT)); + anchors.push_back(get_anchor(MARGIN_BOTTOM)); + s["anchors"] = anchors; return s; } void Control::edit_set_state(const Variant &p_state) { @@ -62,6 +68,11 @@ void Control::edit_set_state(const Variant &p_state) { set_size(state.size); set_rotation(s["rot"]); set_scale(s["scale"]); + Array anchors = s["anchors"]; + set_anchor(MARGIN_LEFT, anchors[0]); + set_anchor(MARGIN_TOP, anchors[1]); + set_anchor(MARGIN_RIGHT, anchors[2]); + set_anchor(MARGIN_BOTTOM, anchors[3]); } void Control::set_custom_minimum_size(const Size2 &p_custom) { @@ -1212,21 +1223,7 @@ void Control::_size_changed() { for (int i = 0; i < 4; i++) { float area = parent_size[i & 1]; - switch (data.anchor[i]) { - - case ANCHOR_BEGIN: { - - margin_pos[i] = data.margin[i]; - } break; - case ANCHOR_END: { - - margin_pos[i] = area - data.margin[i]; - } break; - case ANCHOR_CENTER: { - - margin_pos[i] = (area / 2) - data.margin[i]; - } break; - } + margin_pos[i] = data.margin[i] + (data.anchor[i] * area); } Point2 new_pos_cache = Point2(margin_pos[0], margin_pos[1]); @@ -1299,59 +1296,38 @@ float Control::_get_range(int p_idx) const { return to - from; } -float Control::_s2a(float p_val, AnchorType p_anchor, float p_range) const { - - switch (p_anchor) { - - case ANCHOR_BEGIN: { - return p_val; - } break; - case ANCHOR_END: { - return p_range - p_val; - } break; - case ANCHOR_CENTER: { - return (p_range / 2) - p_val; - } break; - } - - return 0; +float Control::_s2a(float p_val, float p_anchor, float p_range) const { + return p_val - (p_anchor * p_range); } -float Control::_a2s(float p_val, AnchorType p_anchor, float p_range) const { - - switch (p_anchor) { - - case ANCHOR_BEGIN: { - return Math::floor(p_val); - } break; - case ANCHOR_END: { - return Math::floor(p_range - p_val); - } break; - case ANCHOR_CENTER: { - return Math::floor((p_range / 2) - p_val); - } break; - } - return 0; +float Control::_a2s(float p_val, float p_anchor, float p_range) const { + return Math::floor(p_val + (p_anchor * p_range)); } -void Control::set_anchor(Margin p_margin, AnchorType p_anchor, bool p_keep_margin) { +void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bool p_push_opposite_anchor) { + bool pushed = false; + data.anchor[p_margin] = CLAMP(p_anchor, 0.0, 1.0); - if (!is_inside_tree()) { + if (((p_margin == MARGIN_LEFT || p_margin == MARGIN_TOP) && data.anchor[p_margin] > data.anchor[(p_margin + 2) % 4]) || + ((p_margin == MARGIN_RIGHT || p_margin == MARGIN_BOTTOM) && data.anchor[p_margin] < data.anchor[(p_margin + 2) % 4])) { + if (p_push_opposite_anchor) { + data.anchor[(p_margin + 2) % 4] = data.anchor[p_margin]; + pushed = true; + } else { + data.anchor[p_margin] = data.anchor[(p_margin + 2) % 4]; + } + } - data.anchor[p_margin] = p_anchor; - } else if (!p_keep_margin) { - float pr = _get_parent_range(p_margin); - float s = _a2s(data.margin[p_margin], data.anchor[p_margin], pr); - data.anchor[p_margin] = p_anchor; - data.margin[p_margin] = _s2a(s, p_anchor, pr); - } else { - data.anchor[p_margin] = p_anchor; - _size_changed(); + if (is_inside_tree()) { + if (p_keep_margin) { + _size_changed(); + } } + update(); _change_notify(); } -void Control::_set_anchor(Margin p_margin, AnchorType p_anchor) { +void Control::_set_anchor(Margin p_margin, float p_anchor) { #ifdef TOOLS_ENABLED if (is_inside_tree() && get_tree()->is_editor_hint()) { set_anchor(p_margin, p_anchor, EDITOR_DEF("editors/2d/keep_margins_when_changing_anchors", false)); @@ -1363,13 +1339,127 @@ void Control::_set_anchor(Margin p_margin, AnchorType p_anchor) { #endif } -void Control::set_anchor_and_margin(Margin p_margin, AnchorType p_anchor, float p_pos) { +void Control::set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos, bool p_push_opposite_anchor) { - set_anchor(p_margin, p_anchor); + set_anchor(p_margin, p_anchor, false, p_push_opposite_anchor); set_margin(p_margin, p_pos); } -Control::AnchorType Control::get_anchor(Margin p_margin) const { +void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) { + //Left + switch (p_preset) { + case PRESET_TOP_LEFT: + case PRESET_BOTTOM_LEFT: + case PRESET_CENTER_LEFT: + case PRESET_TOP_WIDE: + case PRESET_BOTTOM_WIDE: + case PRESET_LEFT_WIDE: + case PRESET_HCENTER_WIDE: + case PRESET_WIDE: + set_anchor(MARGIN_LEFT, ANCHOR_BEGIN, p_keep_margin); + break; + + case PRESET_CENTER_TOP: + case PRESET_CENTER_BOTTOM: + case PRESET_CENTER: + case PRESET_VCENTER_WIDE: + set_anchor(MARGIN_LEFT, ANCHOR_CENTER, p_keep_margin); + break; + + case PRESET_TOP_RIGHT: + case PRESET_BOTTOM_RIGHT: + case PRESET_CENTER_RIGHT: + case PRESET_RIGHT_WIDE: + set_anchor(MARGIN_LEFT, ANCHOR_END, p_keep_margin); + break; + } + + // Top + switch (p_preset) { + case PRESET_TOP_LEFT: + case PRESET_TOP_RIGHT: + case PRESET_CENTER_TOP: + case PRESET_LEFT_WIDE: + case PRESET_RIGHT_WIDE: + case PRESET_TOP_WIDE: + case PRESET_VCENTER_WIDE: + case PRESET_WIDE: + set_anchor(MARGIN_TOP, ANCHOR_BEGIN, p_keep_margin); + break; + + case PRESET_CENTER_LEFT: + case PRESET_CENTER_RIGHT: + case PRESET_CENTER: + case PRESET_HCENTER_WIDE: + set_anchor(MARGIN_TOP, ANCHOR_CENTER, p_keep_margin); + break; + + case PRESET_BOTTOM_LEFT: + case PRESET_BOTTOM_RIGHT: + case PRESET_CENTER_BOTTOM: + case PRESET_BOTTOM_WIDE: + set_anchor(MARGIN_TOP, ANCHOR_END, p_keep_margin); + break; + } + + // Right + switch (p_preset) { + case PRESET_TOP_LEFT: + case PRESET_BOTTOM_LEFT: + case PRESET_CENTER_LEFT: + case PRESET_LEFT_WIDE: + set_anchor(MARGIN_RIGHT, ANCHOR_BEGIN, p_keep_margin); + break; + + case PRESET_CENTER_TOP: + case PRESET_CENTER_BOTTOM: + case PRESET_CENTER: + case PRESET_VCENTER_WIDE: + set_anchor(MARGIN_RIGHT, ANCHOR_CENTER, p_keep_margin); + break; + + case PRESET_TOP_RIGHT: + case PRESET_BOTTOM_RIGHT: + case PRESET_CENTER_RIGHT: + case PRESET_TOP_WIDE: + case PRESET_RIGHT_WIDE: + case PRESET_BOTTOM_WIDE: + case PRESET_HCENTER_WIDE: + case PRESET_WIDE: + set_anchor(MARGIN_RIGHT, ANCHOR_END, p_keep_margin); + break; + } + + // Bottom + switch (p_preset) { + case PRESET_TOP_LEFT: + case PRESET_TOP_RIGHT: + case PRESET_CENTER_TOP: + case PRESET_TOP_WIDE: + set_anchor(MARGIN_BOTTOM, ANCHOR_BEGIN, p_keep_margin); + break; + + case PRESET_CENTER_LEFT: + case PRESET_CENTER_RIGHT: + case PRESET_CENTER: + case PRESET_HCENTER_WIDE: + set_anchor(MARGIN_BOTTOM, ANCHOR_CENTER, p_keep_margin); + break; + + case PRESET_BOTTOM_LEFT: + case PRESET_BOTTOM_RIGHT: + case PRESET_CENTER_BOTTOM: + case PRESET_LEFT_WIDE: + case PRESET_RIGHT_WIDE: + case PRESET_BOTTOM_WIDE: + case PRESET_VCENTER_WIDE: + case PRESET_WIDE: + set_anchor(MARGIN_BOTTOM, ANCHOR_END, p_keep_margin); + break; + } +} + +float Control::get_anchor(Margin p_margin) const { return data.anchor[p_margin]; } @@ -1523,11 +1613,13 @@ Rect2 Control::get_item_rect() const { void Control::set_area_as_parent_rect(int p_margin) { data.anchor[MARGIN_LEFT] = ANCHOR_BEGIN; + data.margin[MARGIN_LEFT] = p_margin; data.anchor[MARGIN_TOP] = ANCHOR_BEGIN; + data.margin[MARGIN_TOP] = p_margin; data.anchor[MARGIN_RIGHT] = ANCHOR_END; + data.margin[MARGIN_RIGHT] = -p_margin; data.anchor[MARGIN_BOTTOM] = ANCHOR_END; - for (int i = 0; i < 4; i++) - data.margin[i] = p_margin; + data.margin[MARGIN_BOTTOM] = -p_margin; _size_changed(); } @@ -2371,11 +2463,12 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("accept_event"), &Control::accept_event); ClassDB::bind_method(D_METHOD("get_minimum_size"), &Control::get_minimum_size); ClassDB::bind_method(D_METHOD("get_combined_minimum_size"), &Control::get_combined_minimum_size); - ClassDB::bind_method(D_METHOD("set_anchor", "margin", "anchor_mode", "keep_margin"), &Control::set_anchor, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("_set_anchor", "margin", "anchor_mode"), &Control::_set_anchor); + ClassDB::bind_method(D_METHOD("set_anchor", "margin", "anchor", "keep_margin", "push_opposite_anchor"), &Control::set_anchor, DEFVAL(false), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("_set_anchor", "margin", "anchor"), &Control::_set_anchor); + ClassDB::bind_method(D_METHOD("set_anchors_preset", "preset", "keep_margin"), &Control::set_anchors_preset, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_anchor", "margin"), &Control::get_anchor); ClassDB::bind_method(D_METHOD("set_margin", "margin", "offset"), &Control::set_margin); - ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor_mode", "offset"), &Control::set_anchor_and_margin); + ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor", "offset", "push_opposite_anchor"), &Control::set_anchor_and_margin, DEFVAL(false)); ClassDB::bind_method(D_METHOD("set_begin", "pos"), &Control::set_begin); ClassDB::bind_method(D_METHOD("set_end", "pos"), &Control::set_end); ClassDB::bind_method(D_METHOD("set_position", "pos"), &Control::set_position); @@ -2411,7 +2504,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("has_focus"), &Control::has_focus); ClassDB::bind_method(D_METHOD("grab_focus"), &Control::grab_focus); ClassDB::bind_method(D_METHOD("release_focus"), &Control::release_focus); - ClassDB::bind_method(D_METHOD("get_focus_owner:Control"), &Control::get_focus_owner); + ClassDB::bind_method(D_METHOD("get_focus_owner"), &Control::get_focus_owner); ClassDB::bind_method(D_METHOD("set_h_size_flags", "flags"), &Control::set_h_size_flags); ClassDB::bind_method(D_METHOD("get_h_size_flags"), &Control::get_h_size_flags); @@ -2422,19 +2515,19 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("set_v_size_flags", "flags"), &Control::set_v_size_flags); ClassDB::bind_method(D_METHOD("get_v_size_flags"), &Control::get_v_size_flags); - ClassDB::bind_method(D_METHOD("set_theme", "theme:Theme"), &Control::set_theme); - ClassDB::bind_method(D_METHOD("get_theme:Theme"), &Control::get_theme); + ClassDB::bind_method(D_METHOD("set_theme", "theme"), &Control::set_theme); + ClassDB::bind_method(D_METHOD("get_theme"), &Control::get_theme); - ClassDB::bind_method(D_METHOD("add_icon_override", "name", "texture:Texture"), &Control::add_icon_override); - ClassDB::bind_method(D_METHOD("add_shader_override", "name", "shader:Shader"), &Control::add_shader_override); - ClassDB::bind_method(D_METHOD("add_style_override", "name", "stylebox:StyleBox"), &Control::add_style_override); - ClassDB::bind_method(D_METHOD("add_font_override", "name", "font:Font"), &Control::add_font_override); + ClassDB::bind_method(D_METHOD("add_icon_override", "name", "texture"), &Control::add_icon_override); + ClassDB::bind_method(D_METHOD("add_shader_override", "name", "shader"), &Control::add_shader_override); + ClassDB::bind_method(D_METHOD("add_style_override", "name", "stylebox"), &Control::add_style_override); + ClassDB::bind_method(D_METHOD("add_font_override", "name", "font"), &Control::add_font_override); ClassDB::bind_method(D_METHOD("add_color_override", "name", "color"), &Control::add_color_override); ClassDB::bind_method(D_METHOD("add_constant_override", "name", "constant"), &Control::add_constant_override); - ClassDB::bind_method(D_METHOD("get_icon:Texture", "name", "type"), &Control::get_icon, DEFVAL("")); - ClassDB::bind_method(D_METHOD("get_stylebox:StyleBox", "name", "type"), &Control::get_stylebox, DEFVAL("")); - ClassDB::bind_method(D_METHOD("get_font:Font", "name", "type"), &Control::get_font, DEFVAL("")); + ClassDB::bind_method(D_METHOD("get_icon", "name", "type"), &Control::get_icon, DEFVAL("")); + ClassDB::bind_method(D_METHOD("get_stylebox", "name", "type"), &Control::get_stylebox, DEFVAL("")); + ClassDB::bind_method(D_METHOD("get_font", "name", "type"), &Control::get_font, DEFVAL("")); ClassDB::bind_method(D_METHOD("get_color", "name", "type"), &Control::get_color, DEFVAL("")); ClassDB::bind_method(D_METHOD("get_constant", "name", "type"), &Control::get_constant, DEFVAL("")); @@ -2450,7 +2543,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("has_color", "name", "type"), &Control::has_color, DEFVAL("")); ClassDB::bind_method(D_METHOD("has_constant", "name", "type"), &Control::has_constant, DEFVAL("")); - ClassDB::bind_method(D_METHOD("get_parent_control:Control"), &Control::get_parent_control); + ClassDB::bind_method(D_METHOD("get_parent_control"), &Control::get_parent_control); ClassDB::bind_method(D_METHOD("set_h_grow_direction", "direction"), &Control::set_h_grow_direction); ClassDB::bind_method(D_METHOD("get_h_grow_direction"), &Control::get_h_grow_direction); @@ -2469,7 +2562,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("set_focus_neighbour", "margin", "neighbour"), &Control::set_focus_neighbour); ClassDB::bind_method(D_METHOD("get_focus_neighbour", "margin"), &Control::get_focus_neighbour); - ClassDB::bind_method(D_METHOD("force_drag", "data", "preview:Control"), &Control::force_drag); + ClassDB::bind_method(D_METHOD("force_drag", "data", "preview"), &Control::force_drag); ClassDB::bind_method(D_METHOD("set_mouse_filter", "filter"), &Control::set_mouse_filter); ClassDB::bind_method(D_METHOD("get_mouse_filter"), &Control::get_mouse_filter); @@ -2479,8 +2572,8 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("grab_click_focus"), &Control::grab_click_focus); - ClassDB::bind_method(D_METHOD("set_drag_forwarding", "target:Control"), &Control::set_drag_forwarding); - ClassDB::bind_method(D_METHOD("set_drag_preview", "control:Control"), &Control::set_drag_preview); + ClassDB::bind_method(D_METHOD("set_drag_forwarding", "target"), &Control::set_drag_forwarding); + ClassDB::bind_method(D_METHOD("set_drag_preview", "control"), &Control::set_drag_preview); ClassDB::bind_method(D_METHOD("warp_mouse", "to_pos"), &Control::warp_mouse); @@ -2497,10 +2590,10 @@ void Control::_bind_methods() { BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data"))); ADD_GROUP("Anchor", "anchor_"); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_left", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_LEFT); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_top", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_TOP); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_right", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_RIGHT); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_bottom", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_BOTTOM); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_left", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_LEFT); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_top", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_TOP); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_right", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_RIGHT); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_bottom", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_BOTTOM); ADD_GROUP("Margin", "margin_"); ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "margin_left", PROPERTY_HINT_RANGE, "-4096,4096"), "set_margin", "get_margin", MARGIN_LEFT); @@ -2541,9 +2634,6 @@ void Control::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), "set_theme", "get_theme"); ADD_GROUP("", ""); - BIND_CONSTANT(ANCHOR_BEGIN); - BIND_CONSTANT(ANCHOR_END); - BIND_CONSTANT(ANCHOR_CENTER); BIND_CONSTANT(FOCUS_NONE); BIND_CONSTANT(FOCUS_CLICK); BIND_CONSTANT(FOCUS_ALL); @@ -2574,6 +2664,23 @@ void Control::_bind_methods() { BIND_CONSTANT(CURSOR_HSPLIT); BIND_CONSTANT(CURSOR_HELP); + BIND_CONSTANT(PRESET_TOP_LEFT); + BIND_CONSTANT(PRESET_TOP_RIGHT); + BIND_CONSTANT(PRESET_BOTTOM_LEFT); + BIND_CONSTANT(PRESET_BOTTOM_RIGHT); + BIND_CONSTANT(PRESET_CENTER_LEFT); + BIND_CONSTANT(PRESET_CENTER_TOP); + BIND_CONSTANT(PRESET_CENTER_RIGHT); + BIND_CONSTANT(PRESET_CENTER_BOTTOM); + BIND_CONSTANT(PRESET_CENTER); + BIND_CONSTANT(PRESET_LEFT_WIDE); + BIND_CONSTANT(PRESET_TOP_WIDE); + BIND_CONSTANT(PRESET_RIGHT_WIDE); + BIND_CONSTANT(PRESET_BOTTOM_WIDE); + BIND_CONSTANT(PRESET_VCENTER_WIDE); + BIND_CONSTANT(PRESET_HCENTER_WIDE); + BIND_CONSTANT(PRESET_WIDE); + BIND_CONSTANT(SIZE_EXPAND); BIND_CONSTANT(SIZE_FILL); BIND_CONSTANT(SIZE_EXPAND_FILL); @@ -2597,7 +2704,7 @@ void Control::_bind_methods() { ADD_SIGNAL(MethodInfo("minimum_size_changed")); ADD_SIGNAL(MethodInfo("modal_closed")); - BIND_VMETHOD(MethodInfo("has_point", PropertyInfo(Variant::VECTOR2, "point"))); + BIND_VMETHOD(MethodInfo("has_point:bool", PropertyInfo(Variant::VECTOR2, "point"))); } Control::Control() { diff --git a/scene/gui/control.h b/scene/gui/control.h index 86cf8f6dbd..60d835044a 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -51,11 +51,9 @@ class Control : public CanvasItem { OBJ_CATEGORY("GUI Nodes"); public: - enum AnchorType { - ANCHOR_BEGIN, - ANCHOR_END, - ANCHOR_CENTER, - }; + static const float ANCHOR_BEGIN = 0.0f; + static const float ANCHOR_CENTER = 0.5f; + static const float ANCHOR_END = 1.0f; enum GrowDirection { GROW_DIRECTION_BEGIN, @@ -105,6 +103,25 @@ public: CURSOR_MAX }; + enum LayoutPreset { + PRESET_TOP_LEFT, + PRESET_TOP_RIGHT, + PRESET_BOTTOM_LEFT, + PRESET_BOTTOM_RIGHT, + PRESET_CENTER_LEFT, + PRESET_CENTER_TOP, + PRESET_CENTER_RIGHT, + PRESET_CENTER_BOTTOM, + PRESET_CENTER, + PRESET_LEFT_WIDE, + PRESET_TOP_WIDE, + PRESET_RIGHT_WIDE, + PRESET_BOTTOM_WIDE, + PRESET_VCENTER_WIDE, + PRESET_HCENTER_WIDE, + PRESET_WIDE + }; + private: struct CComparator { @@ -122,7 +139,7 @@ private: Size2 size_cache; float margin[4]; - AnchorType anchor[4]; + float anchor[4]; FocusMode focus_mode; GrowDirection h_grow; GrowDirection v_grow; @@ -182,12 +199,12 @@ private: void _window_find_focus_neighbour(const Vector2 &p_dir, Node *p_at, const Point2 *p_points, float p_min, float &r_closest_dist, Control **r_closest); Control *_get_focus_neighbour(Margin p_margin, int p_count = 0); - void _set_anchor(Margin p_margin, AnchorType p_anchor); + void _set_anchor(Margin p_margin, float p_anchor); float _get_parent_range(int p_idx) const; float _get_range(int p_idx) const; - float _s2a(float p_val, AnchorType p_anchor, float p_range) const; - float _a2s(float p_val, AnchorType p_anchor, float p_range) const; + float _s2a(float p_val, float p_anchor, float p_range) const; + float _a2s(float p_val, float p_anchor, float p_range) const; void _propagate_theme_changed(CanvasItem *p_at, Control *p_owner, bool p_assign = true); void _theme_changed(); @@ -275,10 +292,11 @@ public: /* POSITIONING */ - void set_anchor(Margin p_margin, AnchorType p_anchor, bool p_keep_margin = false); - void set_anchor_and_margin(Margin p_margin, AnchorType p_anchor, float p_pos); + void set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin = false, bool p_push_opposite_anchor = true); + void set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos, bool p_push_opposite_anchor = true); + void set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin = false); - AnchorType get_anchor(Margin p_margin) const; + float get_anchor(Margin p_margin) const; void set_margin(Margin p_margin, float p_value); @@ -425,10 +443,10 @@ public: ~Control(); }; -VARIANT_ENUM_CAST(Control::AnchorType); VARIANT_ENUM_CAST(Control::FocusMode); VARIANT_ENUM_CAST(Control::SizeFlags); VARIANT_ENUM_CAST(Control::CursorShape); +VARIANT_ENUM_CAST(Control::LayoutPreset); VARIANT_ENUM_CAST(Control::MouseFilter); VARIANT_ENUM_CAST(Control::GrowDirection); diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 7d7c636bc2..d576ff1dbc 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -215,7 +215,7 @@ void WindowDialog::_notification(int p_what) { close_button->set_pressed_texture(get_icon("close", "WindowDialog")); close_button->set_hover_texture(get_icon("close_highlight", "WindowDialog")); close_button->set_anchor(MARGIN_LEFT, ANCHOR_END); - close_button->set_begin(Point2(get_constant("close_h_ofs", "WindowDialog"), -get_constant("close_v_ofs", "WindowDialog"))); + close_button->set_begin(Point2(-get_constant("close_h_ofs", "WindowDialog"), -get_constant("close_v_ofs", "WindowDialog"))); } break; case NOTIFICATION_MOUSE_EXIT: { @@ -308,7 +308,7 @@ void WindowDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("set_resizable", "resizable"), &WindowDialog::set_resizable); ClassDB::bind_method(D_METHOD("get_resizable"), &WindowDialog::get_resizable); ClassDB::bind_method(D_METHOD("_closed"), &WindowDialog::_closed); - ClassDB::bind_method(D_METHOD("get_close_button:TextureButton"), &WindowDialog::get_close_button); + ClassDB::bind_method(D_METHOD("get_close_button"), &WindowDialog::get_close_button); ADD_PROPERTY(PropertyInfo(Variant::STRING, "window_title", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT_INTL), "set_title", "get_title"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "resizable", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT_INTL), "set_resizable", "get_resizable"); @@ -515,10 +515,10 @@ void AcceptDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("get_label"), &AcceptDialog::get_label); ClassDB::bind_method(D_METHOD("set_hide_on_ok", "enabled"), &AcceptDialog::set_hide_on_ok); ClassDB::bind_method(D_METHOD("get_hide_on_ok"), &AcceptDialog::get_hide_on_ok); - ClassDB::bind_method(D_METHOD("add_button:Button", "text", "right", "action"), &AcceptDialog::add_button, DEFVAL(false), DEFVAL("")); - ClassDB::bind_method(D_METHOD("add_cancel:Button", "name"), &AcceptDialog::add_cancel); + ClassDB::bind_method(D_METHOD("add_button", "text", "right", "action"), &AcceptDialog::add_button, DEFVAL(false), DEFVAL("")); + ClassDB::bind_method(D_METHOD("add_cancel", "name"), &AcceptDialog::add_cancel); ClassDB::bind_method(D_METHOD("_builtin_text_entered"), &AcceptDialog::_builtin_text_entered); - ClassDB::bind_method(D_METHOD("register_text_enter:LineEdit", "line_edit"), &AcceptDialog::register_text_enter); + ClassDB::bind_method(D_METHOD("register_text_enter", "line_edit"), &AcceptDialog::register_text_enter); ClassDB::bind_method(D_METHOD("_custom_action"), &AcceptDialog::_custom_action); ClassDB::bind_method(D_METHOD("set_text", "text"), &AcceptDialog::set_text); ClassDB::bind_method(D_METHOD("get_text"), &AcceptDialog::get_text); @@ -546,7 +546,7 @@ AcceptDialog::AcceptDialog() { label->set_anchor(MARGIN_RIGHT, ANCHOR_END); label->set_anchor(MARGIN_BOTTOM, ANCHOR_END); label->set_begin(Point2(margin, margin)); - label->set_end(Point2(margin, button_margin + 10)); + label->set_end(Point2(-margin, -button_margin - 10)); //label->set_autowrap(true); add_child(label); @@ -573,7 +573,7 @@ AcceptDialog::~AcceptDialog() { void ConfirmationDialog::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_cancel:Button"), &ConfirmationDialog::get_cancel); + ClassDB::bind_method(D_METHOD("get_cancel"), &ConfirmationDialog::get_cancel); } Button *ConfirmationDialog::get_cancel() { diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 3527b834c7..74255b38bf 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -701,7 +701,7 @@ void FileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("set_current_path", "path"), &FileDialog::set_current_path); ClassDB::bind_method(D_METHOD("set_mode", "mode"), &FileDialog::set_mode); ClassDB::bind_method(D_METHOD("get_mode"), &FileDialog::get_mode); - ClassDB::bind_method(D_METHOD("get_vbox:VBoxContainer"), &FileDialog::get_vbox); + ClassDB::bind_method(D_METHOD("get_vbox"), &FileDialog::get_vbox); ClassDB::bind_method(D_METHOD("set_access", "access"), &FileDialog::set_access); ClassDB::bind_method(D_METHOD("get_access"), &FileDialog::get_access); ClassDB::bind_method(D_METHOD("set_show_hidden_files", "show"), &FileDialog::set_show_hidden_files); @@ -850,9 +850,9 @@ void LineEditFileChooser::_bind_methods() { ClassDB::bind_method(D_METHOD("_browse"), &LineEditFileChooser::_browse); ClassDB::bind_method(D_METHOD("_chosen"), &LineEditFileChooser::_chosen); - ClassDB::bind_method(D_METHOD("get_button:Button"), &LineEditFileChooser::get_button); - ClassDB::bind_method(D_METHOD("get_line_edit:LineEdit"), &LineEditFileChooser::get_line_edit); - ClassDB::bind_method(D_METHOD("get_file_dialog:FileDialog"), &LineEditFileChooser::get_file_dialog); + ClassDB::bind_method(D_METHOD("get_button"), &LineEditFileChooser::get_button); + ClassDB::bind_method(D_METHOD("get_line_edit"), &LineEditFileChooser::get_line_edit); + ClassDB::bind_method(D_METHOD("get_file_dialog"), &LineEditFileChooser::get_file_dialog); } void LineEditFileChooser::_chosen(const String &p_text) { diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 32725ebb8c..ec1932ed5a 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -269,14 +269,14 @@ void GraphEdit::_notification(int p_what) { Size2 hmin = h_scroll->get_combined_minimum_size(); Size2 vmin = v_scroll->get_combined_minimum_size(); - v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, vmin.width); + v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -vmin.width); v_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); v_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0); v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); h_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0); h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); - h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, hmin.height); + h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -hmin.height); h_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); zoom_minus->set_icon(get_icon("minus")); @@ -1157,7 +1157,7 @@ void GraphEdit::_snap_value_changed(double) { void GraphEdit::_bind_methods() { - ClassDB::bind_method(D_METHOD("connect_node:Error", "from", "from_port", "to", "to_port"), &GraphEdit::connect_node); + ClassDB::bind_method(D_METHOD("connect_node", "from", "from_port", "to", "to_port"), &GraphEdit::connect_node); ClassDB::bind_method(D_METHOD("is_node_connected", "from", "from_port", "to", "to_port"), &GraphEdit::is_node_connected); ClassDB::bind_method(D_METHOD("disconnect_node", "from", "from_port", "to", "to_port"), &GraphEdit::disconnect_node); ClassDB::bind_method(D_METHOD("get_connection_list"), &GraphEdit::_get_connection_list); @@ -1192,7 +1192,7 @@ void GraphEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_scroll_offset"), &GraphEdit::_update_scroll_offset); ClassDB::bind_method(D_METHOD("_connections_layer_draw"), &GraphEdit::_connections_layer_draw); - ClassDB::bind_method(D_METHOD("set_selected", "node:Node"), &GraphEdit::set_selected); + ClassDB::bind_method(D_METHOD("set_selected", "node"), &GraphEdit::set_selected); ADD_SIGNAL(MethodInfo("connection_request", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot"))); ADD_SIGNAL(MethodInfo("disconnection_request", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot"))); diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index 4f07d21f4d..b9062295b5 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -664,7 +664,7 @@ void GraphNode::_bind_methods() { ClassDB::bind_method(D_METHOD("set_slot", "idx", "enable_left", "type_left", "color_left", "enable_right", "type_right", "color_right", "custom_left", "custom_right"), &GraphNode::set_slot, DEFVAL(Ref<Texture>()), DEFVAL(Ref<Texture>())); ClassDB::bind_method(D_METHOD("clear_slot", "idx"), &GraphNode::clear_slot); - ClassDB::bind_method(D_METHOD("clear_all_slots", "idx"), &GraphNode::clear_all_slots); + ClassDB::bind_method(D_METHOD("clear_all_slots"), &GraphNode::clear_all_slots); ClassDB::bind_method(D_METHOD("is_slot_enabled_left", "idx"), &GraphNode::is_slot_enabled_left); ClassDB::bind_method(D_METHOD("get_slot_type_left", "idx"), &GraphNode::get_slot_type_left); ClassDB::bind_method(D_METHOD("get_slot_color_left", "idx"), &GraphNode::get_slot_color_left); diff --git a/scene/gui/input_action.cpp b/scene/gui/input_action.cpp index 3f80c31c8b..c08059a049 100644 --- a/scene/gui/input_action.cpp +++ b/scene/gui/input_action.cpp @@ -116,12 +116,12 @@ bool ShortCut::is_valid() const { void ShortCut::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shortcut", "event:InputEvent"), &ShortCut::set_shortcut); - ClassDB::bind_method(D_METHOD("get_shortcut:InputEvent"), &ShortCut::get_shortcut); + ClassDB::bind_method(D_METHOD("set_shortcut", "event"), &ShortCut::set_shortcut); + ClassDB::bind_method(D_METHOD("get_shortcut"), &ShortCut::get_shortcut); ClassDB::bind_method(D_METHOD("is_valid"), &ShortCut::is_valid); - ClassDB::bind_method(D_METHOD("is_shortcut", "event:InputEvent"), &ShortCut::is_shortcut); + ClassDB::bind_method(D_METHOD("is_shortcut", "event"), &ShortCut::is_shortcut); ClassDB::bind_method(D_METHOD("get_as_text"), &ShortCut::get_as_text); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), "set_shortcut", "get_shortcut"); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 34533375b2..d90f0c7898 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -736,10 +736,10 @@ void ItemList::_notification(int p_what) { Ref<StyleBox> bg = get_stylebox("bg"); int mw = scroll_bar->get_minimum_size().x; - scroll_bar->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, mw + bg->get_margin(MARGIN_RIGHT)); - scroll_bar->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, bg->get_margin(MARGIN_RIGHT)); + scroll_bar->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -mw + bg->get_margin(MARGIN_RIGHT)); + scroll_bar->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -bg->get_margin(MARGIN_RIGHT)); scroll_bar->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, bg->get_margin(MARGIN_TOP)); - scroll_bar->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, bg->get_margin(MARGIN_BOTTOM)); + scroll_bar->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -bg->get_margin(MARGIN_BOTTOM)); Size2 size = get_size(); @@ -1277,14 +1277,14 @@ bool ItemList::has_auto_height() const { void ItemList::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_item", "text", "icon:Texture", "selectable"), &ItemList::add_item, DEFVAL(Variant()), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("add_icon_item", "icon:Texture", "selectable"), &ItemList::add_icon_item, DEFVAL(true)); + ClassDB::bind_method(D_METHOD("add_item", "text", "icon", "selectable"), &ItemList::add_item, DEFVAL(Variant()), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("add_icon_item", "icon", "selectable"), &ItemList::add_icon_item, DEFVAL(true)); ClassDB::bind_method(D_METHOD("set_item_text", "idx", "text"), &ItemList::set_item_text); ClassDB::bind_method(D_METHOD("get_item_text", "idx"), &ItemList::get_item_text); - ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "icon:Texture"), &ItemList::set_item_icon); - ClassDB::bind_method(D_METHOD("get_item_icon:Texture", "idx"), &ItemList::get_item_icon); + ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "icon"), &ItemList::set_item_icon); + ClassDB::bind_method(D_METHOD("get_item_icon", "idx"), &ItemList::get_item_icon); ClassDB::bind_method(D_METHOD("set_item_icon_region", "idx", "rect"), &ItemList::set_item_icon_region); ClassDB::bind_method(D_METHOD("get_item_icon_region", "idx"), &ItemList::get_item_icon_region); @@ -1296,7 +1296,7 @@ void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("is_item_disabled", "idx"), &ItemList::is_item_disabled); ClassDB::bind_method(D_METHOD("set_item_metadata", "idx", "metadata"), &ItemList::set_item_metadata); - ClassDB::bind_method(D_METHOD("get_item_metadata:Variant", "idx"), &ItemList::get_item_metadata); + ClassDB::bind_method(D_METHOD("get_item_metadata", "idx"), &ItemList::get_item_metadata); ClassDB::bind_method(D_METHOD("set_item_custom_bg_color", "idx", "custom_bg_color"), &ItemList::set_item_custom_bg_color); ClassDB::bind_method(D_METHOD("get_item_custom_bg_color", "idx"), &ItemList::get_item_custom_bg_color); @@ -1352,7 +1352,7 @@ void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("ensure_current_is_visible"), &ItemList::ensure_current_is_visible); - ClassDB::bind_method(D_METHOD("get_v_scroll:VScrollBar"), &ItemList::get_v_scroll); + ClassDB::bind_method(D_METHOD("get_v_scroll"), &ItemList::get_v_scroll); ClassDB::bind_method(D_METHOD("_scroll_changed"), &ItemList::_scroll_changed); ClassDB::bind_method(D_METHOD("_gui_input"), &ItemList::_gui_input); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 8556ce5db1..c1784fb7ba 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -641,6 +641,35 @@ void LineEdit::_notification(int p_what) { if (char_ofs >= t.length()) break; + if (char_ofs == cursor_pos) { + if (ime_text.length() > 0) { + int ofs = 0; + while (true) { + if (ofs >= ime_text.length()) + break; + + CharType cchar = (pass && !text.empty()) ? '*' : ime_text[ofs]; + CharType next = (pass && !text.empty()) ? '*' : ime_text[ofs + 1]; + int im_char_width = font->get_char_size(cchar, next).width; + + if ((x_ofs + im_char_width) > ofs_max) + break; + + bool selected = ofs >= ime_selection.x && ofs < ime_selection.x + ime_selection.y; + if (selected) { + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 3)), font_color); + } else { + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 1)), font_color); + } + + font->draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, font_color); + + x_ofs += im_char_width; + ofs++; + } + } + } + CharType cchar = (pass && !text.empty()) ? '*' : t[char_ofs]; CharType next = (pass && !text.empty()) ? '*' : t[char_ofs + 1]; int char_width = font->get_char_size(cchar, next).width; @@ -657,24 +686,54 @@ void LineEdit::_notification(int p_what) { font->draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, selected ? font_color_selected : font_color); if (char_ofs == cursor_pos && draw_caret) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( - Point2(x_ofs, y_ofs), Size2(1, caret_height)), - cursor_color); + if (ime_text.length() == 0) { + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(1, caret_height)), cursor_color); + } } x_ofs += char_width; char_ofs++; } + if (char_ofs == cursor_pos) { + if (ime_text.length() > 0) { + int ofs = 0; + while (true) { + if (ofs >= ime_text.length()) + break; + + CharType cchar = (pass && !text.empty()) ? '*' : ime_text[ofs]; + CharType next = (pass && !text.empty()) ? '*' : ime_text[ofs + 1]; + int im_char_width = font->get_char_size(cchar, next).width; + + if ((x_ofs + im_char_width) > ofs_max) + break; + + bool selected = ofs >= ime_selection.x && ofs < ime_selection.x + ime_selection.y; + if (selected) { + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 3)), font_color); + } else { + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 1)), font_color); + } + + font->draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, font_color); + + x_ofs += im_char_width; + ofs++; + } + } + } + if (char_ofs == cursor_pos && draw_caret) { //may be at the end - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( - Point2(x_ofs, y_ofs), Size2(1, caret_height)), - cursor_color); + if (ime_text.length() == 0) { + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(1, caret_height)), cursor_color); + } } if (has_focus()) { OS::get_singleton()->set_ime_position(get_global_position() + Point2(x_ofs, y_ofs + caret_height)); + OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this); } } break; case NOTIFICATION_FOCUS_ENTER: { @@ -685,6 +744,7 @@ void LineEdit::_notification(int p_what) { Point2 cursor_pos = Point2(get_cursor_pos(), 1) * get_minimum_size().height; OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos); + OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this); if (OS::get_singleton()->has_virtual_keyboard()) OS::get_singleton()->show_virtual_keyboard(text, get_global_rect()); @@ -693,6 +753,9 @@ void LineEdit::_notification(int p_what) { case NOTIFICATION_FOCUS_EXIT: { OS::get_singleton()->set_ime_position(Point2()); + OS::get_singleton()->set_ime_intermediate_text_callback(NULL, NULL); + ime_text = ""; + ime_selection = Point2(); if (OS::get_singleton()->has_virtual_keyboard()) OS::get_singleton()->hide_virtual_keyboard(); @@ -1231,6 +1294,13 @@ bool LineEdit::get_expand_to_text_length() const { return expand_to_text_length; } +void LineEdit::_ime_text_callback(void *p_self, String p_text, Point2 p_selection) { + LineEdit *self = (LineEdit *)p_self; + self->ime_text = p_text; + self->ime_selection = p_selection; + self->update(); +} + void LineEdit::_text_changed() { if (expand_to_text_length) @@ -1277,7 +1347,7 @@ void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("is_secret"), &LineEdit::is_secret); ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("menu_option", "option"), &LineEdit::menu_option); - ClassDB::bind_method(D_METHOD("get_menu:PopupMenu"), &LineEdit::get_menu); + ClassDB::bind_method(D_METHOD("get_menu"), &LineEdit::get_menu); ADD_SIGNAL(MethodInfo("text_changed", PropertyInfo(Variant::STRING, "text"))); ADD_SIGNAL(MethodInfo("text_entered", PropertyInfo(Variant::STRING, "text"))); diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index 1167cfb6d0..73c5a46937 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -70,6 +70,8 @@ private: String text; String placeholder; float placeholder_alpha; + String ime_text; + Point2 ime_selection; PopupMenu *menu; @@ -92,6 +94,7 @@ private: Timer *caret_blink_timer; + static void _ime_text_callback(void *p_self, String p_text, Point2 p_selection); void _text_changed(); bool expand_to_text_length; diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 57aa72b7d0..93284f2b6c 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -94,7 +94,7 @@ void MenuButton::_set_items(const Array &p_items) { void MenuButton::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_popup:PopupMenu"), &MenuButton::get_popup); + ClassDB::bind_method(D_METHOD("get_popup"), &MenuButton::get_popup); ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &MenuButton::_unhandled_key_input); ClassDB::bind_method(D_METHOD("_set_items"), &MenuButton::_set_items); ClassDB::bind_method(D_METHOD("_get_items"), &MenuButton::_get_items); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 60874edf38..25ac8d5259 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -289,16 +289,16 @@ void OptionButton::_bind_methods() { ClassDB::bind_method(D_METHOD("_selected"), &OptionButton::_selected); ClassDB::bind_method(D_METHOD("add_item", "label", "id"), &OptionButton::add_item, DEFVAL(-1)); - ClassDB::bind_method(D_METHOD("add_icon_item", "texture:Texture", "label", "id"), &OptionButton::add_icon_item); + ClassDB::bind_method(D_METHOD("add_icon_item", "texture", "label", "id"), &OptionButton::add_icon_item); ClassDB::bind_method(D_METHOD("set_item_text", "idx", "text"), &OptionButton::set_item_text); - ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "texture:Texture"), &OptionButton::set_item_icon); + ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "texture"), &OptionButton::set_item_icon); ClassDB::bind_method(D_METHOD("set_item_disabled", "idx", "disabled"), &OptionButton::set_item_disabled); ClassDB::bind_method(D_METHOD("set_item_id", "idx", "id"), &OptionButton::set_item_id); ClassDB::bind_method(D_METHOD("set_item_metadata", "idx", "metadata"), &OptionButton::set_item_metadata); ClassDB::bind_method(D_METHOD("get_item_text", "idx"), &OptionButton::get_item_text); - ClassDB::bind_method(D_METHOD("get_item_icon:Texture", "idx"), &OptionButton::get_item_icon); + ClassDB::bind_method(D_METHOD("get_item_icon", "idx"), &OptionButton::get_item_icon); ClassDB::bind_method(D_METHOD("get_item_id", "idx"), &OptionButton::get_item_id); - ClassDB::bind_method(D_METHOD("get_item_metadata:Variant", "idx"), &OptionButton::get_item_metadata); + ClassDB::bind_method(D_METHOD("get_item_metadata", "idx"), &OptionButton::get_item_metadata); ClassDB::bind_method(D_METHOD("is_item_disabled", "idx"), &OptionButton::is_item_disabled); ClassDB::bind_method(D_METHOD("get_item_count"), &OptionButton::get_item_count); ClassDB::bind_method(D_METHOD("add_separator"), &OptionButton::add_separator); @@ -306,7 +306,7 @@ void OptionButton::_bind_methods() { ClassDB::bind_method(D_METHOD("select", "idx"), &OptionButton::select); ClassDB::bind_method(D_METHOD("get_selected"), &OptionButton::get_selected); ClassDB::bind_method(D_METHOD("get_selected_id"), &OptionButton::get_selected_id); - ClassDB::bind_method(D_METHOD("get_selected_metadata:Variant"), &OptionButton::get_selected_metadata); + ClassDB::bind_method(D_METHOD("get_selected_metadata"), &OptionButton::get_selected_metadata); ClassDB::bind_method(D_METHOD("remove_item", "idx"), &OptionButton::remove_item); ClassDB::bind_method(D_METHOD("_select_int"), &OptionButton::_select_int); diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp index e577000f99..249090830d 100644 --- a/scene/gui/patch_9_rect.cpp +++ b/scene/gui/patch_9_rect.cpp @@ -54,8 +54,8 @@ Size2 NinePatchRect::get_minimum_size() const { } void NinePatchRect::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &NinePatchRect::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &NinePatchRect::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &NinePatchRect::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &NinePatchRect::get_texture); ClassDB::bind_method(D_METHOD("set_patch_margin", "margin", "value"), &NinePatchRect::set_patch_margin); ClassDB::bind_method(D_METHOD("get_patch_margin", "margin"), &NinePatchRect::get_patch_margin); ClassDB::bind_method(D_METHOD("set_region_rect", "rect"), &NinePatchRect::set_region_rect); diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 8979e0f111..bdd0e8e597 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -108,13 +108,10 @@ void Popup::set_as_minsize() { float margin_begin = c->get_margin(m_beg); float margin_end = c->get_margin(m_end); - AnchorType anchor_begin = c->get_anchor(m_beg); - AnchorType anchor_end = c->get_anchor(m_end); + float anchor_begin = c->get_anchor(m_beg); + float anchor_end = c->get_anchor(m_end); - if (anchor_begin == ANCHOR_BEGIN) - minsize[j] += margin_begin; - if (anchor_end == ANCHOR_END) - minsize[j] += margin_end; + minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end; } total_minsize.width = MAX(total_minsize.width, minsize.width); @@ -145,13 +142,10 @@ void Popup::popup_centered_minsize(const Size2 &p_minsize) { float margin_begin = c->get_margin(m_beg); float margin_end = c->get_margin(m_end); - AnchorType anchor_begin = c->get_anchor(m_beg); - AnchorType anchor_end = c->get_anchor(m_end); + float anchor_begin = c->get_anchor(m_beg); + float anchor_end = c->get_anchor(m_end); - if (anchor_begin == ANCHOR_BEGIN) - minsize[j] += margin_begin; - if (anchor_end == ANCHOR_END) - minsize[j] += margin_end; + minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end; } total_minsize.width = MAX(total_minsize.width, minsize.width); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index e3f9a09db3..46aa0e5054 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1075,19 +1075,19 @@ void PopupMenu::clear_autohide_areas() { void PopupMenu::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &PopupMenu::_gui_input); - ClassDB::bind_method(D_METHOD("add_icon_item", "texture:Texture", "label", "id", "accel"), &PopupMenu::add_icon_item, DEFVAL(-1), DEFVAL(0)); + ClassDB::bind_method(D_METHOD("add_icon_item", "texture", "label", "id", "accel"), &PopupMenu::add_icon_item, DEFVAL(-1), DEFVAL(0)); ClassDB::bind_method(D_METHOD("add_item", "label", "id", "accel"), &PopupMenu::add_item, DEFVAL(-1), DEFVAL(0)); - ClassDB::bind_method(D_METHOD("add_icon_check_item", "texture:Texture", "label", "id", "accel"), &PopupMenu::add_icon_check_item, DEFVAL(-1), DEFVAL(0)); + ClassDB::bind_method(D_METHOD("add_icon_check_item", "texture", "label", "id", "accel"), &PopupMenu::add_icon_check_item, DEFVAL(-1), DEFVAL(0)); ClassDB::bind_method(D_METHOD("add_check_item", "label", "id", "accel"), &PopupMenu::add_check_item, DEFVAL(-1), DEFVAL(0)); ClassDB::bind_method(D_METHOD("add_submenu_item", "label", "submenu", "id"), &PopupMenu::add_submenu_item, DEFVAL(-1)); - ClassDB::bind_method(D_METHOD("add_icon_shortcut", "texture:Texture", "shortcut:ShortCut", "id", "global"), &PopupMenu::add_icon_shortcut, DEFVAL(-1), DEFVAL(false)); - ClassDB::bind_method(D_METHOD("add_shortcut", "shortcut:ShortCut", "id", "global"), &PopupMenu::add_shortcut, DEFVAL(-1), DEFVAL(false)); - ClassDB::bind_method(D_METHOD("add_icon_check_shortcut", "texture:Texture", "shortcut:ShortCut", "id", "global"), &PopupMenu::add_icon_check_shortcut, DEFVAL(-1), DEFVAL(false)); - ClassDB::bind_method(D_METHOD("add_check_shortcut", "shortcut:ShortCut", "id", "global"), &PopupMenu::add_check_shortcut, DEFVAL(-1), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("add_icon_shortcut", "texture", "shortcut", "id", "global"), &PopupMenu::add_icon_shortcut, DEFVAL(-1), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("add_shortcut", "shortcut", "id", "global"), &PopupMenu::add_shortcut, DEFVAL(-1), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("add_icon_check_shortcut", "texture", "shortcut", "id", "global"), &PopupMenu::add_icon_check_shortcut, DEFVAL(-1), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("add_check_shortcut", "shortcut", "id", "global"), &PopupMenu::add_check_shortcut, DEFVAL(-1), DEFVAL(false)); ClassDB::bind_method(D_METHOD("set_item_text", "idx", "text"), &PopupMenu::set_item_text); - ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "icon:Texture"), &PopupMenu::set_item_icon); + ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "icon"), &PopupMenu::set_item_icon); ClassDB::bind_method(D_METHOD("set_item_checked", "idx", "checked"), &PopupMenu::set_item_checked); ClassDB::bind_method(D_METHOD("set_item_id", "idx", "id"), &PopupMenu::set_item_id); ClassDB::bind_method(D_METHOD("set_item_accelerator", "idx", "accel"), &PopupMenu::set_item_accelerator); @@ -1097,23 +1097,23 @@ void PopupMenu::_bind_methods() { ClassDB::bind_method(D_METHOD("set_item_as_separator", "idx", "enable"), &PopupMenu::set_item_as_separator); ClassDB::bind_method(D_METHOD("set_item_as_checkable", "idx", "enable"), &PopupMenu::set_item_as_checkable); ClassDB::bind_method(D_METHOD("set_item_tooltip", "idx", "tooltip"), &PopupMenu::set_item_tooltip); - ClassDB::bind_method(D_METHOD("set_item_shortcut", "idx", "shortcut:ShortCut", "global"), &PopupMenu::set_item_shortcut, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("set_item_shortcut", "idx", "shortcut", "global"), &PopupMenu::set_item_shortcut, DEFVAL(false)); ClassDB::bind_method(D_METHOD("toggle_item_checked", "idx"), &PopupMenu::toggle_item_checked); ClassDB::bind_method(D_METHOD("get_item_text", "idx"), &PopupMenu::get_item_text); - ClassDB::bind_method(D_METHOD("get_item_icon:Texture", "idx"), &PopupMenu::get_item_icon); + ClassDB::bind_method(D_METHOD("get_item_icon", "idx"), &PopupMenu::get_item_icon); ClassDB::bind_method(D_METHOD("is_item_checked", "idx"), &PopupMenu::is_item_checked); ClassDB::bind_method(D_METHOD("get_item_id", "idx"), &PopupMenu::get_item_id); ClassDB::bind_method(D_METHOD("get_item_index", "id"), &PopupMenu::get_item_index); ClassDB::bind_method(D_METHOD("get_item_accelerator", "idx"), &PopupMenu::get_item_accelerator); - ClassDB::bind_method(D_METHOD("get_item_metadata:Variant", "idx"), &PopupMenu::get_item_metadata); + ClassDB::bind_method(D_METHOD("get_item_metadata", "idx"), &PopupMenu::get_item_metadata); ClassDB::bind_method(D_METHOD("is_item_disabled", "idx"), &PopupMenu::is_item_disabled); ClassDB::bind_method(D_METHOD("get_item_submenu", "idx"), &PopupMenu::get_item_submenu); ClassDB::bind_method(D_METHOD("is_item_separator", "idx"), &PopupMenu::is_item_separator); ClassDB::bind_method(D_METHOD("is_item_checkable", "idx"), &PopupMenu::is_item_checkable); ClassDB::bind_method(D_METHOD("get_item_tooltip", "idx"), &PopupMenu::get_item_tooltip); - ClassDB::bind_method(D_METHOD("get_item_shortcut:ShortCut", "idx"), &PopupMenu::get_item_shortcut); + ClassDB::bind_method(D_METHOD("get_item_shortcut", "idx"), &PopupMenu::get_item_shortcut); ClassDB::bind_method(D_METHOD("get_item_count"), &PopupMenu::get_item_count); diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 6bec365dcf..68afe8150a 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -234,7 +234,7 @@ void Range::_bind_methods() { ClassDB::bind_method(D_METHOD("set_exp_ratio", "enabled"), &Range::set_exp_ratio); ClassDB::bind_method(D_METHOD("is_ratio_exp"), &Range::is_ratio_exp); - ClassDB::bind_method(D_METHOD("share", "with:Node"), &Range::_share); + ClassDB::bind_method(D_METHOD("share", "with"), &Range::_share); ClassDB::bind_method(D_METHOD("unshare"), &Range::unshare); ADD_SIGNAL(MethodInfo("value_changed", PropertyInfo(Variant::REAL, "value"))); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 9f71fa070c..42084ade25 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -594,7 +594,7 @@ void RichTextLabel::_update_scroll() { main->first_invalid_line = 0; scroll_w = vscroll->get_combined_minimum_size().width; vscroll->show(); - vscroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, scroll_w); + vscroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -scroll_w); _validate_line_caches(main); } else { @@ -1853,10 +1853,10 @@ void RichTextLabel::_bind_methods() { ClassDB::bind_method(D_METHOD("get_text"), &RichTextLabel::get_text); ClassDB::bind_method(D_METHOD("add_text", "text"), &RichTextLabel::add_text); ClassDB::bind_method(D_METHOD("set_text", "text"), &RichTextLabel::set_text); - ClassDB::bind_method(D_METHOD("add_image", "image:Texture"), &RichTextLabel::add_image); + ClassDB::bind_method(D_METHOD("add_image", "image"), &RichTextLabel::add_image); ClassDB::bind_method(D_METHOD("newline"), &RichTextLabel::add_newline); ClassDB::bind_method(D_METHOD("remove_line", "line"), &RichTextLabel::remove_line); - ClassDB::bind_method(D_METHOD("push_font", "font:Font"), &RichTextLabel::push_font); + ClassDB::bind_method(D_METHOD("push_font", "font"), &RichTextLabel::push_font); ClassDB::bind_method(D_METHOD("push_color", "color"), &RichTextLabel::push_color); ClassDB::bind_method(D_METHOD("push_align", "align"), &RichTextLabel::push_align); ClassDB::bind_method(D_METHOD("push_indent", "level"), &RichTextLabel::push_indent); @@ -1879,7 +1879,7 @@ void RichTextLabel::_bind_methods() { ClassDB::bind_method(D_METHOD("set_scroll_follow", "follow"), &RichTextLabel::set_scroll_follow); ClassDB::bind_method(D_METHOD("is_scroll_following"), &RichTextLabel::is_scroll_following); - ClassDB::bind_method(D_METHOD("get_v_scroll:VScrollBar"), &RichTextLabel::get_v_scroll); + ClassDB::bind_method(D_METHOD("get_v_scroll"), &RichTextLabel::get_v_scroll); ClassDB::bind_method(D_METHOD("scroll_to_line", "line"), &RichTextLabel::scroll_to_line); diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index cc1a637d2b..939bdd8d0c 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -187,14 +187,14 @@ void ScrollContainer::_update_scrollbar_pos() { Size2 hmin = h_scroll->get_combined_minimum_size(); Size2 vmin = v_scroll->get_combined_minimum_size(); - v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, vmin.width); + v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -vmin.width); v_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); v_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0); v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); h_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0); h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); - h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, hmin.height); + h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -hmin.height); h_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); h_scroll->raise(); diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 1ba6e6e4bd..c5b9df15b9 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -253,7 +253,7 @@ void SpinBox::_bind_methods() { ClassDB::bind_method(D_METHOD("set_editable", "editable"), &SpinBox::set_editable); ClassDB::bind_method(D_METHOD("is_editable"), &SpinBox::is_editable); ClassDB::bind_method(D_METHOD("_line_edit_focus_exit"), &SpinBox::_line_edit_focus_exit); - ClassDB::bind_method(D_METHOD("get_line_edit:LineEdit"), &SpinBox::get_line_edit); + ClassDB::bind_method(D_METHOD("get_line_edit"), &SpinBox::get_line_edit); ClassDB::bind_method(D_METHOD("_line_edit_input"), &SpinBox::_line_edit_input); ClassDB::bind_method(D_METHOD("_range_click_timeout"), &SpinBox::_range_click_timeout); diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 5ebcef3e8d..61a409d43e 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -371,8 +371,10 @@ void TabContainer::add_child_notify(Node *p_child) { if (tabs_visible) c->set_margin(MARGIN_TOP, _get_top_margin()); Ref<StyleBox> sb = get_stylebox("panel"); - for (int i = 0; i < 4; i++) - c->set_margin(Margin(i), c->get_margin(Margin(i)) + sb->get_margin(Margin(i))); + c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP))); + c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT))); + c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT))); + c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM))); update(); p_child->connect("renamed", this, "_child_renamed_callback"); @@ -402,8 +404,10 @@ void TabContainer::set_current_tab(int p_current) { c->set_area_as_parent_rect(); if (tabs_visible) c->set_margin(MARGIN_TOP, _get_top_margin()); - for (int i = 0; i < 4; i++) - c->set_margin(Margin(i), c->get_margin(Margin(i)) + sb->get_margin(Margin(i))); + c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP))); + c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT))); + c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT))); + c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM))); } else c->hide(); @@ -627,20 +631,20 @@ void TabContainer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_current_tab", "tab_idx"), &TabContainer::set_current_tab); ClassDB::bind_method(D_METHOD("get_current_tab"), &TabContainer::get_current_tab); ClassDB::bind_method(D_METHOD("get_previous_tab"), &TabContainer::get_previous_tab); - ClassDB::bind_method(D_METHOD("get_current_tab_control:Control"), &TabContainer::get_current_tab_control); - ClassDB::bind_method(D_METHOD("get_tab_control:Control", "idx"), &TabContainer::get_tab_control); + ClassDB::bind_method(D_METHOD("get_current_tab_control"), &TabContainer::get_current_tab_control); + ClassDB::bind_method(D_METHOD("get_tab_control", "idx"), &TabContainer::get_tab_control); ClassDB::bind_method(D_METHOD("set_tab_align", "align"), &TabContainer::set_tab_align); ClassDB::bind_method(D_METHOD("get_tab_align"), &TabContainer::get_tab_align); ClassDB::bind_method(D_METHOD("set_tabs_visible", "visible"), &TabContainer::set_tabs_visible); ClassDB::bind_method(D_METHOD("are_tabs_visible"), &TabContainer::are_tabs_visible); ClassDB::bind_method(D_METHOD("set_tab_title", "tab_idx", "title"), &TabContainer::set_tab_title); ClassDB::bind_method(D_METHOD("get_tab_title", "tab_idx"), &TabContainer::get_tab_title); - ClassDB::bind_method(D_METHOD("set_tab_icon", "tab_idx", "icon:Texture"), &TabContainer::set_tab_icon); - ClassDB::bind_method(D_METHOD("get_tab_icon:Texture", "tab_idx"), &TabContainer::get_tab_icon); + ClassDB::bind_method(D_METHOD("set_tab_icon", "tab_idx", "icon"), &TabContainer::set_tab_icon); + ClassDB::bind_method(D_METHOD("get_tab_icon", "tab_idx"), &TabContainer::get_tab_icon); ClassDB::bind_method(D_METHOD("set_tab_disabled", "tab_idx", "disabled"), &TabContainer::set_tab_disabled); ClassDB::bind_method(D_METHOD("get_tab_disabled", "tab_idx"), &TabContainer::get_tab_disabled); - ClassDB::bind_method(D_METHOD("set_popup", "popup:Popup"), &TabContainer::set_popup); - ClassDB::bind_method(D_METHOD("get_popup:Popup"), &TabContainer::get_popup); + ClassDB::bind_method(D_METHOD("set_popup", "popup"), &TabContainer::set_popup); + ClassDB::bind_method(D_METHOD("get_popup"), &TabContainer::get_popup); ClassDB::bind_method(D_METHOD("_child_renamed_callback"), &TabContainer::_child_renamed_callback); diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index a2deef4eea..acffbbc499 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -226,6 +226,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) { if (found != -1) { set_current_tab(found); + emit_signal("tab_clicked", found); } } } @@ -790,12 +791,12 @@ void Tabs::_bind_methods() { ClassDB::bind_method(D_METHOD("get_current_tab"), &Tabs::get_current_tab); ClassDB::bind_method(D_METHOD("set_tab_title", "tab_idx", "title"), &Tabs::set_tab_title); ClassDB::bind_method(D_METHOD("get_tab_title", "tab_idx"), &Tabs::get_tab_title); - ClassDB::bind_method(D_METHOD("set_tab_icon", "tab_idx", "icon:Texture"), &Tabs::set_tab_icon); - ClassDB::bind_method(D_METHOD("get_tab_icon:Texture", "tab_idx"), &Tabs::get_tab_icon); + ClassDB::bind_method(D_METHOD("set_tab_icon", "tab_idx", "icon"), &Tabs::set_tab_icon); + ClassDB::bind_method(D_METHOD("get_tab_icon", "tab_idx"), &Tabs::get_tab_icon); ClassDB::bind_method(D_METHOD("set_tab_disabled", "tab_idx", "disabled"), &Tabs::set_tab_disabled); ClassDB::bind_method(D_METHOD("get_tab_disabled", "tab_idx"), &Tabs::get_tab_disabled); ClassDB::bind_method(D_METHOD("remove_tab", "tab_idx"), &Tabs::remove_tab); - ClassDB::bind_method(D_METHOD("add_tab", "title", "icon:Texture"), &Tabs::add_tab, DEFVAL(""), DEFVAL(Ref<Texture>())); + ClassDB::bind_method(D_METHOD("add_tab", "title", "icon"), &Tabs::add_tab, DEFVAL(""), DEFVAL(Ref<Texture>())); ClassDB::bind_method(D_METHOD("set_tab_align", "align"), &Tabs::set_tab_align); ClassDB::bind_method(D_METHOD("get_tab_align"), &Tabs::get_tab_align); ClassDB::bind_method(D_METHOD("ensure_tab_visible", "idx"), &Tabs::ensure_tab_visible); @@ -809,6 +810,7 @@ void Tabs::_bind_methods() { ADD_SIGNAL(MethodInfo("tab_close", PropertyInfo(Variant::INT, "tab"))); ADD_SIGNAL(MethodInfo("tab_hover", PropertyInfo(Variant::INT, "tab"))); ADD_SIGNAL(MethodInfo("reposition_active_tab_request", PropertyInfo(Variant::INT, "idx_to"))); + ADD_SIGNAL(MethodInfo("tab_clicked", PropertyInfo(Variant::INT, "tab"))); ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "tab_close_display_policy", PROPERTY_HINT_ENUM, "Show Never,Show Active Only,Show Always"), "set_tab_close_display_policy", "get_tab_close_display_policy"); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index a7c31361e8..7b0d14c1a9 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -987,13 +987,41 @@ void TextEdit::_notification(int p_what) { } int caret_w = (str[j] == '\t') ? cache.font->get_char_size(' ').width : char_w; - if (draw_caret) { - if (insert_mode) { - int caret_h = (block_caret) ? 4 : 1; - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, caret_h)), cache.caret_color); - } else { - caret_w = (block_caret) ? caret_w : 1; - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, get_row_height())), cache.caret_color); + if (ime_text.length() > 0) { + int ofs = 0; + while (true) { + if (ofs >= ime_text.length()) + break; + + CharType cchar = ime_text[ofs]; + CharType next = ime_text[ofs + 1]; + int im_char_width = cache.font->get_char_size(cchar, next).width; + + if ((char_ofs + char_margin + im_char_width) >= xmargin_end) + break; + + bool selected = ofs >= ime_selection.x && ofs < ime_selection.x + ime_selection.y; + if (selected) { + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 3)), color); + } else { + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 1)), color); + } + + cache.font->draw_char(ci, Point2(char_ofs + char_margin, ofs_y + ascent), cchar, next, color); + + char_ofs += im_char_width; + ofs++; + } + } + if (ime_text.length() == 0) { + if (draw_caret) { + if (insert_mode) { + int caret_h = (block_caret) ? 4 : 1; + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, caret_h)), cache.caret_color); + } else { + caret_w = (block_caret) ? caret_w : 1; + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, get_row_height())), cache.caret_color); + } } } } @@ -1024,16 +1052,43 @@ void TextEdit::_notification(int p_what) { if (insert_mode) { cursor_pos.y += (get_row_height() - 3); } + if (ime_text.length() > 0) { + int ofs = 0; + while (true) { + if (ofs >= ime_text.length()) + break; - if (draw_caret) { - if (insert_mode) { - int char_w = cache.font->get_char_size(' ').width; - int caret_h = (block_caret) ? 4 : 1; - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(char_w, caret_h)), cache.caret_color); - } else { - int char_w = cache.font->get_char_size(' ').width; - int caret_w = (block_caret) ? char_w : 1; - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, get_row_height())), cache.caret_color); + CharType cchar = ime_text[ofs]; + CharType next = ime_text[ofs + 1]; + int im_char_width = cache.font->get_char_size(cchar, next).width; + + if ((char_ofs + char_margin + im_char_width) >= xmargin_end) + break; + + bool selected = ofs >= ime_selection.x && ofs < ime_selection.x + ime_selection.y; + if (selected) { + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 3)), color); + } else { + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 1)), color); + } + + cache.font->draw_char(ci, Point2(char_ofs + char_margin, ofs_y + ascent), cchar, next, color); + + char_ofs += im_char_width; + ofs++; + } + } + if (ime_text.length() == 0) { + if (draw_caret) { + if (insert_mode) { + int char_w = cache.font->get_char_size(' ').width; + int caret_h = (block_caret) ? 4 : 1; + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(char_w, caret_h)), cache.caret_color); + } else { + int char_w = cache.font->get_char_size(' ').width; + int caret_w = (block_caret) ? char_w : 1; + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, get_row_height())), cache.caret_color); + } } } } @@ -1197,6 +1252,7 @@ void TextEdit::_notification(int p_what) { if (has_focus()) { OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos + Point2(0, get_row_height())); + OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this); } } break; case NOTIFICATION_FOCUS_ENTER: { @@ -1207,6 +1263,7 @@ void TextEdit::_notification(int p_what) { Point2 cursor_pos = Point2(cursor_get_column(), cursor_get_line()) * get_row_height(); OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos); + OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this); if (OS::get_singleton()->has_virtual_keyboard()) OS::get_singleton()->show_virtual_keyboard(get_text(), get_global_rect()); @@ -1218,6 +1275,9 @@ void TextEdit::_notification(int p_what) { case NOTIFICATION_FOCUS_EXIT: { OS::get_singleton()->set_ime_position(Point2()); + OS::get_singleton()->set_ime_intermediate_text_callback(NULL, NULL); + ime_text = ""; + ime_selection = Point2(); if (OS::get_singleton()->has_virtual_keyboard()) OS::get_singleton()->hide_virtual_keyboard(); @@ -1228,6 +1288,13 @@ void TextEdit::_notification(int p_what) { } } +void TextEdit::_ime_text_callback(void *p_self, String p_text, Point2 p_selection) { + TextEdit *self = (TextEdit *)p_self; + self->ime_text = p_text; + self->ime_selection = p_selection; + self->update(); +} + void TextEdit::_consume_pair_symbol(CharType ch) { int cursor_position_to_move = cursor_get_column() + 1; @@ -4596,7 +4663,7 @@ void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("get_selection_to_column"), &TextEdit::get_selection_to_column); ClassDB::bind_method(D_METHOD("get_selection_text"), &TextEdit::get_selection_text); ClassDB::bind_method(D_METHOD("get_word_under_cursor"), &TextEdit::get_word_under_cursor); - ClassDB::bind_method(D_METHOD("search", "flags", "from_line", "from_column", "to_line", "to_column"), &TextEdit::_search_bind); + ClassDB::bind_method(D_METHOD("search", "key", "flags", "from_line", "from_column"), &TextEdit::_search_bind); ClassDB::bind_method(D_METHOD("undo"), &TextEdit::undo); ClassDB::bind_method(D_METHOD("redo"), &TextEdit::redo); @@ -4615,7 +4682,7 @@ void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("add_color_region", "begin_key", "end_key", "color", "line_only"), &TextEdit::add_color_region, DEFVAL(false)); ClassDB::bind_method(D_METHOD("clear_colors"), &TextEdit::clear_colors); ClassDB::bind_method(D_METHOD("menu_option", "option"), &TextEdit::menu_option); - ClassDB::bind_method(D_METHOD("get_menu:PopupMenu"), &TextEdit::get_menu); + ClassDB::bind_method(D_METHOD("get_menu"), &TextEdit::get_menu); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "syntax_highlighting"), "set_syntax_coloring", "is_syntax_coloring_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_line_numbers"), "set_show_line_numbers", "is_show_line_numbers_enabled"); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index f8f60d2b03..afb4b1c547 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -184,6 +184,9 @@ class TextEdit : public Control { bool chain_backward; }; + String ime_text; + Point2 ime_selection; + TextOperation current_op; List<TextOperation> undo_stack; @@ -299,6 +302,8 @@ class TextEdit : public Control { void _scroll_lines_up(); void _scroll_lines_down(); + static void _ime_text_callback(void *p_self, String p_text, Point2 p_selection); + //void mouse_motion(const Point& p_pos, const Point& p_rel, int p_button_mask); Size2 get_minimum_size() const; diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index 2912aa82fc..00849c4e5a 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -180,21 +180,21 @@ void TextureButton::_notification(int p_what) { void TextureButton::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_normal_texture", "texture:Texture"), &TextureButton::set_normal_texture); - ClassDB::bind_method(D_METHOD("set_pressed_texture", "texture:Texture"), &TextureButton::set_pressed_texture); - ClassDB::bind_method(D_METHOD("set_hover_texture", "texture:Texture"), &TextureButton::set_hover_texture); - ClassDB::bind_method(D_METHOD("set_disabled_texture", "texture:Texture"), &TextureButton::set_disabled_texture); - ClassDB::bind_method(D_METHOD("set_focused_texture", "texture:Texture"), &TextureButton::set_focused_texture); - ClassDB::bind_method(D_METHOD("set_click_mask", "mask:BitMap"), &TextureButton::set_click_mask); + ClassDB::bind_method(D_METHOD("set_normal_texture", "texture"), &TextureButton::set_normal_texture); + ClassDB::bind_method(D_METHOD("set_pressed_texture", "texture"), &TextureButton::set_pressed_texture); + ClassDB::bind_method(D_METHOD("set_hover_texture", "texture"), &TextureButton::set_hover_texture); + ClassDB::bind_method(D_METHOD("set_disabled_texture", "texture"), &TextureButton::set_disabled_texture); + ClassDB::bind_method(D_METHOD("set_focused_texture", "texture"), &TextureButton::set_focused_texture); + ClassDB::bind_method(D_METHOD("set_click_mask", "mask"), &TextureButton::set_click_mask); ClassDB::bind_method(D_METHOD("set_expand", "p_expand"), &TextureButton::set_expand); ClassDB::bind_method(D_METHOD("set_stretch_mode", "p_mode"), &TextureButton::set_stretch_mode); - ClassDB::bind_method(D_METHOD("get_normal_texture:Texture"), &TextureButton::get_normal_texture); - ClassDB::bind_method(D_METHOD("get_pressed_texture:Texture"), &TextureButton::get_pressed_texture); - ClassDB::bind_method(D_METHOD("get_hover_texture:Texture"), &TextureButton::get_hover_texture); - ClassDB::bind_method(D_METHOD("get_disabled_texture:Texture"), &TextureButton::get_disabled_texture); - ClassDB::bind_method(D_METHOD("get_focused_texture:Texture"), &TextureButton::get_focused_texture); - ClassDB::bind_method(D_METHOD("get_click_mask:BitMap"), &TextureButton::get_click_mask); + ClassDB::bind_method(D_METHOD("get_normal_texture"), &TextureButton::get_normal_texture); + ClassDB::bind_method(D_METHOD("get_pressed_texture"), &TextureButton::get_pressed_texture); + ClassDB::bind_method(D_METHOD("get_hover_texture"), &TextureButton::get_hover_texture); + ClassDB::bind_method(D_METHOD("get_disabled_texture"), &TextureButton::get_disabled_texture); + ClassDB::bind_method(D_METHOD("get_focused_texture"), &TextureButton::get_focused_texture); + ClassDB::bind_method(D_METHOD("get_click_mask"), &TextureButton::get_click_mask); ClassDB::bind_method(D_METHOD("get_expand"), &TextureButton::get_expand); ClassDB::bind_method(D_METHOD("get_stretch_mode"), &TextureButton::get_stretch_mode); diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp index 40995b19fa..081c7ddb73 100644 --- a/scene/gui/texture_progress.cpp +++ b/scene/gui/texture_progress.cpp @@ -242,14 +242,14 @@ Point2 TextureProgress::get_radial_center_offset() { void TextureProgress::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_under_texture", "tex:Texture"), &TextureProgress::set_under_texture); - ClassDB::bind_method(D_METHOD("get_under_texture:Texture"), &TextureProgress::get_under_texture); + ClassDB::bind_method(D_METHOD("set_under_texture", "tex"), &TextureProgress::set_under_texture); + ClassDB::bind_method(D_METHOD("get_under_texture"), &TextureProgress::get_under_texture); - ClassDB::bind_method(D_METHOD("set_progress_texture", "tex:Texture"), &TextureProgress::set_progress_texture); - ClassDB::bind_method(D_METHOD("get_progress_texture:Texture"), &TextureProgress::get_progress_texture); + ClassDB::bind_method(D_METHOD("set_progress_texture", "tex"), &TextureProgress::set_progress_texture); + ClassDB::bind_method(D_METHOD("get_progress_texture"), &TextureProgress::get_progress_texture); - ClassDB::bind_method(D_METHOD("set_over_texture", "tex:Texture"), &TextureProgress::set_over_texture); - ClassDB::bind_method(D_METHOD("get_over_texture:Texture"), &TextureProgress::get_over_texture); + ClassDB::bind_method(D_METHOD("set_over_texture", "tex"), &TextureProgress::set_over_texture); + ClassDB::bind_method(D_METHOD("get_over_texture"), &TextureProgress::get_over_texture); ClassDB::bind_method(D_METHOD("set_fill_mode", "mode"), &TextureProgress::set_fill_mode); ClassDB::bind_method(D_METHOD("get_fill_mode"), &TextureProgress::get_fill_mode); diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp index 9459002bc0..92a3db6a74 100644 --- a/scene/gui/texture_rect.cpp +++ b/scene/gui/texture_rect.cpp @@ -101,8 +101,8 @@ Size2 TextureRect::get_minimum_size() const { } void TextureRect::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &TextureRect::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &TextureRect::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &TextureRect::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &TextureRect::get_texture); ClassDB::bind_method(D_METHOD("set_expand", "enable"), &TextureRect::set_expand); ClassDB::bind_method(D_METHOD("has_expand"), &TextureRect::has_expand); ClassDB::bind_method(D_METHOD("set_stretch_mode", "stretch_mode"), &TextureRect::set_stretch_mode); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 0ce29b7472..fa499ff277 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -680,8 +680,8 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_text", "column", "text"), &TreeItem::set_text); ClassDB::bind_method(D_METHOD("get_text", "column"), &TreeItem::get_text); - ClassDB::bind_method(D_METHOD("set_icon", "column", "texture:Texture"), &TreeItem::set_icon); - ClassDB::bind_method(D_METHOD("get_icon:Texture", "column"), &TreeItem::get_icon); + ClassDB::bind_method(D_METHOD("set_icon", "column", "texture"), &TreeItem::set_icon); + ClassDB::bind_method(D_METHOD("get_icon", "column"), &TreeItem::get_icon); ClassDB::bind_method(D_METHOD("set_icon_region", "column", "region"), &TreeItem::set_icon_region); ClassDB::bind_method(D_METHOD("get_icon_region", "column"), &TreeItem::get_icon_region); @@ -702,13 +702,13 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_collapsed", "enable"), &TreeItem::set_collapsed); ClassDB::bind_method(D_METHOD("is_collapsed"), &TreeItem::is_collapsed); - ClassDB::bind_method(D_METHOD("get_next:TreeItem"), &TreeItem::get_next); - ClassDB::bind_method(D_METHOD("get_prev:TreeItem"), &TreeItem::get_prev); - ClassDB::bind_method(D_METHOD("get_parent:TreeItem"), &TreeItem::get_parent); - ClassDB::bind_method(D_METHOD("get_children:TreeItem"), &TreeItem::get_children); + ClassDB::bind_method(D_METHOD("get_next"), &TreeItem::get_next); + ClassDB::bind_method(D_METHOD("get_prev"), &TreeItem::get_prev); + ClassDB::bind_method(D_METHOD("get_parent"), &TreeItem::get_parent); + ClassDB::bind_method(D_METHOD("get_children"), &TreeItem::get_children); - ClassDB::bind_method(D_METHOD("get_next_visible:TreeItem"), &TreeItem::get_next_visible); - ClassDB::bind_method(D_METHOD("get_prev_visible:TreeItem"), &TreeItem::get_prev_visible); + ClassDB::bind_method(D_METHOD("get_next_visible"), &TreeItem::get_next_visible); + ClassDB::bind_method(D_METHOD("get_prev_visible"), &TreeItem::get_prev_visible); ClassDB::bind_method(D_METHOD("remove_child", "child"), &TreeItem::_remove_child); @@ -732,10 +732,10 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_custom_as_button", "column", "enable"), &TreeItem::set_custom_as_button); ClassDB::bind_method(D_METHOD("is_custom_set_as_button", "column"), &TreeItem::is_custom_set_as_button); - ClassDB::bind_method(D_METHOD("add_button", "column", "button:Texture", "button_idx", "disabled", "tooltip"), &TreeItem::add_button, DEFVAL(-1), DEFVAL(false), DEFVAL("")); + ClassDB::bind_method(D_METHOD("add_button", "column", "button", "button_idx", "disabled", "tooltip"), &TreeItem::add_button, DEFVAL(-1), DEFVAL(false), DEFVAL("")); ClassDB::bind_method(D_METHOD("get_button_count", "column"), &TreeItem::get_button_count); - ClassDB::bind_method(D_METHOD("get_button:Texture", "column", "button_idx"), &TreeItem::get_button); - ClassDB::bind_method(D_METHOD("set_button", "column", "button_idx", "button:Texture"), &TreeItem::set_button); + ClassDB::bind_method(D_METHOD("get_button", "column", "button_idx"), &TreeItem::get_button); + ClassDB::bind_method(D_METHOD("set_button", "column", "button_idx", "button"), &TreeItem::set_button); ClassDB::bind_method(D_METHOD("erase_button", "column", "button_idx"), &TreeItem::erase_button); ClassDB::bind_method(D_METHOD("is_button_disabled", "column", "button_idx"), &TreeItem::is_button_disabled); @@ -1478,7 +1478,7 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c if (!r_in_range && &selected_cell == &c) { - if (!selected_cell.selected) { + if (!selected_cell.selected || force_select_on_already_selected) { selected_cell.selected = true; @@ -1856,13 +1856,14 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool bring_up_editor = false; + custom_popup_rect = Rect2i(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h)); + if (on_arrow || !p_item->cells[col].custom_button) { - custom_popup_rect = Rect2i(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h)); emit_signal("custom_popup_edited", ((bool)(x >= (col_width - item_h / 2)))); } if (!p_item->cells[col].custom_button || !on_arrow) { - item_edited(col, p_item); + item_edited(col, p_item, p_button == BUTTON_LEFT); } click_handled = true; return -1; @@ -2925,11 +2926,14 @@ TreeItem *Tree::get_last_item() { return last; } -void Tree::item_edited(int p_column, TreeItem *p_item) { +void Tree::item_edited(int p_column, TreeItem *p_item, bool p_lmb) { edited_item = p_item; edited_col = p_column; - emit_signal("item_edited"); + if (p_lmb) + emit_signal("item_edited"); + else + emit_signal("item_rmb_edited"); } void Tree::item_changed(int p_column, TreeItem *p_item) { @@ -3594,16 +3598,16 @@ void Tree::_bind_methods() { ClassDB::bind_method(D_METHOD("_scroll_moved"), &Tree::_scroll_moved); ClassDB::bind_method(D_METHOD("clear"), &Tree::clear); - ClassDB::bind_method(D_METHOD("create_item:TreeItem", "parent:TreeItem"), &Tree::_create_item, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("create_item", "parent"), &Tree::_create_item, DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("get_root:TreeItem"), &Tree::get_root); + ClassDB::bind_method(D_METHOD("get_root"), &Tree::get_root); ClassDB::bind_method(D_METHOD("set_column_min_width", "column", "min_width"), &Tree::set_column_min_width); ClassDB::bind_method(D_METHOD("set_column_expand", "column", "expand"), &Tree::set_column_expand); ClassDB::bind_method(D_METHOD("get_column_width", "column"), &Tree::get_column_width); ClassDB::bind_method(D_METHOD("set_hide_root", "enable"), &Tree::set_hide_root); - ClassDB::bind_method(D_METHOD("get_next_selected:TreeItem", "from:TreeItem"), &Tree::_get_next_selected); - ClassDB::bind_method(D_METHOD("get_selected:TreeItem"), &Tree::get_selected); + ClassDB::bind_method(D_METHOD("get_next_selected", "from"), &Tree::_get_next_selected); + ClassDB::bind_method(D_METHOD("get_selected"), &Tree::get_selected); ClassDB::bind_method(D_METHOD("get_selected_column"), &Tree::get_selected_column); ClassDB::bind_method(D_METHOD("get_pressed_button"), &Tree::get_pressed_button); ClassDB::bind_method(D_METHOD("set_select_mode", "mode"), &Tree::set_select_mode); @@ -3611,11 +3615,11 @@ void Tree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_columns", "amount"), &Tree::set_columns); ClassDB::bind_method(D_METHOD("get_columns"), &Tree::get_columns); - ClassDB::bind_method(D_METHOD("get_edited:TreeItem"), &Tree::get_edited); + ClassDB::bind_method(D_METHOD("get_edited"), &Tree::get_edited); ClassDB::bind_method(D_METHOD("get_edited_column"), &Tree::get_edited_column); ClassDB::bind_method(D_METHOD("get_custom_popup_rect"), &Tree::get_custom_popup_rect); - ClassDB::bind_method(D_METHOD("get_item_area_rect", "item:TreeItem", "column"), &Tree::_get_item_rect, DEFVAL(-1)); - ClassDB::bind_method(D_METHOD("get_item_at_pos:TreeItem", "pos"), &Tree::get_item_at_pos); + ClassDB::bind_method(D_METHOD("get_item_area_rect", "item", "column"), &Tree::_get_item_rect, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("get_item_at_pos", "pos"), &Tree::get_item_at_pos); ClassDB::bind_method(D_METHOD("get_column_at_pos", "pos"), &Tree::get_column_at_pos); ClassDB::bind_method(D_METHOD("ensure_cursor_is_visible"), &Tree::ensure_cursor_is_visible); @@ -3645,6 +3649,7 @@ void Tree::_bind_methods() { ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::VECTOR2, "pos"))); ADD_SIGNAL(MethodInfo("empty_tree_rmb_selected", PropertyInfo(Variant::VECTOR2, "pos"))); ADD_SIGNAL(MethodInfo("item_edited")); + ADD_SIGNAL(MethodInfo("item_rmb_edited")); ADD_SIGNAL(MethodInfo("item_custom_button_pressed")); ADD_SIGNAL(MethodInfo("item_double_clicked")); ADD_SIGNAL(MethodInfo("item_collapsed", PropertyInfo(Variant::OBJECT, "item"))); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 694f91f9a6..d3715c3c43 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -381,7 +381,7 @@ private: Size2 get_minimum_size() const; - void item_edited(int p_column, TreeItem *p_item); + void item_edited(int p_column, TreeItem *p_item, bool p_lmb = true); void item_changed(int p_column, TreeItem *p_item); void item_selected(int p_column, TreeItem *p_item); void item_deselected(int p_column, TreeItem *p_item); diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index e1a149d801..9c018a4e7c 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -348,8 +348,8 @@ bool VideoPlayer::has_autoplay() const { void VideoPlayer::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_stream", "stream:VideoStream"), &VideoPlayer::set_stream); - ClassDB::bind_method(D_METHOD("get_stream:VideoStream"), &VideoPlayer::get_stream); + ClassDB::bind_method(D_METHOD("set_stream", "stream"), &VideoPlayer::set_stream); + ClassDB::bind_method(D_METHOD("get_stream"), &VideoPlayer::get_stream); ClassDB::bind_method(D_METHOD("play"), &VideoPlayer::play); ClassDB::bind_method(D_METHOD("stop"), &VideoPlayer::stop); @@ -381,7 +381,7 @@ void VideoPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_buffering_msec", "msec"), &VideoPlayer::set_buffering_msec); ClassDB::bind_method(D_METHOD("get_buffering_msec"), &VideoPlayer::get_buffering_msec); - ClassDB::bind_method(D_METHOD("get_video_texture:Texture"), &VideoPlayer::get_video_texture); + ClassDB::bind_method(D_METHOD("get_video_texture"), &VideoPlayer::get_video_texture); ADD_PROPERTY(PropertyInfo(Variant::INT, "audio_track", PROPERTY_HINT_RANGE, "0,128,1"), "set_audio_track", "get_audio_track"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "VideoStream"), "set_stream", "get_stream"); diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index 0ee57bd794..77407fdde7 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -262,10 +262,10 @@ void CanvasLayer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_scale", "scale"), &CanvasLayer::set_scale); ClassDB::bind_method(D_METHOD("get_scale"), &CanvasLayer::get_scale); - ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport:Viewport"), &CanvasLayer::set_custom_viewport); - ClassDB::bind_method(D_METHOD("get_custom_viewport:Viewport"), &CanvasLayer::get_custom_viewport); + ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport"), &CanvasLayer::set_custom_viewport); + ClassDB::bind_method(D_METHOD("get_custom_viewport"), &CanvasLayer::get_custom_viewport); - ClassDB::bind_method(D_METHOD("get_world_2d:World2D"), &CanvasLayer::get_world_2d); + ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasLayer::get_world_2d); //ClassDB::bind_method(D_METHOD("get_viewport"),&CanvasLayer::get_viewport); ADD_PROPERTY(PropertyInfo(Variant::INT, "layer", PROPERTY_HINT_RANGE, "-128,128,1"), "set_layer", "get_layer"); diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp index 8668020b2c..5580ef486e 100644 --- a/scene/main/instance_placeholder.cpp +++ b/scene/main/instance_placeholder.cpp @@ -123,7 +123,7 @@ Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) { void InstancePlaceholder::_bind_methods() { ClassDB::bind_method(D_METHOD("get_stored_values", "with_order"), &InstancePlaceholder::get_stored_values, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("replace_by_instance", "custom_scene:PackedScene"), &InstancePlaceholder::replace_by_instance, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("replace_by_instance", "custom_scene"), &InstancePlaceholder::replace_by_instance, DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("get_instance_path"), &InstancePlaceholder::get_instance_path); } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 6999091609..0d872d906e 100755 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2724,36 +2724,36 @@ void Node::_bind_methods() { GLOBAL_DEF("node/name_casing", NAME_CASING_PASCAL_CASE); ProjectSettings::get_singleton()->set_custom_property_info("node/name_casing", PropertyInfo(Variant::INT, "node/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case")); - ClassDB::bind_method(D_METHOD("_add_child_below_node", "node:Node", "child_node:Node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("_add_child_below_node", "node", "child_node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false)); ClassDB::bind_method(D_METHOD("set_name", "name"), &Node::set_name); ClassDB::bind_method(D_METHOD("get_name"), &Node::get_name); - ClassDB::bind_method(D_METHOD("add_child", "node:Node", "legible_unique_name"), &Node::add_child, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("remove_child", "node:Node"), &Node::remove_child); - //ClassDB::bind_method(D_METHOD("remove_and_delete_child","node:Node"),&Node::remove_and_delete_child); + ClassDB::bind_method(D_METHOD("add_child", "node", "legible_unique_name"), &Node::add_child, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("remove_child", "node"), &Node::remove_child); + //ClassDB::bind_method(D_METHOD("remove_and_delete_child","node"),&Node::remove_and_delete_child); ClassDB::bind_method(D_METHOD("get_child_count"), &Node::get_child_count); ClassDB::bind_method(D_METHOD("get_children"), &Node::_get_children); - ClassDB::bind_method(D_METHOD("get_child:Node", "idx"), &Node::get_child); + ClassDB::bind_method(D_METHOD("get_child", "idx"), &Node::get_child); ClassDB::bind_method(D_METHOD("has_node", "path"), &Node::has_node); - ClassDB::bind_method(D_METHOD("get_node:Node", "path"), &Node::get_node); - ClassDB::bind_method(D_METHOD("get_parent:Node"), &Node::get_parent); - ClassDB::bind_method(D_METHOD("find_node:Node", "mask", "recursive", "owned"), &Node::find_node, DEFVAL(true), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("get_node", "path"), &Node::get_node); + ClassDB::bind_method(D_METHOD("get_parent"), &Node::get_parent); + ClassDB::bind_method(D_METHOD("find_node", "mask", "recursive", "owned"), &Node::find_node, DEFVAL(true), DEFVAL(true)); ClassDB::bind_method(D_METHOD("has_node_and_resource", "path"), &Node::has_node_and_resource); ClassDB::bind_method(D_METHOD("get_node_and_resource", "path"), &Node::_get_node_and_resource); ClassDB::bind_method(D_METHOD("is_inside_tree"), &Node::is_inside_tree); - ClassDB::bind_method(D_METHOD("is_a_parent_of", "node:Node"), &Node::is_a_parent_of); - ClassDB::bind_method(D_METHOD("is_greater_than", "node:Node"), &Node::is_greater_than); + ClassDB::bind_method(D_METHOD("is_a_parent_of", "node"), &Node::is_a_parent_of); + ClassDB::bind_method(D_METHOD("is_greater_than", "node"), &Node::is_greater_than); ClassDB::bind_method(D_METHOD("get_path"), &Node::get_path); - ClassDB::bind_method(D_METHOD("get_path_to", "node:Node"), &Node::get_path_to); + ClassDB::bind_method(D_METHOD("get_path_to", "node"), &Node::get_path_to); ClassDB::bind_method(D_METHOD("add_to_group", "group", "persistent"), &Node::add_to_group, DEFVAL(false)); ClassDB::bind_method(D_METHOD("remove_from_group", "group"), &Node::remove_from_group); ClassDB::bind_method(D_METHOD("is_in_group", "group"), &Node::is_in_group); - ClassDB::bind_method(D_METHOD("move_child", "child_node:Node", "to_pos"), &Node::move_child); + ClassDB::bind_method(D_METHOD("move_child", "child_node", "to_pos"), &Node::move_child); ClassDB::bind_method(D_METHOD("get_groups"), &Node::_get_groups); ClassDB::bind_method(D_METHOD("raise"), &Node::raise); - ClassDB::bind_method(D_METHOD("set_owner", "owner:Node"), &Node::set_owner); - ClassDB::bind_method(D_METHOD("get_owner:Node"), &Node::get_owner); + ClassDB::bind_method(D_METHOD("set_owner", "owner"), &Node::set_owner); + ClassDB::bind_method(D_METHOD("get_owner"), &Node::get_owner); ClassDB::bind_method(D_METHOD("remove_and_skip"), &Node::remove_and_skip); ClassDB::bind_method(D_METHOD("get_index"), &Node::get_index); ClassDB::bind_method(D_METHOD("print_tree"), &Node::print_tree); @@ -2786,15 +2786,15 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("set_fixed_process_internal", "enable"), &Node::set_fixed_process_internal); ClassDB::bind_method(D_METHOD("is_fixed_processing_internal"), &Node::is_fixed_processing_internal); - ClassDB::bind_method(D_METHOD("get_tree:SceneTree"), &Node::get_tree); + ClassDB::bind_method(D_METHOD("get_tree"), &Node::get_tree); - ClassDB::bind_method(D_METHOD("duplicate:Node", "flags"), &Node::duplicate, DEFVAL(DUPLICATE_USE_INSTANCING | DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS)); - ClassDB::bind_method(D_METHOD("replace_by", "node:Node", "keep_data"), &Node::replace_by, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("duplicate", "flags"), &Node::duplicate, DEFVAL(DUPLICATE_USE_INSTANCING | DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS)); + ClassDB::bind_method(D_METHOD("replace_by", "node", "keep_data"), &Node::replace_by, DEFVAL(false)); ClassDB::bind_method(D_METHOD("set_scene_instance_load_placeholder", "load_placeholder"), &Node::set_scene_instance_load_placeholder); ClassDB::bind_method(D_METHOD("get_scene_instance_load_placeholder"), &Node::get_scene_instance_load_placeholder); - ClassDB::bind_method(D_METHOD("get_viewport:Viewport"), &Node::get_viewport); + ClassDB::bind_method(D_METHOD("get_viewport"), &Node::get_viewport); ClassDB::bind_method(D_METHOD("queue_free"), &Node::queue_delete); @@ -2833,10 +2833,10 @@ void Node::_bind_methods() { ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "rpc_unreliable_id", &Node::_rpc_unreliable_id_bind, mi); } - ClassDB::bind_method(D_METHOD("rset", "property", "value:Variant"), &Node::rset); - ClassDB::bind_method(D_METHOD("rset_id", "peer_id", "property", "value:Variant"), &Node::rset_id); - ClassDB::bind_method(D_METHOD("rset_unreliable", "property", "value:Variant"), &Node::rset_unreliable); - ClassDB::bind_method(D_METHOD("rset_unreliable_id", "peer_id", "property", "value:Variant"), &Node::rset_unreliable_id); + ClassDB::bind_method(D_METHOD("rset", "property", "value"), &Node::rset); + ClassDB::bind_method(D_METHOD("rset_id", "peer_id", "property", "value"), &Node::rset_id); + ClassDB::bind_method(D_METHOD("rset_unreliable", "property", "value"), &Node::rset_unreliable); + ClassDB::bind_method(D_METHOD("rset_unreliable_id", "peer_id", "property", "value"), &Node::rset_unreliable_id); BIND_CONSTANT(NOTIFICATION_ENTER_TREE); BIND_CONSTANT(NOTIFICATION_EXIT_TREE); diff --git a/scene/main/resource_preloader.cpp b/scene/main/resource_preloader.cpp index febb95a181..ae323ba021 100644 --- a/scene/main/resource_preloader.cpp +++ b/scene/main/resource_preloader.cpp @@ -153,11 +153,11 @@ void ResourcePreloader::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_resources"), &ResourcePreloader::_set_resources); ClassDB::bind_method(D_METHOD("_get_resources"), &ResourcePreloader::_get_resources); - ClassDB::bind_method(D_METHOD("add_resource", "name", "resource:Resource"), &ResourcePreloader::add_resource); + ClassDB::bind_method(D_METHOD("add_resource", "name", "resource"), &ResourcePreloader::add_resource); ClassDB::bind_method(D_METHOD("remove_resource", "name"), &ResourcePreloader::remove_resource); ClassDB::bind_method(D_METHOD("rename_resource", "name", "newname"), &ResourcePreloader::rename_resource); ClassDB::bind_method(D_METHOD("has_resource", "name"), &ResourcePreloader::has_resource); - ClassDB::bind_method(D_METHOD("get_resource:Resource", "name"), &ResourcePreloader::get_resource); + ClassDB::bind_method(D_METHOD("get_resource", "name"), &ResourcePreloader::get_resource); ClassDB::bind_method(D_METHOD("get_resource_list"), &ResourcePreloader::_get_resource_list); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "resources", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_resources", "_get_resources"); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index d800c24e10..66eafa1070 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -801,11 +801,11 @@ Ref<Material> SceneTree::get_debug_navigation_material() { return navigation_material; Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial)); - /* line_material->set_flag(Material::FLAG_UNSHADED, true); - line_material->set_line_width(3.0); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_color());*/ + line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true); + line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); + line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + line_material->set_albedo(get_debug_navigation_color()); navigation_material = line_material; @@ -818,11 +818,11 @@ Ref<Material> SceneTree::get_debug_navigation_disabled_material() { return navigation_disabled_material; Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial)); - /* line_material->set_flag(Material::FLAG_UNSHADED, true); - line_material->set_line_width(3.0); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color());*/ + line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true); + line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); + line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + line_material->set_albedo(get_debug_navigation_disabled_color()); navigation_disabled_material = line_material; @@ -834,11 +834,11 @@ Ref<Material> SceneTree::get_debug_collision_material() { return collision_material; Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial)); - /*line_material->set_flag(Material::FLAG_UNSHADED, true); - line_material->set_line_width(3.0); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_collisions_color());*/ + line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true); + line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); + line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + line_material->set_albedo(get_debug_collisions_color()); collision_material = line_material; @@ -852,11 +852,12 @@ Ref<ArrayMesh> SceneTree::get_debug_contact_mesh() { debug_contact_mesh = Ref<ArrayMesh>(memnew(ArrayMesh)); - Ref<SpatialMaterial> mat = memnew(SpatialMaterial); - /*mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA,true); - mat->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color());*/ + Ref<SpatialMaterial> mat = Ref<SpatialMaterial>(memnew(SpatialMaterial)); + mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true); + mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); + mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + mat->set_albedo(get_debug_collision_contact_color()); Vector3 diamond[6] = { Vector3(-1, 0, 0), @@ -1181,7 +1182,7 @@ void SceneTree::_update_root_rect() { } else if (viewport_aspect < video_mode_aspect) { // screen ratio is smaller vertically - if (stretch_aspect == STRETCH_ASPECT_KEEP_HEIGHT) { + if (stretch_aspect == STRETCH_ASPECT_KEEP_HEIGHT || stretch_aspect == STRETCH_ASPECT_EXPAND) { //will stretch horizontally viewport_size.x = desired_res.y * video_mode_aspect; @@ -1196,7 +1197,7 @@ void SceneTree::_update_root_rect() { } } else { //screen ratio is smaller horizontally - if (stretch_aspect == STRETCH_ASPECT_KEEP_WIDTH) { + if (stretch_aspect == STRETCH_ASPECT_KEEP_WIDTH || stretch_aspect == STRETCH_ASPECT_EXPAND) { //will stretch horizontally viewport_size.x = desired_res.x; @@ -1217,12 +1218,11 @@ void SceneTree::_update_root_rect() { Size2 margin; Size2 offset; //black bars and margin - if (screen_size.x < video_mode.x) { + if (stretch_aspect != STRETCH_ASPECT_EXPAND && screen_size.x < video_mode.x) { margin.x = Math::round((video_mode.x - screen_size.x) / 2.0); VisualServer::get_singleton()->black_bars_set_margins(margin.x, 0, margin.x, 0); offset.x = Math::round(margin.x * viewport_size.y / screen_size.y); - } else if (screen_size.y < video_mode.y) { - + } else if (stretch_aspect != STRETCH_ASPECT_EXPAND && screen_size.y < video_mode.y) { margin.y = Math::round((video_mode.y - screen_size.y) / 2.0); VisualServer::get_singleton()->black_bars_set_margins(0, margin.y, 0, margin.y); offset.y = Math::round(margin.y * viewport_size.x / screen_size.x); @@ -2184,7 +2184,7 @@ void SceneTree::_bind_methods() { //ClassDB::bind_method(D_METHOD("call_group","call_flags","group","method","arg1","arg2"),&SceneMainLoop::_call_group,DEFVAL(Variant()),DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("get_root:Viewport"), &SceneTree::get_root); + ClassDB::bind_method(D_METHOD("get_root"), &SceneTree::get_root); ClassDB::bind_method(D_METHOD("has_group", "name"), &SceneTree::has_group); ClassDB::bind_method(D_METHOD("set_auto_accept_quit", "enabled"), &SceneTree::set_auto_accept_quit); @@ -2197,8 +2197,8 @@ void SceneTree::_bind_methods() { ClassDB::bind_method(D_METHOD("is_debugging_navigation_hint"), &SceneTree::is_debugging_navigation_hint); #ifdef TOOLS_ENABLED - ClassDB::bind_method(D_METHOD("set_edited_scene_root", "scene:Node"), &SceneTree::set_edited_scene_root); - ClassDB::bind_method(D_METHOD("get_edited_scene_root:Node"), &SceneTree::get_edited_scene_root); + ClassDB::bind_method(D_METHOD("set_edited_scene_root", "scene"), &SceneTree::set_edited_scene_root); + ClassDB::bind_method(D_METHOD("get_edited_scene_root"), &SceneTree::get_edited_scene_root); #endif ClassDB::bind_method(D_METHOD("set_pause", "enable"), &SceneTree::set_pause); @@ -2206,7 +2206,7 @@ void SceneTree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_input_as_handled"), &SceneTree::set_input_as_handled); ClassDB::bind_method(D_METHOD("is_input_handled"), &SceneTree::is_input_handled); - ClassDB::bind_method(D_METHOD("create_timer:SceneTreeTimer", "time_sec", "pause_mode_process"), &SceneTree::create_timer, DEFVAL(true)); + ClassDB::bind_method(D_METHOD("create_timer", "time_sec", "pause_mode_process"), &SceneTree::create_timer, DEFVAL(true)); ClassDB::bind_method(D_METHOD("get_node_count"), &SceneTree::get_node_count); ClassDB::bind_method(D_METHOD("get_frame"), &SceneTree::get_frame); @@ -2234,22 +2234,22 @@ void SceneTree::_bind_methods() { ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "call_group", &SceneTree::_call_group, mi2); - ClassDB::bind_method(D_METHOD("notify_group", "call_flags", "group", "notification"), &SceneTree::notify_group); - ClassDB::bind_method(D_METHOD("set_group", "call_flags", "group", "property", "value"), &SceneTree::set_group); + ClassDB::bind_method(D_METHOD("notify_group", "group", "notification"), &SceneTree::notify_group); + ClassDB::bind_method(D_METHOD("set_group", "group", "property", "value"), &SceneTree::set_group); ClassDB::bind_method(D_METHOD("get_nodes_in_group", "group"), &SceneTree::_get_nodes_in_group); - ClassDB::bind_method(D_METHOD("set_current_scene", "child_node:Node"), &SceneTree::set_current_scene); - ClassDB::bind_method(D_METHOD("get_current_scene:Node"), &SceneTree::get_current_scene); + ClassDB::bind_method(D_METHOD("set_current_scene", "child_node"), &SceneTree::set_current_scene); + ClassDB::bind_method(D_METHOD("get_current_scene"), &SceneTree::get_current_scene); ClassDB::bind_method(D_METHOD("change_scene", "path"), &SceneTree::change_scene); - ClassDB::bind_method(D_METHOD("change_scene_to", "packed_scene:PackedScene"), &SceneTree::change_scene_to); + ClassDB::bind_method(D_METHOD("change_scene_to", "packed_scene"), &SceneTree::change_scene_to); ClassDB::bind_method(D_METHOD("reload_current_scene"), &SceneTree::reload_current_scene); ClassDB::bind_method(D_METHOD("_change_scene"), &SceneTree::_change_scene); - ClassDB::bind_method(D_METHOD("set_network_peer", "peer:NetworkedMultiplayerPeer"), &SceneTree::set_network_peer); + ClassDB::bind_method(D_METHOD("set_network_peer", "peer"), &SceneTree::set_network_peer); ClassDB::bind_method(D_METHOD("is_network_server"), &SceneTree::is_network_server); ClassDB::bind_method(D_METHOD("has_network_peer"), &SceneTree::has_network_peer); ClassDB::bind_method(D_METHOD("get_network_connected_peers"), &SceneTree::get_network_connected_peers); diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index 90d42ef01b..3543ebee90 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -90,6 +90,7 @@ public: STRETCH_ASPECT_KEEP, STRETCH_ASPECT_KEEP_WIDTH, STRETCH_ASPECT_KEEP_HEIGHT, + STRETCH_ASPECT_EXPAND, }; private: diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index ee9323ca1d..a22d897669 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1473,8 +1473,8 @@ void Viewport::_gui_show_tooltip() { gui.tooltip_label->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_LEFT)); gui.tooltip_label->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_TOP)); - gui.tooltip_label->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, ttp->get_margin(MARGIN_RIGHT)); - gui.tooltip_label->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, ttp->get_margin(MARGIN_BOTTOM)); + gui.tooltip_label->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -ttp->get_margin(MARGIN_RIGHT)); + gui.tooltip_label->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -ttp->get_margin(MARGIN_BOTTOM)); gui.tooltip_label->set_text(tooltip); Rect2 r(gui.tooltip_pos + Point2(10, 10), gui.tooltip_label->get_combined_minimum_size() + ttp->get_minimum_size()); Rect2 vr = gui.tooltip_label->get_viewport_rect(); @@ -1932,8 +1932,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { Control *top = gui.modal_stack.back()->get(); if (over != top && !top->is_a_parent_of(over)) { - - return; // don't send motion event to anything below modal stack top + over = NULL; //nothing can be found outside the modal stack } } @@ -2641,12 +2640,12 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("set_size", "size"), &Viewport::set_size); ClassDB::bind_method(D_METHOD("get_size"), &Viewport::get_size); - ClassDB::bind_method(D_METHOD("set_world_2d", "world_2d:World2D"), &Viewport::set_world_2d); - ClassDB::bind_method(D_METHOD("get_world_2d:World2D"), &Viewport::get_world_2d); - ClassDB::bind_method(D_METHOD("find_world_2d:World2D"), &Viewport::find_world_2d); - ClassDB::bind_method(D_METHOD("set_world", "world:World"), &Viewport::set_world); - ClassDB::bind_method(D_METHOD("get_world:World"), &Viewport::get_world); - ClassDB::bind_method(D_METHOD("find_world:World"), &Viewport::find_world); + ClassDB::bind_method(D_METHOD("set_world_2d", "world_2d"), &Viewport::set_world_2d); + ClassDB::bind_method(D_METHOD("get_world_2d"), &Viewport::get_world_2d); + ClassDB::bind_method(D_METHOD("find_world_2d"), &Viewport::find_world_2d); + ClassDB::bind_method(D_METHOD("set_world", "world"), &Viewport::set_world); + ClassDB::bind_method(D_METHOD("get_world"), &Viewport::get_world); + ClassDB::bind_method(D_METHOD("find_world"), &Viewport::find_world); ClassDB::bind_method(D_METHOD("set_canvas_transform", "xform"), &Viewport::set_canvas_transform); ClassDB::bind_method(D_METHOD("get_canvas_transform"), &Viewport::get_canvas_transform); @@ -2696,34 +2695,34 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("get_render_info", "info"), &Viewport::get_render_info); - ClassDB::bind_method(D_METHOD("get_texture:ViewportTexture"), &Viewport::get_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &Viewport::get_texture); ClassDB::bind_method(D_METHOD("set_physics_object_picking", "enable"), &Viewport::set_physics_object_picking); ClassDB::bind_method(D_METHOD("get_physics_object_picking"), &Viewport::get_physics_object_picking); ClassDB::bind_method(D_METHOD("get_viewport_rid"), &Viewport::get_viewport_rid); - ClassDB::bind_method(D_METHOD("input", "local_event:InputEvent"), &Viewport::input); - ClassDB::bind_method(D_METHOD("unhandled_input", "local_event:InputEvent"), &Viewport::unhandled_input); + ClassDB::bind_method(D_METHOD("input", "local_event"), &Viewport::input); + ClassDB::bind_method(D_METHOD("unhandled_input", "local_event"), &Viewport::unhandled_input); ClassDB::bind_method(D_METHOD("update_worlds"), &Viewport::update_worlds); ClassDB::bind_method(D_METHOD("set_use_own_world", "enable"), &Viewport::set_use_own_world); ClassDB::bind_method(D_METHOD("is_using_own_world"), &Viewport::is_using_own_world); - ClassDB::bind_method(D_METHOD("get_camera:Camera"), &Viewport::get_camera); + ClassDB::bind_method(D_METHOD("get_camera"), &Viewport::get_camera); ClassDB::bind_method(D_METHOD("set_as_audio_listener", "enable"), &Viewport::set_as_audio_listener); - ClassDB::bind_method(D_METHOD("is_audio_listener", "enable"), &Viewport::is_audio_listener); + ClassDB::bind_method(D_METHOD("is_audio_listener"), &Viewport::is_audio_listener); ClassDB::bind_method(D_METHOD("set_as_audio_listener_2d", "enable"), &Viewport::set_as_audio_listener_2d); - ClassDB::bind_method(D_METHOD("is_audio_listener_2d", "enable"), &Viewport::is_audio_listener_2d); + ClassDB::bind_method(D_METHOD("is_audio_listener_2d"), &Viewport::is_audio_listener_2d); ClassDB::bind_method(D_METHOD("set_attach_to_screen_rect", "rect"), &Viewport::set_attach_to_screen_rect); ClassDB::bind_method(D_METHOD("get_mouse_position"), &Viewport::get_mouse_position); ClassDB::bind_method(D_METHOD("warp_mouse", "to_pos"), &Viewport::warp_mouse); ClassDB::bind_method(D_METHOD("gui_has_modal_stack"), &Viewport::gui_has_modal_stack); - ClassDB::bind_method(D_METHOD("gui_get_drag_data:Variant"), &Viewport::gui_get_drag_data); + ClassDB::bind_method(D_METHOD("gui_get_drag_data"), &Viewport::gui_get_drag_data); ClassDB::bind_method(D_METHOD("set_disable_input", "disable"), &Viewport::set_disable_input); ClassDB::bind_method(D_METHOD("is_input_disabled"), &Viewport::is_input_disabled); diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index 73a759278b..a473067937 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -170,7 +170,7 @@ Dictionary BitMap::_get_data() const { void BitMap::_bind_methods() { ClassDB::bind_method(D_METHOD("create", "size"), &BitMap::create); - ClassDB::bind_method(D_METHOD("create_from_image_alpha", "image:Image"), &BitMap::create_from_image_alpha); + ClassDB::bind_method(D_METHOD("create_from_image_alpha", "image"), &BitMap::create_from_image_alpha); ClassDB::bind_method(D_METHOD("set_bit", "pos", "bit"), &BitMap::set_bit); ClassDB::bind_method(D_METHOD("get_bit", "pos"), &BitMap::get_bit); diff --git a/scene/resources/color_ramp.cpp b/scene/resources/color_ramp.cpp index 3cf8845189..1825225abd 100644 --- a/scene/resources/color_ramp.cpp +++ b/scene/resources/color_ramp.cpp @@ -52,7 +52,7 @@ Gradient::~Gradient() { void Gradient::_bind_methods() { ClassDB::bind_method(D_METHOD("add_point", "offset", "color"), &Gradient::add_point); - ClassDB::bind_method(D_METHOD("remove_point", "offset", "color"), &Gradient::remove_point); + ClassDB::bind_method(D_METHOD("remove_point", "offset"), &Gradient::remove_point); ClassDB::bind_method(D_METHOD("set_offset", "point", "offset"), &Gradient::set_offset); ClassDB::bind_method(D_METHOD("get_offset", "point"), &Gradient::get_offset); diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 2fdc4c9e24..23bf6be68c 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -861,8 +861,8 @@ void DynamicFont::_get_property_list(List<PropertyInfo> *p_list) const { void DynamicFont::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_font_data", "data:DynamicFontData"), &DynamicFont::set_font_data); - ClassDB::bind_method(D_METHOD("get_font_data:DynamicFontData"), &DynamicFont::get_font_data); + ClassDB::bind_method(D_METHOD("set_font_data", "data"), &DynamicFont::set_font_data); + ClassDB::bind_method(D_METHOD("get_font_data"), &DynamicFont::get_font_data); ClassDB::bind_method(D_METHOD("set_size", "data"), &DynamicFont::set_size); ClassDB::bind_method(D_METHOD("get_size"), &DynamicFont::get_size); @@ -874,9 +874,9 @@ void DynamicFont::_bind_methods() { ClassDB::bind_method(D_METHOD("set_spacing", "type", "value"), &DynamicFont::set_spacing); ClassDB::bind_method(D_METHOD("get_spacing", "type"), &DynamicFont::get_spacing); - ClassDB::bind_method(D_METHOD("add_fallback", "data:DynamicFontData"), &DynamicFont::add_fallback); - ClassDB::bind_method(D_METHOD("set_fallback", "idx", "data:DynamicFontData"), &DynamicFont::set_fallback); - ClassDB::bind_method(D_METHOD("get_fallback:DynamicFontData", "idx"), &DynamicFont::get_fallback); + ClassDB::bind_method(D_METHOD("add_fallback", "data"), &DynamicFont::add_fallback); + ClassDB::bind_method(D_METHOD("set_fallback", "idx", "data"), &DynamicFont::set_fallback); + ClassDB::bind_method(D_METHOD("get_fallback", "idx"), &DynamicFont::get_fallback); ClassDB::bind_method(D_METHOD("remove_fallback", "idx"), &DynamicFont::remove_fallback); ClassDB::bind_method(D_METHOD("get_fallback_count"), &DynamicFont::get_fallback_count); diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp index 397349bbf9..8efad94b9a 100644 --- a/scene/resources/dynamic_font_stb.cpp +++ b/scene/resources/dynamic_font_stb.cpp @@ -386,8 +386,8 @@ DynamicFontAtSize::~DynamicFontAtSize() { void DynamicFont::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_font_data", "data:DynamicFontData"), &DynamicFont::set_font_data); - ClassDB::bind_method(D_METHOD("get_font_data:DynamicFontData"), &DynamicFont::get_font_data); + ClassDB::bind_method(D_METHOD("set_font_data", "data"), &DynamicFont::set_font_data); + ClassDB::bind_method(D_METHOD("get_font_data"), &DynamicFont::get_font_data); ClassDB::bind_method(D_METHOD("set_size", "data"), &DynamicFont::set_size); ClassDB::bind_method(D_METHOD("get_size"), &DynamicFont::get_size); diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index accced404b..0bf6a50d93 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -819,7 +819,7 @@ float Environment::get_fog_height_curve() const { void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_background", "mode"), &Environment::set_background); - ClassDB::bind_method(D_METHOD("set_sky", "sky:Sky"), &Environment::set_sky); + ClassDB::bind_method(D_METHOD("set_sky", "sky"), &Environment::set_sky); ClassDB::bind_method(D_METHOD("set_sky_scale", "scale"), &Environment::set_sky_scale); ClassDB::bind_method(D_METHOD("set_bg_color", "color"), &Environment::set_bg_color); ClassDB::bind_method(D_METHOD("set_bg_energy", "energy"), &Environment::set_bg_energy); @@ -829,7 +829,7 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_ambient_light_sky_contribution", "energy"), &Environment::set_ambient_light_sky_contribution); ClassDB::bind_method(D_METHOD("get_background"), &Environment::get_background); - ClassDB::bind_method(D_METHOD("get_sky:CubeMap"), &Environment::get_sky); + ClassDB::bind_method(D_METHOD("get_sky"), &Environment::get_sky); ClassDB::bind_method(D_METHOD("get_sky_scale"), &Environment::get_sky_scale); ClassDB::bind_method(D_METHOD("get_bg_color"), &Environment::get_bg_color); ClassDB::bind_method(D_METHOD("get_bg_energy"), &Environment::get_bg_energy); @@ -1104,8 +1104,8 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_adjustment_saturation", "saturation"), &Environment::set_adjustment_saturation); ClassDB::bind_method(D_METHOD("get_adjustment_saturation"), &Environment::get_adjustment_saturation); - ClassDB::bind_method(D_METHOD("set_adjustment_color_correction", "color_correction:Texture"), &Environment::set_adjustment_color_correction); - ClassDB::bind_method(D_METHOD("get_adjustment_color_correction:Texture"), &Environment::get_adjustment_color_correction); + ClassDB::bind_method(D_METHOD("set_adjustment_color_correction", "color_correction"), &Environment::set_adjustment_color_correction); + ClassDB::bind_method(D_METHOD("get_adjustment_color_correction"), &Environment::get_adjustment_color_correction); ADD_GROUP("Adjustments", "adjustment_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "adjustment_enabled"), "set_adjustment_enable", "is_adjustment_enabled"); @@ -1135,12 +1135,14 @@ void Environment::_bind_methods() { Environment::Environment() { + environment = VS::get_singleton()->environment_create(); + bg_mode = BG_CLEAR_COLOR; bg_sky_scale = 1.0; bg_energy = 1.0; bg_canvas_max_layer = 0; ambient_energy = 1.0; - ambient_sky_contribution = 0; + ambient_sky_contribution = 1.0; tone_mapper = TONE_MAPPER_LINEAR; tonemap_exposure = 1.0; @@ -1160,8 +1162,6 @@ Environment::Environment() { set_adjustment_enable(adjustment_enabled); //update - environment = VS::get_singleton()->environment_create(); - ssr_enabled = false; ssr_max_steps = 64; ssr_fade_in = 0.15; diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index a6a70d775f..d1431176d6 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -549,11 +549,11 @@ void BitmapFont::_bind_methods() { ClassDB::bind_method(D_METHOD("add_kerning_pair", "char_a", "char_b", "kerning"), &BitmapFont::add_kerning_pair); ClassDB::bind_method(D_METHOD("get_kerning_pair", "char_a", "char_b"), &BitmapFont::get_kerning_pair); - ClassDB::bind_method(D_METHOD("add_texture", "texture:Texture"), &BitmapFont::add_texture); + ClassDB::bind_method(D_METHOD("add_texture", "texture"), &BitmapFont::add_texture); ClassDB::bind_method(D_METHOD("add_char", "character", "texture", "rect", "align", "advance"), &BitmapFont::add_char, DEFVAL(Point2()), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("get_texture_count"), &BitmapFont::get_texture_count); - ClassDB::bind_method(D_METHOD("get_texture:Texture", "idx"), &BitmapFont::get_texture); + ClassDB::bind_method(D_METHOD("get_texture", "idx"), &BitmapFont::get_texture); ClassDB::bind_method(D_METHOD("get_char_size", "char", "next"), &BitmapFont::get_char_size, DEFVAL(0)); @@ -570,8 +570,8 @@ void BitmapFont::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_textures"), &BitmapFont::_set_textures); ClassDB::bind_method(D_METHOD("_get_textures"), &BitmapFont::_get_textures); - ClassDB::bind_method(D_METHOD("set_fallback", "fallback:BitmapFont"), &BitmapFont::set_fallback); - ClassDB::bind_method(D_METHOD("get_fallback:BitmapFont"), &BitmapFont::get_fallback); + ClassDB::bind_method(D_METHOD("set_fallback", "fallback"), &BitmapFont::set_fallback); + ClassDB::bind_method(D_METHOD("get_fallback"), &BitmapFont::get_fallback); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_textures", "_get_textures"); ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "chars", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_chars", "_get_chars"); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 5a79e49240..bc23a41ede 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -54,8 +54,8 @@ RID Material::get_rid() const { void Material::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_next_pass", "next_pass:Material"), &Material::set_next_pass); - ClassDB::bind_method(D_METHOD("get_next_pass:Material"), &Material::get_next_pass); + ClassDB::bind_method(D_METHOD("set_next_pass", "next_pass"), &Material::set_next_pass); + ClassDB::bind_method(D_METHOD("get_next_pass"), &Material::get_next_pass); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "next_pass", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_next_pass", "get_next_pass"); } @@ -160,10 +160,10 @@ Variant ShaderMaterial::get_shader_param(const StringName &p_param) const { void ShaderMaterial::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shader", "shader:Shader"), &ShaderMaterial::set_shader); - ClassDB::bind_method(D_METHOD("get_shader:Shader"), &ShaderMaterial::get_shader); + ClassDB::bind_method(D_METHOD("set_shader", "shader"), &ShaderMaterial::set_shader); + ClassDB::bind_method(D_METHOD("get_shader"), &ShaderMaterial::get_shader); ClassDB::bind_method(D_METHOD("set_shader_param", "param", "value"), &ShaderMaterial::set_shader_param); - ClassDB::bind_method(D_METHOD("get_shader_param:Variant", "param"), &ShaderMaterial::get_shader_param); + ClassDB::bind_method(D_METHOD("get_shader_param", "param"), &ShaderMaterial::get_shader_param); } void ShaderMaterial::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const { @@ -241,6 +241,7 @@ void SpatialMaterial::init_shaders() { shader_names->rim_texture_channel = "rim_texture_channel"; shader_names->depth_texture_channel = "depth_texture_channel"; shader_names->refraction_texture_channel = "refraction_texture_channel"; + shader_names->alpha_scissor_threshold = "alpha_scissor_threshold"; shader_names->texture_names[TEXTURE_ALBEDO] = "texture_albedo"; shader_names->texture_names[TEXTURE_METALLIC] = "texture_metallic"; @@ -259,8 +260,14 @@ void SpatialMaterial::init_shaders() { shader_names->texture_names[TEXTURE_DETAIL_NORMAL] = "texture_detail_normal"; } +Ref<SpatialMaterial> SpatialMaterial::materials_for_2d[SpatialMaterial::MAX_MATERIALS_FOR_2D]; + void SpatialMaterial::finish_shaders() { + for (int i = 0; i < MAX_MATERIALS_FOR_2D; i++) { + materials_for_2d[i].unref(); + } + #ifndef NO_THREADS memdelete(material_mutex); #endif @@ -359,6 +366,9 @@ void SpatialMaterial::_update_shader() { code += "uniform float grow;\n"; } + if (flags[FLAG_USE_ALPHA_SCISSOR]) { + code += "uniform float alpha_scissor_threshold;\n"; + } code += "uniform float roughness : hint_range(0,1);\n"; code += "uniform float point_size : hint_range(0,128);\n"; code += "uniform sampler2D texture_metallic : hint_white;\n"; @@ -674,7 +684,7 @@ void SpatialMaterial::_update_shader() { code += "\tALBEDO *= 1.0 - ref_amount;\n"; code += "\tALPHA = 1.0;\n"; - } else if (features[FEATURE_TRANSPARENT]) { + } else if (features[FEATURE_TRANSPARENT] || features[FLAG_USE_ALPHA_SCISSOR]) { code += "\tALPHA = albedo.a * albedo_tex.a;\n"; } @@ -774,6 +784,10 @@ void SpatialMaterial::_update_shader() { code += "\tvec3 detail_norm = mix(NORMALMAP,detail_norm_tex.rgb,detail_tex.a);\n"; code += "\tNORMALMAP = mix(NORMALMAP,detail_norm,detail_mask_tex.r);\n"; code += "\tALBEDO.rgb = mix(ALBEDO.rgb,detail,detail_mask_tex.r);\n"; + + if (flags[FLAG_USE_ALPHA_SCISSOR]) { + code += "\tALPHA_SCISSOR=alpha_scissor_threshold;\n"; + } } code += "}\n"; @@ -1086,6 +1100,9 @@ void SpatialMaterial::set_flag(Flags p_flag, bool p_enabled) { return; flags[p_flag] = p_enabled; + if (p_flag == FLAG_USE_ALPHA_SCISSOR) { + _change_notify(); + } _queue_shader_change(); } @@ -1130,9 +1147,6 @@ void SpatialMaterial::_validate_feature(const String &text, Feature feature, Pro if (property.name.begins_with(text) && property.name != text + "_enabled" && !features[feature]) { property.usage = 0; } - if ((property.name == "depth_min_layers" || property.name == "depth_max_layers") && !deep_parallax) { - property.usage = 0; - } } void SpatialMaterial::_validate_property(PropertyInfo &property) const { @@ -1154,6 +1168,14 @@ void SpatialMaterial::_validate_property(PropertyInfo &property) const { if (property.name == "params_grow_amount" && !grow_enabled) { property.usage = 0; } + + if (property.name == "params_alpha_scissor_threshold" && !flags[FLAG_USE_ALPHA_SCISSOR]) { + property.usage = 0; + } + + if ((property.name == "depth_min_layers" || property.name == "depth_max_layers") && !deep_parallax) { + property.usage = 0; + } } void SpatialMaterial::set_line_width(float p_line_width) { @@ -1329,6 +1351,16 @@ bool SpatialMaterial::is_grow_enabled() const { return grow_enabled; } +void SpatialMaterial::set_alpha_scissor_threshold(float p_treshold) { + alpha_scissor_threshold = p_treshold; + VS::get_singleton()->material_set_param(_get_material(), shader_names->alpha_scissor_threshold, p_treshold); +} + +float SpatialMaterial::get_alpha_scissor_threshold() const { + + return alpha_scissor_threshold; +} + void SpatialMaterial::set_grow(float p_grow) { grow = p_grow; VS::get_singleton()->material_set_param(_get_material(), shader_names->grow, p_grow); @@ -1391,6 +1423,40 @@ SpatialMaterial::TextureChannel SpatialMaterial::get_refraction_texture_channel( return refraction_texture_channel; } +RID SpatialMaterial::get_material_rid_for_2d(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass) { + + int version = 0; + if (p_shaded) + version = 1; + if (p_transparent) + version |= 2; + if (p_cut_alpha) + version |= 4; + if (p_opaque_prepass) + version |= 8; + if (p_double_sided) + version |= 16; + + if (materials_for_2d[version].is_valid()) { + return materials_for_2d[version]->get_rid(); + } + + Ref<SpatialMaterial> material; + material.instance(); + + material->set_flag(FLAG_UNSHADED, !p_shaded); + material->set_feature(FEATURE_TRANSPARENT, p_transparent); + material->set_cull_mode(p_double_sided ? CULL_DISABLED : CULL_BACK); + material->set_depth_draw_mode(p_opaque_prepass ? DEPTH_DRAW_ALPHA_OPAQUE_PREPASS : DEPTH_DRAW_OPAQUE_ONLY); + material->set_flag(FLAG_SRGB_VERTEX_COLOR, true); + material->set_flag(FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + material->set_flag(FLAG_USE_ALPHA_SCISSOR, p_cut_alpha); + + materials_for_2d[version] = material; + + return materials_for_2d[version]->get_rid(); +} + void SpatialMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_albedo", "albedo"), &SpatialMaterial::set_albedo); @@ -1468,8 +1534,8 @@ void SpatialMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_feature", "feature", "enable"), &SpatialMaterial::set_feature); ClassDB::bind_method(D_METHOD("get_feature", "feature"), &SpatialMaterial::get_feature); - ClassDB::bind_method(D_METHOD("set_texture", "param", "texture:Texture"), &SpatialMaterial::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture", "param"), &SpatialMaterial::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "param", "texture"), &SpatialMaterial::set_texture); + ClassDB::bind_method(D_METHOD("get_texture", "param"), &SpatialMaterial::get_texture); ClassDB::bind_method(D_METHOD("set_detail_blend_mode", "detail_blend_mode"), &SpatialMaterial::set_detail_blend_mode); ClassDB::bind_method(D_METHOD("get_detail_blend_mode"), &SpatialMaterial::get_detail_blend_mode); @@ -1516,6 +1582,9 @@ void SpatialMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_grow", "amount"), &SpatialMaterial::set_grow); ClassDB::bind_method(D_METHOD("get_grow"), &SpatialMaterial::get_grow); + ClassDB::bind_method(D_METHOD("set_alpha_scissor_threshold", "threshold"), &SpatialMaterial::set_alpha_scissor_threshold); + ClassDB::bind_method(D_METHOD("get_alpha_scissor_threshold"), &SpatialMaterial::get_alpha_scissor_threshold); + ClassDB::bind_method(D_METHOD("set_grow_enabled", "enable"), &SpatialMaterial::set_grow_enabled); ClassDB::bind_method(D_METHOD("is_grow_enabled"), &SpatialMaterial::is_grow_enabled); @@ -1553,6 +1622,8 @@ void SpatialMaterial::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "params_billboard_mode", PROPERTY_HINT_ENUM, "Disabled,Enabled,Y-Billboard,Particle Billboard"), "set_billboard_mode", "get_billboard_mode"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "params_grow"), "set_grow_enabled", "is_grow_enabled"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "params_grow_amount", PROPERTY_HINT_RANGE, "-16,10,0.01"), "set_grow", "get_grow"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "params_use_alpha_scissor"), "set_flag", "get_flag", FLAG_USE_ALPHA_SCISSOR); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "params_alpha_scissor_threshold", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_alpha_scissor_threshold", "get_alpha_scissor_threshold"); ADD_GROUP("Particles Anim", "particles_anim_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "particles_anim_h_frames", PROPERTY_HINT_RANGE, "1,128,1"), "set_particles_anim_h_frames", "get_particles_anim_h_frames"); ADD_PROPERTY(PropertyInfo(Variant::INT, "particles_anim_v_frames", PROPERTY_HINT_RANGE, "1,128,1"), "set_particles_anim_v_frames", "get_particles_anim_v_frames"); @@ -1697,9 +1768,13 @@ void SpatialMaterial::_bind_methods() { BIND_CONSTANT(FLAG_USE_VERTEX_LIGHTING); BIND_CONSTANT(FLAG_ONTOP); BIND_CONSTANT(FLAG_ALBEDO_FROM_VERTEX_COLOR); - BIND_CONSTANT(FLAG_SRGB_VERTEX_COLOR) - BIND_CONSTANT(FLAG_USE_POINT_SIZE) - BIND_CONSTANT(FLAG_FIXED_SIZE) + BIND_CONSTANT(FLAG_SRGB_VERTEX_COLOR); + BIND_CONSTANT(FLAG_USE_POINT_SIZE); + BIND_CONSTANT(FLAG_FIXED_SIZE); + BIND_CONSTANT(FLAG_UV1_USE_TRIPLANAR); + BIND_CONSTANT(FLAG_UV2_USE_TRIPLANAR); + BIND_CONSTANT(FLAG_AO_ON_UV2); + BIND_CONSTANT(FLAG_USE_ALPHA_SCISSOR); BIND_CONSTANT(FLAG_MAX); BIND_CONSTANT(DIFFUSE_LAMBERT); @@ -1730,10 +1805,10 @@ SpatialMaterial::SpatialMaterial() : element(this) { //initialize to right values - set_albedo(Color(0.7, 0.7, 0.7, 1.0)); + set_albedo(Color(1.0, 1.0, 1.0, 1.0)); set_specular(0.5); set_roughness(0.0); - set_metallic(0.1); + set_metallic(0.0); set_emission(Color(0, 0, 0)); set_emission_energy(1.0); set_normal_scale(1); @@ -1757,6 +1832,7 @@ SpatialMaterial::SpatialMaterial() set_particles_anim_h_frames(1); set_particles_anim_v_frames(1); set_particles_anim_loop(false); + set_alpha_scissor_threshold(0.98); set_metallic_texture_channel(TEXTURE_CHANNEL_RED); set_roughness_texture_channel(TEXTURE_CHANNEL_RED); diff --git a/scene/resources/material.h b/scene/resources/material.h index 1484b79fc6..25628e272a 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -164,6 +164,7 @@ public: FLAG_UV1_USE_TRIPLANAR, FLAG_UV2_USE_TRIPLANAR, FLAG_AO_ON_UV2, + FLAG_USE_ALPHA_SCISSOR, FLAG_MAX }; @@ -207,7 +208,7 @@ private: uint64_t blend_mode : 2; uint64_t depth_draw_mode : 2; uint64_t cull_mode : 2; - uint64_t flags : 9; + uint64_t flags : 11; uint64_t detail_blend_mode : 2; uint64_t diffuse_mode : 3; uint64_t specular_mode : 2; @@ -298,6 +299,7 @@ private: StringName rim_texture_channel; StringName depth_texture_channel; StringName refraction_texture_channel; + StringName alpha_scissor_threshold; StringName texture_names[TEXTURE_MAX]; }; @@ -329,6 +331,7 @@ private: float refraction; float line_width; float point_size; + float alpha_scissor_threshold; bool grow_enabled; float grow; int particles_anim_h_frames; @@ -369,6 +372,12 @@ private: _FORCE_INLINE_ void _validate_feature(const String &text, Feature feature, PropertyInfo &property) const; + enum { + MAX_MATERIALS_FOR_2D = 32 + }; + + static Ref<SpatialMaterial> materials_for_2d[MAX_MATERIALS_FOR_2D]; //used by Sprite3D and other stuff + protected: static void _bind_methods(); void _validate_property(PropertyInfo &property) const; @@ -499,6 +508,9 @@ public: void set_grow(float p_grow); float get_grow() const; + void set_alpha_scissor_threshold(float p_treshold); + float get_alpha_scissor_threshold() const; + void set_metallic_texture_channel(TextureChannel p_channel); TextureChannel get_metallic_texture_channel() const; void set_roughness_texture_channel(TextureChannel p_channel); @@ -512,6 +524,8 @@ public: static void finish_shaders(); static void flush_changes(); + static RID get_material_rid_for_2d(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass); + SpatialMaterial(); virtual ~SpatialMaterial(); }; diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 310ab5e371..af30e75aed 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -1006,19 +1006,19 @@ void ArrayMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("surface_get_array_index_len", "surf_idx"), &ArrayMesh::surface_get_array_index_len); ClassDB::bind_method(D_METHOD("surface_get_format", "surf_idx"), &ArrayMesh::surface_get_format); ClassDB::bind_method(D_METHOD("surface_get_primitive_type", "surf_idx"), &ArrayMesh::surface_get_primitive_type); - ClassDB::bind_method(D_METHOD("surface_set_material", "surf_idx", "material:Material"), &ArrayMesh::surface_set_material); - ClassDB::bind_method(D_METHOD("surface_get_material:Material", "surf_idx"), &ArrayMesh::surface_get_material); + ClassDB::bind_method(D_METHOD("surface_set_material", "surf_idx", "material"), &ArrayMesh::surface_set_material); + ClassDB::bind_method(D_METHOD("surface_get_material", "surf_idx"), &ArrayMesh::surface_get_material); ClassDB::bind_method(D_METHOD("surface_set_name", "surf_idx", "name"), &ArrayMesh::surface_set_name); ClassDB::bind_method(D_METHOD("surface_get_name", "surf_idx"), &ArrayMesh::surface_get_name); - ClassDB::bind_method(D_METHOD("create_trimesh_shape:Shape"), &ArrayMesh::create_trimesh_shape); - ClassDB::bind_method(D_METHOD("create_convex_shape:Shape"), &ArrayMesh::create_convex_shape); - ClassDB::bind_method(D_METHOD("create_outline:ArrayMesh", "margin"), &ArrayMesh::create_outline); + ClassDB::bind_method(D_METHOD("create_trimesh_shape"), &ArrayMesh::create_trimesh_shape); + ClassDB::bind_method(D_METHOD("create_convex_shape"), &ArrayMesh::create_convex_shape); + ClassDB::bind_method(D_METHOD("create_outline", "margin"), &ArrayMesh::create_outline); ClassDB::bind_method(D_METHOD("center_geometry"), &ArrayMesh::center_geometry); ClassDB::set_method_flags(get_class_static(), _scs_create("center_geometry"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR); ClassDB::bind_method(D_METHOD("regen_normalmaps"), &ArrayMesh::regen_normalmaps); ClassDB::set_method_flags(get_class_static(), _scs_create("regen_normalmaps"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR); ClassDB::bind_method(D_METHOD("get_faces"), &ArrayMesh::get_faces); - ClassDB::bind_method(D_METHOD("generate_triangle_mesh:TriangleMesh"), &ArrayMesh::generate_triangle_mesh); + ClassDB::bind_method(D_METHOD("generate_triangle_mesh"), &ArrayMesh::generate_triangle_mesh); ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &ArrayMesh::set_custom_aabb); ClassDB::bind_method(D_METHOD("get_custom_aabb"), &ArrayMesh::get_custom_aabb); diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index 5dc596abff..f1092a90cb 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -520,8 +520,8 @@ void MeshDataTool::set_material(const Ref<Material> &p_material) { void MeshDataTool::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &MeshDataTool::clear); - ClassDB::bind_method(D_METHOD("create_from_surface", "mesh:ArrayMesh", "surface"), &MeshDataTool::create_from_surface); - ClassDB::bind_method(D_METHOD("commit_to_surface", "mesh:ArrayMesh"), &MeshDataTool::commit_to_surface); + ClassDB::bind_method(D_METHOD("create_from_surface", "mesh", "surface"), &MeshDataTool::create_from_surface); + ClassDB::bind_method(D_METHOD("commit_to_surface", "mesh"), &MeshDataTool::commit_to_surface); ClassDB::bind_method(D_METHOD("get_format"), &MeshDataTool::get_format); @@ -554,27 +554,27 @@ void MeshDataTool::_bind_methods() { ClassDB::bind_method(D_METHOD("get_vertex_weights", "idx"), &MeshDataTool::get_vertex_weights); ClassDB::bind_method(D_METHOD("set_vertex_meta", "idx", "meta"), &MeshDataTool::set_vertex_meta); - ClassDB::bind_method(D_METHOD("get_vertex_meta:Variant", "idx"), &MeshDataTool::get_vertex_meta); + ClassDB::bind_method(D_METHOD("get_vertex_meta", "idx"), &MeshDataTool::get_vertex_meta); ClassDB::bind_method(D_METHOD("get_vertex_edges", "idx"), &MeshDataTool::get_vertex_edges); ClassDB::bind_method(D_METHOD("get_vertex_faces", "idx"), &MeshDataTool::get_vertex_faces); ClassDB::bind_method(D_METHOD("get_edge_vertex", "idx", "vertex"), &MeshDataTool::get_edge_vertex); - ClassDB::bind_method(D_METHOD("get_edge_faces", "idx", "faces"), &MeshDataTool::get_edge_faces); + ClassDB::bind_method(D_METHOD("get_edge_faces", "idx"), &MeshDataTool::get_edge_faces); ClassDB::bind_method(D_METHOD("set_edge_meta", "idx", "meta"), &MeshDataTool::set_edge_meta); - ClassDB::bind_method(D_METHOD("get_edge_meta:Variant", "idx"), &MeshDataTool::get_edge_meta); + ClassDB::bind_method(D_METHOD("get_edge_meta", "idx"), &MeshDataTool::get_edge_meta); ClassDB::bind_method(D_METHOD("get_face_vertex", "idx", "vertex"), &MeshDataTool::get_face_vertex); ClassDB::bind_method(D_METHOD("get_face_edge", "idx", "edge"), &MeshDataTool::get_face_edge); ClassDB::bind_method(D_METHOD("set_face_meta", "idx", "meta"), &MeshDataTool::set_face_meta); - ClassDB::bind_method(D_METHOD("get_face_meta:Variant", "idx"), &MeshDataTool::get_face_meta); + ClassDB::bind_method(D_METHOD("get_face_meta", "idx"), &MeshDataTool::get_face_meta); ClassDB::bind_method(D_METHOD("get_face_normal", "idx"), &MeshDataTool::get_face_normal); - ClassDB::bind_method(D_METHOD("set_material", "material:Material"), &MeshDataTool::set_material); - ClassDB::bind_method(D_METHOD("get_material:Material", "material"), &MeshDataTool::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &MeshDataTool::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &MeshDataTool::get_material); } MeshDataTool::MeshDataTool() { diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp index 22e5659e72..7d51a2617e 100644 --- a/scene/resources/mesh_library.cpp +++ b/scene/resources/mesh_library.cpp @@ -230,13 +230,13 @@ void MeshLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("create_item", "id"), &MeshLibrary::create_item); ClassDB::bind_method(D_METHOD("set_item_name", "id", "name"), &MeshLibrary::set_item_name); - ClassDB::bind_method(D_METHOD("set_item_mesh", "id", "mesh:Mesh"), &MeshLibrary::set_item_mesh); - ClassDB::bind_method(D_METHOD("set_item_navmesh", "id", "navmesh:NavigationMesh"), &MeshLibrary::set_item_navmesh); - ClassDB::bind_method(D_METHOD("set_item_shape", "id", "shape:Shape"), &MeshLibrary::set_item_shape); + ClassDB::bind_method(D_METHOD("set_item_mesh", "id", "mesh"), &MeshLibrary::set_item_mesh); + ClassDB::bind_method(D_METHOD("set_item_navmesh", "id", "navmesh"), &MeshLibrary::set_item_navmesh); + ClassDB::bind_method(D_METHOD("set_item_shape", "id", "shape"), &MeshLibrary::set_item_shape); ClassDB::bind_method(D_METHOD("get_item_name", "id"), &MeshLibrary::get_item_name); - ClassDB::bind_method(D_METHOD("get_item_mesh:Mesh", "id"), &MeshLibrary::get_item_mesh); - ClassDB::bind_method(D_METHOD("get_item_navmesh:NavigationMesh", "id"), &MeshLibrary::get_item_navmesh); - ClassDB::bind_method(D_METHOD("get_item_shape:Shape", "id"), &MeshLibrary::get_item_shape); + ClassDB::bind_method(D_METHOD("get_item_mesh", "id"), &MeshLibrary::get_item_mesh); + ClassDB::bind_method(D_METHOD("get_item_navmesh", "id"), &MeshLibrary::get_item_navmesh); + ClassDB::bind_method(D_METHOD("get_item_shape", "id"), &MeshLibrary::get_item_shape); ClassDB::bind_method(D_METHOD("remove_item", "id"), &MeshLibrary::remove_item); ClassDB::bind_method(D_METHOD("clear"), &MeshLibrary::clear); ClassDB::bind_method(D_METHOD("get_item_list"), &MeshLibrary::get_item_list); diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index d32f221fd9..231e59cdb5 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -186,8 +186,8 @@ MultiMesh::TransformFormat MultiMesh::get_transform_format() const { void MultiMesh::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_mesh", "mesh:Mesh"), &MultiMesh::set_mesh); - ClassDB::bind_method(D_METHOD("get_mesh:Mesh"), &MultiMesh::get_mesh); + ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &MultiMesh::set_mesh); + ClassDB::bind_method(D_METHOD("get_mesh"), &MultiMesh::get_mesh); ClassDB::bind_method(D_METHOD("set_color_format", "format"), &MultiMesh::set_color_format); ClassDB::bind_method(D_METHOD("get_color_format"), &MultiMesh::get_color_format); ClassDB::bind_method(D_METHOD("set_transform_format", "format"), &MultiMesh::set_transform_format); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 648900a5cd..ce1d6f311f 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1670,11 +1670,11 @@ void SceneState::_bind_methods() { ClassDB::bind_method(D_METHOD("get_node_owner_path", "idx"), &SceneState::get_node_owner_path); ClassDB::bind_method(D_METHOD("is_node_instance_placeholder", "idx"), &SceneState::is_node_instance_placeholder); ClassDB::bind_method(D_METHOD("get_node_instance_placeholder", "idx"), &SceneState::get_node_instance_placeholder); - ClassDB::bind_method(D_METHOD("get_node_instance:PackedScene", "idx"), &SceneState::get_node_instance); + ClassDB::bind_method(D_METHOD("get_node_instance", "idx"), &SceneState::get_node_instance); ClassDB::bind_method(D_METHOD("get_node_groups", "idx"), &SceneState::_get_node_groups); ClassDB::bind_method(D_METHOD("get_node_property_count", "idx"), &SceneState::get_node_property_count); ClassDB::bind_method(D_METHOD("get_node_property_name", "idx", "prop_idx"), &SceneState::get_node_property_name); - ClassDB::bind_method(D_METHOD("get_node_property_value:Variant", "idx", "prop_idx"), &SceneState::get_node_property_value); + ClassDB::bind_method(D_METHOD("get_node_property_value", "idx", "prop_idx"), &SceneState::get_node_property_value); ClassDB::bind_method(D_METHOD("get_connection_count"), &SceneState::get_connection_count); ClassDB::bind_method(D_METHOD("get_connection_source", "idx"), &SceneState::get_connection_source); ClassDB::bind_method(D_METHOD("get_connection_signal", "idx"), &SceneState::get_connection_signal); @@ -1777,12 +1777,12 @@ void PackedScene::set_path(const String &p_path, bool p_take_over) { void PackedScene::_bind_methods() { - ClassDB::bind_method(D_METHOD("pack", "path:Node"), &PackedScene::pack); - ClassDB::bind_method(D_METHOD("instance:Node", "edit_state"), &PackedScene::instance, DEFVAL(GEN_EDIT_STATE_DISABLED)); + ClassDB::bind_method(D_METHOD("pack", "path"), &PackedScene::pack); + ClassDB::bind_method(D_METHOD("instance", "edit_state"), &PackedScene::instance, DEFVAL(GEN_EDIT_STATE_DISABLED)); ClassDB::bind_method(D_METHOD("can_instance"), &PackedScene::can_instance); ClassDB::bind_method(D_METHOD("_set_bundled_scene"), &PackedScene::_set_bundled_scene); ClassDB::bind_method(D_METHOD("_get_bundled_scene"), &PackedScene::_get_bundled_scene); - ClassDB::bind_method(D_METHOD("get_state:SceneState"), &PackedScene::get_state); + ClassDB::bind_method(D_METHOD("get_state"), &PackedScene::get_state); ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "_bundled"), "_set_bundled_scene", "_get_bundled_scene"); diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 327de2f6f3..065e7a84dd 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -148,8 +148,8 @@ RID PrimitiveMesh::get_rid() const { void PrimitiveMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("_update"), &PrimitiveMesh::_update); - ClassDB::bind_method(D_METHOD("set_material", "material:Material"), &PrimitiveMesh::set_material); - ClassDB::bind_method(D_METHOD("get_material:Material"), &PrimitiveMesh::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &PrimitiveMesh::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &PrimitiveMesh::get_material); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_material", "get_material"); } diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index fafe68188b..b72eb9fbef 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -128,8 +128,8 @@ void Shader::_bind_methods() { ClassDB::bind_method(D_METHOD("set_code", "code"), &Shader::set_code); ClassDB::bind_method(D_METHOD("get_code"), &Shader::get_code); - ClassDB::bind_method(D_METHOD("set_default_texture_param", "param", "texture:Texture"), &Shader::set_default_texture_param); - ClassDB::bind_method(D_METHOD("get_default_texture_param:Texture", "param"), &Shader::get_default_texture_param); + ClassDB::bind_method(D_METHOD("set_default_texture_param", "param", "texture"), &Shader::set_default_texture_param); + ClassDB::bind_method(D_METHOD("get_default_texture_param", "param"), &Shader::get_default_texture_param); ClassDB::bind_method(D_METHOD("has_param", "name"), &Shader::has_param); diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 61dc9185a0..f68aed6af9 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -238,11 +238,11 @@ void ShaderGraph::_bind_methods() { ClassDB::bind_method(D_METHOD("xform_input_node_set_value","shader_type","id","value"),&ShaderGraph::xform_input_node_set_value); ClassDB::bind_method(D_METHOD("xform_input_node_get_value","shader_type","id"),&ShaderGraph::xform_input_node_get_value); - ClassDB::bind_method(D_METHOD("texture_input_node_set_value","shader_type","id","value:Texture"),&ShaderGraph::texture_input_node_set_value); - ClassDB::bind_method(D_METHOD("texture_input_node_get_value:Texture","shader_type","id"),&ShaderGraph::texture_input_node_get_value); + ClassDB::bind_method(D_METHOD("texture_input_node_set_value","shader_type","id","value"),&ShaderGraph::texture_input_node_set_value); + ClassDB::bind_method(D_METHOD("texture_input_node_get_value","shader_type","id"),&ShaderGraph::texture_input_node_get_value); - ClassDB::bind_method(D_METHOD("cubemap_input_node_set_value","shader_type","id","value:CubeMap"),&ShaderGraph::cubemap_input_node_set_value); - ClassDB::bind_method(D_METHOD("cubemap_input_node_get_value:CubeMap","shader_type","id"),&ShaderGraph::cubemap_input_node_get_value); + ClassDB::bind_method(D_METHOD("cubemap_input_node_set_value","shader_type","id","value"),&ShaderGraph::cubemap_input_node_set_value); + ClassDB::bind_method(D_METHOD("cubemap_input_node_get_value","shader_type","id"),&ShaderGraph::cubemap_input_node_get_value); ClassDB::bind_method(D_METHOD("comment_node_set_text","shader_type","id","text"),&ShaderGraph::comment_node_set_text); ClassDB::bind_method(D_METHOD("comment_node_get_text","shader_type","id"),&ShaderGraph::comment_node_get_text); @@ -254,7 +254,7 @@ void ShaderGraph::_bind_methods() { ClassDB::bind_method(D_METHOD("curve_map_node_set_points","shader_type","id","points"),&ShaderGraph::curve_map_node_set_points); ClassDB::bind_method(D_METHOD("curve_map_node_get_points","shader_type","id"),&ShaderGraph::curve_map_node_get_points); - ClassDB::bind_method(D_METHOD("connect_node:Error","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::connect_node); + ClassDB::bind_method(D_METHOD("connect_node","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::connect_node); ClassDB::bind_method(D_METHOD("is_node_connected","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::is_node_connected); ClassDB::bind_method(D_METHOD("disconnect_node","shader_type","src_id","src_slot","dst_id","dst_slot"),&ShaderGraph::disconnect_node); ClassDB::bind_method(D_METHOD("get_node_connections","shader_type"),&ShaderGraph::_get_connections); @@ -262,7 +262,7 @@ void ShaderGraph::_bind_methods() { ClassDB::bind_method(D_METHOD("clear","shader_type"),&ShaderGraph::clear); ClassDB::bind_method(D_METHOD("node_set_state","shader_type","id","state"),&ShaderGraph::node_set_state); - ClassDB::bind_method(D_METHOD("node_get_state:Variant","shader_type","id"),&ShaderGraph::node_get_state); + ClassDB::bind_method(D_METHOD("node_get_state","shader_type","id"),&ShaderGraph::node_get_state); ClassDB::bind_method(D_METHOD("_set_data"),&ShaderGraph::_set_data); ClassDB::bind_method(D_METHOD("_get_data"),&ShaderGraph::_get_data); diff --git a/scene/resources/shape_2d.cpp b/scene/resources/shape_2d.cpp index f1a00336fa..818c749e8c 100644 --- a/scene/resources/shape_2d.cpp +++ b/scene/resources/shape_2d.cpp @@ -99,10 +99,10 @@ void Shape2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_custom_solver_bias", "bias"), &Shape2D::set_custom_solver_bias); ClassDB::bind_method(D_METHOD("get_custom_solver_bias"), &Shape2D::get_custom_solver_bias); - ClassDB::bind_method(D_METHOD("collide", "local_xform", "with_shape:Shape2D", "shape_xform"), &Shape2D::collide); - ClassDB::bind_method(D_METHOD("collide_with_motion", "local_xform", "local_motion", "with_shape:Shape2D", "shape_xform", "shape_motion"), &Shape2D::collide_with_motion); - ClassDB::bind_method(D_METHOD("collide_and_get_contacts:Variant", "local_xform", "with_shape:Shape2D", "shape_xform"), &Shape2D::collide_and_get_contacts); - ClassDB::bind_method(D_METHOD("collide_with_motion_and_get_contacts:Variant", "local_xform", "local_motion", "with_shape:Shape2D", "shape_xform", "shape_motion"), &Shape2D::collide_with_motion_and_get_contacts); + ClassDB::bind_method(D_METHOD("collide", "local_xform", "with_shape", "shape_xform"), &Shape2D::collide); + ClassDB::bind_method(D_METHOD("collide_with_motion", "local_xform", "local_motion", "with_shape", "shape_xform", "shape_motion"), &Shape2D::collide_with_motion); + ClassDB::bind_method(D_METHOD("collide_and_get_contacts", "local_xform", "with_shape", "shape_xform"), &Shape2D::collide_and_get_contacts); + ClassDB::bind_method(D_METHOD("collide_with_motion_and_get_contacts", "local_xform", "local_motion", "with_shape", "shape_xform", "shape_motion"), &Shape2D::collide_with_motion_and_get_contacts); ADD_PROPERTY(PropertyInfo(Variant::REAL, "custom_solver_bias", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_custom_solver_bias", "get_custom_solver_bias"); } diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp index b1ca72571e..5750960845 100644 --- a/scene/resources/sky_box.cpp +++ b/scene/resources/sky_box.cpp @@ -100,8 +100,8 @@ RID PanoramaSky::get_rid() const { void PanoramaSky::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_panorama", "texture:Texture"), &PanoramaSky::set_panorama); - ClassDB::bind_method(D_METHOD("get_panorama:Texture"), &PanoramaSky::get_panorama); + ClassDB::bind_method(D_METHOD("set_panorama", "texture"), &PanoramaSky::set_panorama); + ClassDB::bind_method(D_METHOD("get_panorama"), &PanoramaSky::get_panorama); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "panorama", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_panorama", "get_panorama"); } diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 3666c18487..bdb17c0ea5 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -224,11 +224,11 @@ Color StyleBoxTexture::get_modulate() const { void StyleBoxTexture::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &StyleBoxTexture::set_texture); - ClassDB::bind_method(D_METHOD("get_texture:Texture"), &StyleBoxTexture::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture"), &StyleBoxTexture::set_texture); + ClassDB::bind_method(D_METHOD("get_texture"), &StyleBoxTexture::get_texture); - ClassDB::bind_method(D_METHOD("set_normal_map", "normal_map:Texture"), &StyleBoxTexture::set_normal_map); - ClassDB::bind_method(D_METHOD("get_normal_map:Texture"), &StyleBoxTexture::get_normal_map); + ClassDB::bind_method(D_METHOD("set_normal_map", "normal_map"), &StyleBoxTexture::set_normal_map); + ClassDB::bind_method(D_METHOD("get_normal_map"), &StyleBoxTexture::get_normal_map); ClassDB::bind_method(D_METHOD("set_margin_size", "margin", "size"), &StyleBoxTexture::set_margin_size); ClassDB::bind_method(D_METHOD("get_margin_size", "margin"), &StyleBoxTexture::get_margin_size); diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 3932917ebe..a3c683f857 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -865,13 +865,13 @@ void SurfaceTool::_bind_methods() { ClassDB::bind_method(D_METHOD("add_to_format", "flags"), &SurfaceTool::add_to_format); - ClassDB::bind_method(D_METHOD("set_material", "material:Material"), &SurfaceTool::set_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &SurfaceTool::set_material); ClassDB::bind_method(D_METHOD("clear"), &SurfaceTool::clear); - ClassDB::bind_method(D_METHOD("create_from", "existing:Mesh", "surface"), &SurfaceTool::create_from); - ClassDB::bind_method(D_METHOD("append_from", "existing:Mesh", "surface", "transform"), &SurfaceTool::append_from); - ClassDB::bind_method(D_METHOD("commit:Mesh", "existing:Mesh"), &SurfaceTool::commit, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("create_from", "existing", "surface"), &SurfaceTool::create_from); + ClassDB::bind_method(D_METHOD("append_from", "existing", "surface", "transform"), &SurfaceTool::append_from); + ClassDB::bind_method(D_METHOD("commit", "existing"), &SurfaceTool::commit, DEFVAL(Variant())); } SurfaceTool::SurfaceTool() { diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index f69c83bf08..9a251c029d 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -70,10 +70,10 @@ void Texture::_bind_methods() { ClassDB::bind_method(D_METHOD("has_alpha"), &Texture::has_alpha); ClassDB::bind_method(D_METHOD("set_flags", "flags"), &Texture::set_flags); ClassDB::bind_method(D_METHOD("get_flags"), &Texture::get_flags); - ClassDB::bind_method(D_METHOD("draw", "canvas_item", "pos", "modulate", "transpose", "normal_map:Texture"), &Texture::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_rect", "canvas_item", "rect", "tile", "modulate", "transpose", "normal_map:Texture"), &Texture::draw_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map:Texture", "clip_uv"), &Texture::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("get_data:Image"), &Texture::get_data); + ClassDB::bind_method(D_METHOD("draw", "canvas_item", "pos", "modulate", "transpose", "normal_map"), &Texture::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_rect", "canvas_item", "rect", "tile", "modulate", "transpose", "normal_map"), &Texture::draw_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &Texture::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("get_data"), &Texture::get_data); BIND_CONSTANT(FLAG_MIPMAPS); BIND_CONSTANT(FLAG_REPEAT); @@ -350,10 +350,10 @@ void ImageTexture::_set_data(Dictionary p_data) { void ImageTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("create", "width", "height", "format", "flags"), &ImageTexture::create, DEFVAL(FLAGS_DEFAULT)); - ClassDB::bind_method(D_METHOD("create_from_image", "image:Image", "flags"), &ImageTexture::create_from_image, DEFVAL(FLAGS_DEFAULT)); + ClassDB::bind_method(D_METHOD("create_from_image", "image", "flags"), &ImageTexture::create_from_image, DEFVAL(FLAGS_DEFAULT)); ClassDB::bind_method(D_METHOD("get_format"), &ImageTexture::get_format); ClassDB::bind_method(D_METHOD("load", "path"), &ImageTexture::load); - ClassDB::bind_method(D_METHOD("set_data", "image:Image"), &ImageTexture::set_data); + ClassDB::bind_method(D_METHOD("set_data", "image"), &ImageTexture::set_data); ClassDB::bind_method(D_METHOD("set_storage", "mode"), &ImageTexture::set_storage); ClassDB::bind_method(D_METHOD("get_storage"), &ImageTexture::get_storage); ClassDB::bind_method(D_METHOD("set_lossy_storage_quality", "quality"), &ImageTexture::set_lossy_storage_quality); @@ -868,8 +868,8 @@ Rect2 AtlasTexture::get_margin() const { void AtlasTexture::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_atlas", "atlas:Texture"), &AtlasTexture::set_atlas); - ClassDB::bind_method(D_METHOD("get_atlas:Texture"), &AtlasTexture::get_atlas); + ClassDB::bind_method(D_METHOD("set_atlas", "atlas"), &AtlasTexture::set_atlas); + ClassDB::bind_method(D_METHOD("get_atlas"), &AtlasTexture::get_atlas); ClassDB::bind_method(D_METHOD("set_region", "region"), &AtlasTexture::set_region); ClassDB::bind_method(D_METHOD("get_region"), &AtlasTexture::get_region); @@ -1100,15 +1100,15 @@ Ref<Texture> LargeTexture::get_piece_texture(int p_idx) const { void LargeTexture::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_piece", "ofs", "texture:Texture"), &LargeTexture::add_piece); + ClassDB::bind_method(D_METHOD("add_piece", "ofs", "texture"), &LargeTexture::add_piece); ClassDB::bind_method(D_METHOD("set_piece_offset", "idx", "ofs"), &LargeTexture::set_piece_offset); - ClassDB::bind_method(D_METHOD("set_piece_texture", "idx", "texture:Texture"), &LargeTexture::set_piece_texture); + ClassDB::bind_method(D_METHOD("set_piece_texture", "idx", "texture"), &LargeTexture::set_piece_texture); ClassDB::bind_method(D_METHOD("set_size", "size"), &LargeTexture::set_size); ClassDB::bind_method(D_METHOD("clear"), &LargeTexture::clear); ClassDB::bind_method(D_METHOD("get_piece_count"), &LargeTexture::get_piece_count); ClassDB::bind_method(D_METHOD("get_piece_offset", "idx"), &LargeTexture::get_piece_offset); - ClassDB::bind_method(D_METHOD("get_piece_texture:Texture", "idx"), &LargeTexture::get_piece_texture); + ClassDB::bind_method(D_METHOD("get_piece_texture", "idx"), &LargeTexture::get_piece_texture); ClassDB::bind_method(D_METHOD("_set_data", "data"), &LargeTexture::_set_data); ClassDB::bind_method(D_METHOD("_get_data"), &LargeTexture::_get_data); @@ -1328,8 +1328,8 @@ void CubeMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_flags", "flags"), &CubeMap::set_flags); ClassDB::bind_method(D_METHOD("get_flags"), &CubeMap::get_flags); - ClassDB::bind_method(D_METHOD("set_side", "side", "image:Image"), &CubeMap::set_side); - ClassDB::bind_method(D_METHOD("get_side:Image", "side"), &CubeMap::get_side); + ClassDB::bind_method(D_METHOD("set_side", "side", "image"), &CubeMap::set_side); + ClassDB::bind_method(D_METHOD("get_side", "side"), &CubeMap::get_side); ClassDB::bind_method(D_METHOD("set_storage", "mode"), &CubeMap::set_storage); ClassDB::bind_method(D_METHOD("get_storage"), &CubeMap::get_storage); ClassDB::bind_method(D_METHOD("set_lossy_storage_quality", "quality"), &CubeMap::set_lossy_storage_quality); @@ -1380,8 +1380,8 @@ void CurveTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("set_width", "width"), &CurveTexture::set_width); - ClassDB::bind_method(D_METHOD("set_curve", "curve:Curve"), &CurveTexture::set_curve); - ClassDB::bind_method(D_METHOD("get_curve:Curve"), &CurveTexture::get_curve); + ClassDB::bind_method(D_METHOD("set_curve", "curve"), &CurveTexture::set_curve); + ClassDB::bind_method(D_METHOD("get_curve"), &CurveTexture::get_curve); ClassDB::bind_method(D_METHOD("_update"), &CurveTexture::_update); @@ -1497,8 +1497,8 @@ GradientTexture::~GradientTexture() { void GradientTexture::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_gradient", "gradient:Gradient"), &GradientTexture::set_gradient); - ClassDB::bind_method(D_METHOD("get_gradient:Gradient"), &GradientTexture::get_gradient); + ClassDB::bind_method(D_METHOD("set_gradient", "gradient"), &GradientTexture::set_gradient); + ClassDB::bind_method(D_METHOD("get_gradient"), &GradientTexture::get_gradient); ClassDB::bind_method(D_METHOD("set_width", "width"), &GradientTexture::set_width); diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index d5c68457d0..1d5aed0444 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -629,21 +629,21 @@ void Theme::get_type_list(List<StringName> *p_list) const { void Theme::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_icon", "name", "type", "texture:Texture"), &Theme::set_icon); - ClassDB::bind_method(D_METHOD("get_icon:Texture", "name", "type"), &Theme::get_icon); + ClassDB::bind_method(D_METHOD("set_icon", "name", "type", "texture"), &Theme::set_icon); + ClassDB::bind_method(D_METHOD("get_icon", "name", "type"), &Theme::get_icon); ClassDB::bind_method(D_METHOD("has_icon", "name", "type"), &Theme::has_icon); ClassDB::bind_method(D_METHOD("clear_icon", "name", "type"), &Theme::clear_icon); ClassDB::bind_method(D_METHOD("get_icon_list", "type"), &Theme::_get_icon_list); - ClassDB::bind_method(D_METHOD("set_stylebox", "name", "type", "texture:StyleBox"), &Theme::set_stylebox); - ClassDB::bind_method(D_METHOD("get_stylebox:StyleBox", "name", "type"), &Theme::get_stylebox); + ClassDB::bind_method(D_METHOD("set_stylebox", "name", "type", "texture"), &Theme::set_stylebox); + ClassDB::bind_method(D_METHOD("get_stylebox", "name", "type"), &Theme::get_stylebox); ClassDB::bind_method(D_METHOD("has_stylebox", "name", "type"), &Theme::has_stylebox); ClassDB::bind_method(D_METHOD("clear_stylebox", "name", "type"), &Theme::clear_stylebox); ClassDB::bind_method(D_METHOD("get_stylebox_list", "type"), &Theme::_get_stylebox_list); ClassDB::bind_method(D_METHOD("get_stylebox_types"), &Theme::_get_stylebox_types); - ClassDB::bind_method(D_METHOD("set_font", "name", "type", "font:Font"), &Theme::set_font); - ClassDB::bind_method(D_METHOD("get_font:Font", "name", "type"), &Theme::get_font); + ClassDB::bind_method(D_METHOD("set_font", "name", "type", "font"), &Theme::set_font); + ClassDB::bind_method(D_METHOD("get_font", "name", "type"), &Theme::get_font); ClassDB::bind_method(D_METHOD("has_font", "name", "type"), &Theme::has_font); ClassDB::bind_method(D_METHOD("clear_font", "name", "type"), &Theme::clear_font); ClassDB::bind_method(D_METHOD("get_font_list", "type"), &Theme::_get_font_list); @@ -660,8 +660,8 @@ void Theme::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_constant", "name", "type"), &Theme::clear_constant); ClassDB::bind_method(D_METHOD("get_constant_list", "type"), &Theme::_get_constant_list); - ClassDB::bind_method(D_METHOD("set_default_font", "font:Font"), &Theme::set_default_theme_font); - ClassDB::bind_method(D_METHOD("get_default_font:Font"), &Theme::get_default_theme_font); + ClassDB::bind_method(D_METHOD("set_default_font", "font"), &Theme::set_default_theme_font); + ClassDB::bind_method(D_METHOD("get_default_font"), &Theme::get_default_theme_font); ClassDB::bind_method(D_METHOD("get_type_list", "type"), &Theme::_get_type_list); diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index dc8f6a0a69..44fe676ddc 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -517,32 +517,32 @@ void TileSet::_bind_methods() { ClassDB::bind_method(D_METHOD("create_tile", "id"), &TileSet::create_tile); ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &TileSet::tile_set_name); ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &TileSet::tile_get_name); - ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture:Texture"), &TileSet::tile_set_texture); - ClassDB::bind_method(D_METHOD("tile_get_texture:Texture", "id"), &TileSet::tile_get_texture); - ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map:Texture"), &TileSet::tile_set_normal_map); - ClassDB::bind_method(D_METHOD("tile_get_normal_map:Texture", "id"), &TileSet::tile_get_normal_map); - ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material:ShaderMaterial"), &TileSet::tile_set_material); - ClassDB::bind_method(D_METHOD("tile_get_material:ShaderMaterial", "id"), &TileSet::tile_get_material); + ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture"), &TileSet::tile_set_texture); + ClassDB::bind_method(D_METHOD("tile_get_texture", "id"), &TileSet::tile_get_texture); + ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map"), &TileSet::tile_set_normal_map); + ClassDB::bind_method(D_METHOD("tile_get_normal_map", "id"), &TileSet::tile_get_normal_map); + ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material"), &TileSet::tile_set_material); + ClassDB::bind_method(D_METHOD("tile_get_material", "id"), &TileSet::tile_get_material); ClassDB::bind_method(D_METHOD("tile_set_texture_offset", "id", "texture_offset"), &TileSet::tile_set_texture_offset); ClassDB::bind_method(D_METHOD("tile_get_texture_offset", "id"), &TileSet::tile_get_texture_offset); ClassDB::bind_method(D_METHOD("tile_set_region", "id", "region"), &TileSet::tile_set_region); ClassDB::bind_method(D_METHOD("tile_get_region", "id"), &TileSet::tile_get_region); - ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape:Shape2D"), &TileSet::tile_set_shape); - ClassDB::bind_method(D_METHOD("tile_get_shape:Shape2D", "id", "shape_id"), &TileSet::tile_get_shape); + ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape"), &TileSet::tile_set_shape); + ClassDB::bind_method(D_METHOD("tile_get_shape", "id", "shape_id"), &TileSet::tile_get_shape); ClassDB::bind_method(D_METHOD("tile_set_shape_transform", "id", "shape_id", "shape_transform"), &TileSet::tile_set_shape_transform); ClassDB::bind_method(D_METHOD("tile_get_shape_transform", "id", "shape_id"), &TileSet::tile_get_shape_transform); ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way); ClassDB::bind_method(D_METHOD("tile_get_shape_one_way", "id", "shape_id"), &TileSet::tile_get_shape_one_way); - ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape:Shape2D", "shape_transform", "one_way"), &TileSet::tile_add_shape, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape", "shape_transform", "one_way"), &TileSet::tile_add_shape, DEFVAL(false)); ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &TileSet::tile_get_shape_count); ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &TileSet::_tile_set_shapes); ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &TileSet::_tile_get_shapes); - ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon:NavigationPolygon"), &TileSet::tile_set_navigation_polygon); - ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon:NavigationPolygon", "id"), &TileSet::tile_get_navigation_polygon); + ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon"), &TileSet::tile_set_navigation_polygon); + ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon", "id"), &TileSet::tile_get_navigation_polygon); ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon_offset", "id", "navigation_polygon_offset"), &TileSet::tile_set_navigation_polygon_offset); ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon_offset", "id"), &TileSet::tile_get_navigation_polygon_offset); - ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder:OccluderPolygon2D"), &TileSet::tile_set_light_occluder); - ClassDB::bind_method(D_METHOD("tile_get_light_occluder:OccluderPolygon2D", "id"), &TileSet::tile_get_light_occluder); + ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder"), &TileSet::tile_set_light_occluder); + ClassDB::bind_method(D_METHOD("tile_get_light_occluder", "id"), &TileSet::tile_get_light_occluder); ClassDB::bind_method(D_METHOD("tile_set_occluder_offset", "id", "occluder_offset"), &TileSet::tile_set_occluder_offset); ClassDB::bind_method(D_METHOD("tile_get_occluder_offset", "id"), &TileSet::tile_get_occluder_offset); @@ -550,7 +550,7 @@ void TileSet::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &TileSet::clear); ClassDB::bind_method(D_METHOD("get_last_unused_tile_id"), &TileSet::get_last_unused_tile_id); ClassDB::bind_method(D_METHOD("find_tile_by_name", "name"), &TileSet::find_tile_by_name); - ClassDB::bind_method(D_METHOD("get_tiles_ids", "name"), &TileSet::_get_tiles_ids); + ClassDB::bind_method(D_METHOD("get_tiles_ids"), &TileSet::_get_tiles_ids); } TileSet::TileSet() { diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index b84cc9563e..b0d14125a0 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -310,11 +310,11 @@ void World::_bind_methods() { ClassDB::bind_method(D_METHOD("get_space"), &World::get_space); ClassDB::bind_method(D_METHOD("get_scenario"), &World::get_scenario); - ClassDB::bind_method(D_METHOD("set_environment", "env:Environment"), &World::set_environment); - ClassDB::bind_method(D_METHOD("get_environment:Environment"), &World::get_environment); - ClassDB::bind_method(D_METHOD("set_fallback_environment", "env:Environment"), &World::set_fallback_environment); - ClassDB::bind_method(D_METHOD("get_fallback_environment:Environment"), &World::get_fallback_environment); - ClassDB::bind_method(D_METHOD("get_direct_space_state:PhysicsDirectSpaceState"), &World::get_direct_space_state); + ClassDB::bind_method(D_METHOD("set_environment", "env"), &World::set_environment); + ClassDB::bind_method(D_METHOD("get_environment"), &World::get_environment); + ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World::set_fallback_environment); + ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World::get_fallback_environment); + ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World::get_direct_space_state); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment"); } diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 056c49f1ae..2f43f903ba 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -371,7 +371,7 @@ void World2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_canvas"), &World2D::get_canvas); ClassDB::bind_method(D_METHOD("get_space"), &World2D::get_space); - ClassDB::bind_method(D_METHOD("get_direct_space_state:Physics2DDirectSpaceState"), &World2D::get_direct_space_state); + ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World2D::get_direct_space_state); } Physics2DDirectSpaceState *World2D::get_direct_space_state() { |