diff --git a/.gitignore b/.gitignore index a7ac2d2fc7..f24d91a7ee 100644 --- a/.gitignore +++ b/.gitignore @@ -296,3 +296,4 @@ cscope.po.out godot.creator.* projects/ +platform/windows/godot_res.res diff --git a/core/globals.cpp b/core/globals.cpp index ffd4cf5d5e..aee708d0cd 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -332,6 +332,7 @@ Error Globals::setup(const String& p_path,const String & p_main_pack) { String candidate = d->get_current_dir(); String current_dir = d->get_current_dir(); + String exec_name = OS::get_singleton()->get_executable_path().get_file().basename(); bool found = false; bool first_time=true; @@ -339,7 +340,16 @@ Error Globals::setup(const String& p_path,const String & p_main_pack) { //try to load settings in ascending through dirs shape! //tries to open pack, but only first time - if (first_time && (_load_resource_pack(current_dir+"/data.pck") || _load_resource_pack(current_dir+"/data.pcz") )) { + if (first_time && (_load_resource_pack(current_dir+"/"+exec_name+".pck") || _load_resource_pack(current_dir+"/"+exec_name+".pcz") )) { + if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) { + + _load_settings("res://override.cfg"); + found=true; + + + } + break; + } else if (first_time && (_load_resource_pack(current_dir+"/data.pck") || _load_resource_pack(current_dir+"/data.pcz") )) { if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) { _load_settings("res://override.cfg"); diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp index 66ae014dbc..48917a19ea 100644 --- a/core/io/resource_format_xml.cpp +++ b/core/io/resource_format_xml.cpp @@ -1955,7 +1955,6 @@ void ResourceFormatLoaderXML::get_recognized_extensions_for_type(const String& p if (ext=="res") continue; p_extensions->push_back("x"+ext); - p_extensions->push_back(ext); } p_extensions->push_back("xml"); diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 51d683f1fe..48c38f05f9 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -1291,8 +1291,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(STRING,STRING,String,pad_decimals,INT,"digits",varray()); ADDFUNC1(STRING,STRING,String,pad_zeros,INT,"digits",varray()); - ADDFUNC0(STRING,STRING,String,to_ascii,varray()); - ADDFUNC0(STRING,STRING,String,to_utf8,varray()); + ADDFUNC0(STRING,RAW_ARRAY,String,to_ascii,varray()); + ADDFUNC0(STRING,RAW_ARRAY,String,to_utf8,varray()); ADDFUNC0(VECTOR2,VECTOR2,Vector2,normalized,varray()); diff --git a/core/variant_op.cpp b/core/variant_op.cpp index eabd647837..1bcfa7d2ae 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -2818,9 +2818,9 @@ void Variant::get_property_list(List *p_list) const { } break; case MATRIX32: { - p_list->push_back( PropertyInfo(Variant::REAL,"x")); - p_list->push_back( PropertyInfo(Variant::REAL,"y")); - p_list->push_back( PropertyInfo(Variant::REAL,"o")); + p_list->push_back( PropertyInfo(Variant::VECTOR2,"x")); + p_list->push_back( PropertyInfo(Variant::VECTOR2,"y")); + p_list->push_back( PropertyInfo(Variant::VECTOR2,"o")); } break; case PLANE: { diff --git a/demos/2d/area_input/icon.png b/demos/2d/area_input/icon.png index d9bb881693..2f412ecf68 100644 Binary files a/demos/2d/area_input/icon.png and b/demos/2d/area_input/icon.png differ diff --git a/demos/2d/dynamic_collision_shapes/icon.png b/demos/2d/dynamic_collision_shapes/icon.png index ac01d401ba..b47506d7c8 100644 Binary files a/demos/2d/dynamic_collision_shapes/icon.png and b/demos/2d/dynamic_collision_shapes/icon.png differ diff --git a/demos/2d/fog_of_war/icon.png.flags b/demos/2d/fog_of_war/icon.png.flags deleted file mode 100644 index dbef2209e8..0000000000 --- a/demos/2d/fog_of_war/icon.png.flags +++ /dev/null @@ -1 +0,0 @@ -gen_mipmaps=true diff --git a/demos/2d/hdr/icon.png b/demos/2d/hdr/icon.png index 2df0ec38e9..461cd4638a 100644 Binary files a/demos/2d/hdr/icon.png and b/demos/2d/hdr/icon.png differ diff --git a/demos/2d/isometric_light/icon.png b/demos/2d/isometric_light/icon.png index 3de9749729..0801f78ea5 100644 Binary files a/demos/2d/isometric_light/icon.png and b/demos/2d/isometric_light/icon.png differ diff --git a/demos/2d/light_mask/icon.png b/demos/2d/light_mask/icon.png index c12b045e62..34a6b709f6 100644 Binary files a/demos/2d/light_mask/icon.png and b/demos/2d/light_mask/icon.png differ diff --git a/demos/2d/lights_shadows/icon.png b/demos/2d/lights_shadows/icon.png index c7f9e13bae..554f01bb46 100644 Binary files a/demos/2d/lights_shadows/icon.png and b/demos/2d/lights_shadows/icon.png differ diff --git a/demos/2d/lookat/engine.cfg b/demos/2d/lookat/engine.cfg index 56917a39ec..81df107f0e 100644 --- a/demos/2d/lookat/engine.cfg +++ b/demos/2d/lookat/engine.cfg @@ -2,3 +2,4 @@ name="Look At Pointer" main_scene="res://lookat.scn" +icon="res://icon.png" diff --git a/demos/2d/lookat/icon.png b/demos/2d/lookat/icon.png new file mode 100644 index 0000000000..442cc1799f Binary files /dev/null and b/demos/2d/lookat/icon.png differ diff --git a/demos/2d/motion/engine.cfg b/demos/2d/motion/engine.cfg index 261111904c..6e660572d6 100644 --- a/demos/2d/motion/engine.cfg +++ b/demos/2d/motion/engine.cfg @@ -2,6 +2,7 @@ name="Motion Test" main_scene="res://motion.scn" +icon="res://icon.png" [display] diff --git a/demos/2d/motion/icon.png b/demos/2d/motion/icon.png new file mode 100644 index 0000000000..9e64961d3c Binary files /dev/null and b/demos/2d/motion/icon.png differ diff --git a/demos/2d/navpoly/icon.png b/demos/2d/navpoly/icon.png index df7fb43633..7a28a367c6 100644 Binary files a/demos/2d/navpoly/icon.png and b/demos/2d/navpoly/icon.png differ diff --git a/demos/2d/normalmaps/icon.png b/demos/2d/normalmaps/icon.png index 4e5d835005..11ff5de829 100644 Binary files a/demos/2d/normalmaps/icon.png and b/demos/2d/normalmaps/icon.png differ diff --git a/demos/2d/polygon_path_finder/engine.cfg b/demos/2d/polygon_path_finder/engine.cfg new file mode 100644 index 0000000000..47450408af --- /dev/null +++ b/demos/2d/polygon_path_finder/engine.cfg @@ -0,0 +1,5 @@ +[application] + +name="Polygon Pathfinder" +main_scene="res://poly_with_holes.scn" +icon="res://icon.png" diff --git a/demos/2d/polygon_path_finder/icon.png b/demos/2d/polygon_path_finder/icon.png new file mode 100644 index 0000000000..643f5595ee Binary files /dev/null and b/demos/2d/polygon_path_finder/icon.png differ diff --git a/demos/2d/polygon_path_finder/poly_with_holes.scn b/demos/2d/polygon_path_finder/poly_with_holes.scn new file mode 100644 index 0000000000..6b340377b7 Binary files /dev/null and b/demos/2d/polygon_path_finder/poly_with_holes.scn differ diff --git a/demos/2d/polygon_path_finder_demo/polygonpathfinder.gd b/demos/2d/polygon_path_finder/polygonpathfinder.gd similarity index 100% rename from demos/2d/polygon_path_finder_demo/polygonpathfinder.gd rename to demos/2d/polygon_path_finder/polygonpathfinder.gd diff --git a/demos/2d/polygon_path_finder_demo/engine.cfg b/demos/2d/polygon_path_finder_demo/engine.cfg deleted file mode 100644 index de5593c417..0000000000 --- a/demos/2d/polygon_path_finder_demo/engine.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[application] - -name="polygon_path_finder_demo" -main_scene="res://new_scene_poly_with_holes.scn" -icon="res://icon.png" diff --git a/demos/2d/polygon_path_finder_demo/icon.png b/demos/2d/polygon_path_finder_demo/icon.png deleted file mode 100644 index 0c422e37b0..0000000000 Binary files a/demos/2d/polygon_path_finder_demo/icon.png and /dev/null differ diff --git a/demos/2d/polygon_path_finder_demo/icon.png.flags b/demos/2d/polygon_path_finder_demo/icon.png.flags deleted file mode 100644 index dbef2209e8..0000000000 --- a/demos/2d/polygon_path_finder_demo/icon.png.flags +++ /dev/null @@ -1 +0,0 @@ -gen_mipmaps=true diff --git a/demos/2d/polygon_path_finder_demo/new_scene_poly_with_holes.scn b/demos/2d/polygon_path_finder_demo/new_scene_poly_with_holes.scn deleted file mode 100644 index 07838be41e..0000000000 Binary files a/demos/2d/polygon_path_finder_demo/new_scene_poly_with_holes.scn and /dev/null differ diff --git a/demos/2d/screen_space_shaders/icon.png b/demos/2d/screen_space_shaders/icon.png index 65247f9ae7..e3cc049081 100644 Binary files a/demos/2d/screen_space_shaders/icon.png and b/demos/2d/screen_space_shaders/icon.png differ diff --git a/demos/2d/sdf_font/icon.png b/demos/2d/sdf_font/icon.png index be9fefa8b0..0c700ad77c 100644 Binary files a/demos/2d/sdf_font/icon.png and b/demos/2d/sdf_font/icon.png differ diff --git a/demos/2d/splash/icon.png b/demos/2d/splash/icon.png index 88620eb35b..b8e24f209e 100644 Binary files a/demos/2d/splash/icon.png and b/demos/2d/splash/icon.png differ diff --git a/demos/2d/sprite_shaders/icon.png b/demos/2d/sprite_shaders/icon.png index b044b31f93..8b13ef6bb4 100644 Binary files a/demos/2d/sprite_shaders/icon.png and b/demos/2d/sprite_shaders/icon.png differ diff --git a/demos/2d/texscreen/engine.cfg b/demos/2d/texscreen/engine.cfg index fb683dfc1d..92d0e98d5b 100644 --- a/demos/2d/texscreen/engine.cfg +++ b/demos/2d/texscreen/engine.cfg @@ -2,6 +2,7 @@ name="Glass Bubbles (Texscreen)" main_scene="res://bubbles.scn" +icon="res://icon.png" [display] diff --git a/demos/2d/texscreen/icon.png b/demos/2d/texscreen/icon.png new file mode 100644 index 0000000000..d74d025ced Binary files /dev/null and b/demos/2d/texscreen/icon.png differ diff --git a/demos/3d/navmesh/icon.png b/demos/3d/navmesh/icon.png index 5b354f931c..51fef7b2df 100644 Binary files a/demos/3d/navmesh/icon.png and b/demos/3d/navmesh/icon.png differ diff --git a/demos/3d/sat_test/icon.png b/demos/3d/sat_test/icon.png index b89c5a7467..194456e10f 100644 Binary files a/demos/3d/sat_test/icon.png and b/demos/3d/sat_test/icon.png differ diff --git a/demos/3d/truck_town/engine.cfg b/demos/3d/truck_town/engine.cfg index 3c340e6dcd..b2a463e1e2 100644 --- a/demos/3d/truck_town/engine.cfg +++ b/demos/3d/truck_town/engine.cfg @@ -2,6 +2,7 @@ name="Truck Town" main_scene="res://car_select.scn" +icon="res://icon.png" [display] diff --git a/demos/3d/truck_town/icon.png b/demos/3d/truck_town/icon.png new file mode 100644 index 0000000000..7d7bd42116 Binary files /dev/null and b/demos/3d/truck_town/icon.png differ diff --git a/demos/gui/drag_and_drop/engine.cfg b/demos/gui/drag_and_drop/engine.cfg index 448939c61d..49b9b93512 100644 --- a/demos/gui/drag_and_drop/engine.cfg +++ b/demos/gui/drag_and_drop/engine.cfg @@ -2,3 +2,4 @@ name="Drag & Drop (GUI)" main_scene="res://drag_and_drop.scn" +icon="res://icon.png" diff --git a/demos/gui/drag_and_drop/icon.png b/demos/gui/drag_and_drop/icon.png new file mode 100644 index 0000000000..f900d8d4a3 Binary files /dev/null and b/demos/gui/drag_and_drop/icon.png differ diff --git a/demos/gui/input_mapping/engine.cfg b/demos/gui/input_mapping/engine.cfg index 6470ec6cd8..811635ce25 100644 --- a/demos/gui/input_mapping/engine.cfg +++ b/demos/gui/input_mapping/engine.cfg @@ -2,6 +2,7 @@ name="Input Mapping GUI" main_scene="res://controls.scn" +icon="res://icon.png" [display] diff --git a/demos/gui/input_mapping/icon.png b/demos/gui/input_mapping/icon.png new file mode 100644 index 0000000000..5a1abf4f58 Binary files /dev/null and b/demos/gui/input_mapping/icon.png differ diff --git a/demos/gui/rich_text_bbcode/icon.png b/demos/gui/rich_text_bbcode/icon.png index 78358ba71b..6db48a3a9b 100644 Binary files a/demos/gui/rich_text_bbcode/icon.png and b/demos/gui/rich_text_bbcode/icon.png differ diff --git a/demos/gui/translation/engine.cfg b/demos/gui/translation/engine.cfg index 169b65e154..dcd3d1983d 100644 --- a/demos/gui/translation/engine.cfg +++ b/demos/gui/translation/engine.cfg @@ -2,6 +2,7 @@ name="Translation Demo" main_scene="res://main.scn" +icon="res://icon.png" [locale] diff --git a/demos/gui/translation/icon.png b/demos/gui/translation/icon.png new file mode 100644 index 0000000000..4be5ac1127 Binary files /dev/null and b/demos/gui/translation/icon.png differ diff --git a/demos/misc/instancing/icon.png b/demos/misc/instancing/icon.png index 7a6de677c5..79a4283de7 100644 Binary files a/demos/misc/instancing/icon.png and b/demos/misc/instancing/icon.png differ diff --git a/demos/misc/regex/engine.cfg b/demos/misc/regex/engine.cfg index 0a6f4f869c..ef5483e096 100644 --- a/demos/misc/regex/engine.cfg +++ b/demos/misc/regex/engine.cfg @@ -2,3 +2,4 @@ name="RegEx" main_scene="res://regex.scn" +icon="res://icon.png" diff --git a/demos/misc/regex/icon.png b/demos/misc/regex/icon.png new file mode 100644 index 0000000000..7a5232ec4b Binary files /dev/null and b/demos/misc/regex/icon.png differ diff --git a/demos/misc/tween/icon.png b/demos/misc/tween/icon.png index 3e991fcc29..ed55c24140 100644 Binary files a/demos/misc/tween/icon.png and b/demos/misc/tween/icon.png differ diff --git a/demos/misc/window_management/icon.png b/demos/misc/window_management/icon.png index 0c422e37b0..ec5c7891f9 100644 Binary files a/demos/misc/window_management/icon.png and b/demos/misc/window_management/icon.png differ diff --git a/demos/misc/window_management/icon.png.flags b/demos/misc/window_management/icon.png.flags deleted file mode 100644 index 5130fd1aab..0000000000 --- a/demos/misc/window_management/icon.png.flags +++ /dev/null @@ -1 +0,0 @@ -gen_mipmaps=false diff --git a/demos/viewport/3d_in_2d/engine.cfg b/demos/viewport/3d_in_2d/engine.cfg index cc893361b5..6d456d7bd4 100644 --- a/demos/viewport/3d_in_2d/engine.cfg +++ b/demos/viewport/3d_in_2d/engine.cfg @@ -2,3 +2,4 @@ name="3D in 2D" main_scene="res://main.scn" +icon="res://icon.png" diff --git a/demos/viewport/3d_in_2d/icon.png b/demos/viewport/3d_in_2d/icon.png new file mode 100644 index 0000000000..d8a332c18f Binary files /dev/null and b/demos/viewport/3d_in_2d/icon.png differ diff --git a/demos/viewport/gui_in_3d/engine.cfg b/demos/viewport/gui_in_3d/engine.cfg index 25a6636132..252e53ca33 100644 --- a/demos/viewport/gui_in_3d/engine.cfg +++ b/demos/viewport/gui_in_3d/engine.cfg @@ -2,3 +2,4 @@ name="GUI in 3D" main_scene="res://gui_3d.scn" +icon="res://icon.png" diff --git a/demos/viewport/gui_in_3d/icon.png b/demos/viewport/gui_in_3d/icon.png new file mode 100644 index 0000000000..22bdd791bb Binary files /dev/null and b/demos/viewport/gui_in_3d/icon.png differ diff --git a/demos/viewport/screen_capture/engine.cfg b/demos/viewport/screen_capture/engine.cfg index b25ed8258e..a843242720 100644 --- a/demos/viewport/screen_capture/engine.cfg +++ b/demos/viewport/screen_capture/engine.cfg @@ -2,6 +2,7 @@ name="Screen Capturing" main_scene="res://screen_capture.scn" +icon="res://icon.png" [display] diff --git a/demos/viewport/screen_capture/icon.png b/demos/viewport/screen_capture/icon.png new file mode 100644 index 0000000000..a696824775 Binary files /dev/null and b/demos/viewport/screen_capture/icon.png differ diff --git a/doc/base/classes.xml b/doc/base/classes.xml index da53cb90a5..12f9062888 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -3197,6 +3197,24 @@ + + + + + + + + + + + + + + + + + + @@ -4353,7 +4371,7 @@ Stop a given voice. - + @@ -5477,7 +5495,7 @@ - + Group of Buttons. @@ -5523,6 +5541,10 @@ + + + + @@ -6628,7 +6650,7 @@ - Radius of the [CapsuleShape2D]. + Set the radius of the [CapsuleShape2D]. @@ -6642,7 +6664,7 @@ - Height of the [CapsuleShape2D]. + Set the height of the [CapsuleShape2D]. @@ -6947,7 +6969,7 @@ Base node for 2D collisionables. - CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing CollisionBody2D and CollisionPolygon2D nodes as children. Such nodes are for reference ant not present outside the editor, so code should use the regular shape API. + CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing [CollisionBody2D] and [CollisionPolygon2D] nodes as children. Such nodes are for reference and not present outside the editor, so code should use the regular shape API. @@ -7143,58 +7165,69 @@ - Editor-Only class. + Editor-only class for easy editing of collision polygons. - Editor-Only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code. This class is for editing custom shape polygons. + Editor-only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code. This class is for editing custom shape polygons. + Set the array of points forming the polygon. + When editing the point list via the editor, depending on [method get_build_mode], it has to be a list of points (for [code]build_mode[/code]=0), or a list of lines (for [code]build_mode[/code]=1). In the second case, the even elements of the array define the start point of the line, and the odd elements the end point. + Return the list of points that define the polygon. + Set whether the polygon is to be a [ConvexPolygon2D] ([code]build_mode[/code]=0), or a [ConcavePolygon2D] ([code]build_mode[/code]=1). + Return whether the polygon is a [ConvexPolygon2D] ([code]build_mode[/code]=0), or a [ConcavePolygon2D] ([code]build_mode[/code]=1). + Set whether this polygon is a trigger. A trigger polygon detects collisions, but is otherwise unaffected by physics (i.e. colliding objects will not get blocked). + Return whether this polygon is a trigger. + Return the index of the first shape generated by the editor. + When [code]build_mode[/code] is set to generate convex polygons, the shape shown in the editor may be decomopsed into many convex polygons. In that case, a range of indexes is needed to directly access the [Shape2D]s. + When [code]build_mode[/code] is set to generate concave polygons, there is only one [Shape2D] generated, so the start index and the end index are the same. + Return the index of the last shape generated by the editor. @@ -7253,40 +7286,45 @@ - Editor-Only class. + Editor-only class for easy editing of shapes. - Editor-Only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code. + Editor-only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code. + Set this shape's [Shape2D]. This will not appear as a node, but can be directly edited as a property. + Return this shape's [Shape2D]. + Set whether this shape is a trigger. A trigger shape detects collisions, but is otherwise unaffected by physics (i.e. will not block movement of colliding objects). + Return whether this shape is a trigger. + Return the index of this shape inside its container [CollisionObject2D]. This can be used to directly access the underlying [Shape2D]. @@ -7298,7 +7336,7 @@ Color in RGBA format. - A color is represented as red, green and blue (r,g,b) components. Additionally, "a" represents the alpha component, often used for transparency. Values are in floating point and usually range from 0 to 1. Some methods (such as set_modulate() ) may accept values > 1. + A color is represented as red, green and blue (r,g,b) components. Additionally, "a" represents the alpha component, often used for transparency. Values are in floating point and usually range from 0 to 1. Some methods (such as set_modulate() ) may accept values > 1. @@ -7666,7 +7704,7 @@ Concave polygon shape. - Concave polygon shape resource, which can be set into a [PhysicsBody] or area. This shape is created by feeding a list of triangles. + Concave polygon shape resource, which can be set into a [PhysicsBody] or area. This shape is created by feeding a list of triangles. @@ -7693,6 +7731,7 @@ Concave polygon 2D shape resource for physics. It is made out of segments and is very optimal for complex polygonal concave collisions. It is really not advised to use for RigidBody nodes. A CollisionPolygon2D in convex decomposition mode (solids) or several convex objects are advised for that instead. Otherwise, a concave polygon 2D shape is better for static collisions. + The main difference between a [ConvexPolygonShape2D] and a [ConcavePolygonShape2D] is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex in order to speed up collision detection. @@ -8583,14 +8622,15 @@ Convex Polygon Shape for 2D physics. - Convex Polygon Shape for 2D physics. + Convex Polygon Shape for 2D physics. A convex polygon, whatever its shape, is internally decomposed into as many convex polygons as needed to ensure all collision checks against it are always done on convex polygons (which are faster to check). + The main difference between a [ConvexPolygonShape2D] and a [ConcavePolygonShape2D] is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex in order to speed up collision detection. - Create the point set from a point cloud. The resulting convex hull will be set as the shape. + Currently, this method does nothing. @@ -8871,12 +8911,12 @@ Cubic interpolation tends to follow the curves better, but linear is faster (and + + - - Returns a list of points along the curve, with a curvature controlled point density. That is, the curvier parts will have more points than the straighter parts. This approximation makes straight segments between each point, then subdivides those segments until the resulting shape is similar enough. @@ -8884,16 +8924,6 @@ This approximation makes straight segments between each point, then subdivides t "tolerance_degrees" controls how many degrees the midpoint of a segment may deviate from the real curve, before the segment has to be subdivided. - - - - - - - - - - @@ -9078,12 +9108,12 @@ Cubic interpolation tends to follow the curves better, but linear is faster (and + + - - Returns a list of points along the curve, with a curvature controlled point density. That is, the curvier parts will have more points than the straighter parts. This approximation makes straight segments between each point, then subdivides those segments until the resulting shape is similar enough. @@ -9091,16 +9121,6 @@ This approximation makes straight segments between each point, then subdivides t "tolerance_degrees" controls how many degrees the midpoint of a segment may deviate from the real curve, before the segment has to be subdivided. - - - - - - - - - - @@ -10761,6 +10781,14 @@ This approximation makes straight segments between each point, then subdivides t + + + + + + + + @@ -12521,9 +12549,9 @@ This approximation makes straight segments between each point, then subdivides t - Connect to a host. This needs to be done before any requests are sent. + Connect to a host. This needs to be done before any requests are sent. The host should not have http:// prepended but will strip the protocol identifier if provided. - + verify_host will check the SSL identity of the host if set to true. @@ -12545,13 +12573,12 @@ verify_host will check the SSL identity of the host if set to true. - Sends a request to the connected host. The url is the what is normally behind the hostname, -i.e; + Sends a request to the connected host. The url is the what is normally behind the hostname, i.e: http://somehost.com/index.php -url would be "index.php" - +url would be "index.php" + Headers are HTTP request headers - + To create a POST request with query strings to push to the server, do: var fields = {"username" : "user", "password" : "pass"} @@ -12566,8 +12593,8 @@ var result = httpClient.request(httpClient.METHOD_POST, "index.php", headers, qu - - Stub function + + Stub function @@ -12576,7 +12603,7 @@ var result = httpClient.request(httpClient.METHOD_POST, "index.php", headers, qu - Stub function + Stub function @@ -12629,14 +12656,14 @@ var result = httpClient.request(httpClient.METHOD_POST, "index.php", headers, qu - Sets the size of the buffer used and maximum bytes to read per iteration + Sets the size of the buffer used and maximum bytes to read per iteration - If set to true, execute will wait until all data is read from the response. + If set to true, execute will wait until all data is read from the response. @@ -12649,30 +12676,30 @@ var result = httpClient.request(httpClient.METHOD_POST, "index.php", headers, qu - Returns a status string like STATUS_REQUESTING. Need to call [method poll] in order to get status updates. + Returns a status string like STATUS_REQUESTING. Need to call [method poll] in order to get status updates. - - This needs to be called in order to have any request processed. Check results with [method get_status] + + This needs to be called in order to have any request processed. Check results with [method get_status] - - - - - - - Generates a GET/POST application/x-www-form-urlencoded style query string from a provided dictionary. - + + + + + + + Generates a GET/POST application/x-www-form-urlencoded style query string from a provided dictionary. + var fields = {"username": "user", "password": "pass"} String queryString = httpClient.query_string_from_dict(fields) - + returns:= "username=user&password=pass" - - + + @@ -14453,6 +14480,12 @@ returns:= "username=user&password=pass" + + + + + + @@ -15902,6 +15935,18 @@ returns:= "username=user&password=pass" LineEdit provides a single line string editor, used for text fields. + + + + + + + + + + + + Clear the [LineEdit] text. @@ -16015,6 +16060,14 @@ returns:= "username=user&password=pass" + + + + + + + + @@ -16733,6 +16786,8 @@ returns:= "username=user&password=pass" + + @@ -18584,6 +18639,18 @@ returns:= "username=user&password=pass" Replace a node in a scene by a given one. Subscriptions that pass through this node will be lost. + + + + + + + + + + + + @@ -21573,16 +21640,16 @@ This method controls whether the position between two cached points is interpola - Forbids the PathFollow to rotate. + Forbids the PathFollow to rotate. - Allows the PathFollow to rotate in the Y axis only. + Allows the PathFollow to rotate in the Y axis only. - Allows the PathFollow to rotate in both the X, and Y axes. + Allows the PathFollow to rotate in both the X, and Y axes. - Allows the PathFollow to rotate in any axis. + Allows the PathFollow to rotate in any axis. @@ -21697,10 +21764,6 @@ This method controls whether the position between two cached points is interpola - - - - @@ -26057,6 +26120,14 @@ This method controls whether the position between two cached points is interpola + + + + + + + + @@ -26301,12 +26372,14 @@ This method controls whether the position between two cached points is interpola + Returns a copy of the array's contents formatted as String. Fast alternative to get_string_from_utf8(), assuming the content is ASCII-only (unlike the UTF-8 function, this function maps every byte to a character in the string, so any multibyte sequence will be torn apart). + Returns a copy of the array's contents formatted as String, assuming the array is formatted as UTF-8. Slower than get_string_from_ascii(), but works for UTF-8. Usually you should prefer this function over get_string_from_ascii() to support international input. @@ -26584,19 +26657,21 @@ This method controls whether the position between two cached points is interpola Ray 2D shape resource for physics. - Ray 2D shape resource for physics. A ray is not really a collision body, isntead it tries to separate itself from whatever is touching its far endpoint. It's often useful for ccharacters. + Ray 2D shape resource for physics. A ray is not really a collision body, isntead it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters. + Set the length of the ray. + Return the length of the ray. @@ -26866,27 +26941,22 @@ This method controls whether the position between two cached points is interpola - [OK] if the regular expression was valid. [FAIL] otherwise. - The string to be converted into a regular expression. + + - Once created, a RegEx object needs a regular expression to be assigned to it. This method tries to convert the string given to an usable regular expression. - The position within the string (starting with 0) where the pattern was found. It will return -1 if the pattern was not found, it was invalid, or the start or end positions were beyond the string's end. - The text to search the pattern in. - The position in the string (starting with 0) to start searching from. - The position in the string (starting with 0) to stop searching. A value less than the start position means "end of the string". This method tries to find the pattern within the string, and returns the position where it was found. It also stores any capturing group (see [method get_capture]) for further retrieval. @@ -26915,7 +26985,6 @@ This method controls whether the position between two cached points is interpola - The number of the captured group, starting with 0. Like other regular expression engines, Godot's engine takes 0 as the full expression, and 1 as the first pair of capturing parentheses. Returns a captured group. A captured group is the part of a string that matches a part of the pattern delimited by parentheses (unless they are non-capturing parentheses [i](?:)[/i]). @@ -26923,7 +26992,6 @@ This method controls whether the position between two cached points is interpola - A list contining all the strings captured by the regular expression. Return a list of all the captures made by the regular expression. @@ -29543,24 +29611,28 @@ This method controls whether the position between two cached points is interpola + Set the first point's position. + Return the first point's position. + Set the second point's position. + Return the second point's position. @@ -30608,13 +30680,14 @@ This method controls whether the position between two cached points is interpola Use a custom solver bias. No need to change this unless you really know what you are doing. + The solver bias is a factor controlling how much two objects "rebound" off each other, when colliding, to avoid them getting into each other because of numerical imprecision. - Return the custom solver bias. No need to change this unless you really know what you are doing. + Return the custom solver bias. @@ -30627,6 +30700,8 @@ This method controls whether the position between two cached points is interpola + Return whether this shape is colliding with another. + This method needs the transformation matrix for this shape ([code]local_xform[/code]), the shape to check collisions with ([code]with_shape[/code]), and the transformation matrix of that shape ([code]shape_xform[/code]). @@ -30643,6 +30718,8 @@ This method controls whether the position between two cached points is interpola + Return whether this shape would collide with another, if a given movemen was applied. + This method needs the transformation matrix for this shape ([code]local_xform[/code]), the movement to test on this shape ([code]local_motion[/code]), the shape to check collisions with ([code]with_shape[/code]), the transformation matrix of that shape ([code]shape_xform[/code]), and the movement to test ont the other object ([code]shape_motion[/code]). @@ -30653,6 +30730,8 @@ This method controls whether the position between two cached points is interpola + Return a list of the points where this shape touches another. If there are no collisions, the list is empty. + This method needs the transformation matrix for this shape ([code]local_xform[/code]), the shape to check collisions with ([code]with_shape[/code]), and the transformation matrix of that shape ([code]shape_xform[/code]). @@ -30667,6 +30746,8 @@ This method controls whether the position between two cached points is interpola + Return a list of the points where this shape would touch another, if a given movement was applied. If there are no collisions, the list is empty. + This method needs the transformation matrix for this shape ([code]local_xform[/code]), the movement to test on this shape ([code]local_motion[/code]), the shape to check collisions with ([code]with_shape[/code]), the transformation matrix of that shape ([code]shape_xform[/code]), and the movement to test ont the other object ([code]shape_motion[/code]). @@ -33055,9 +33136,10 @@ This method controls whether the position between two cached points is interpola - + + Convert the String (which is a character array) to RawArray (which is an array of bytes). The conversion is speeded up in comparison to to_utf8() with the assumption that all the characters the String contains are only ASCII characters. @@ -33089,9 +33171,10 @@ This method controls whether the position between two cached points is interpola - + + Convert the String (which is an array of characters) to RawArray (which is an array of bytes). The conversion is a bit slower than to_ascii(), but supports all UTF-8 characters. Therefore, you should prefer this function over to_ascii(). @@ -33988,15 +34071,17 @@ This method controls whether the position between two cached points is interpola + + - Set the current column of the text editor. + + - Set the current line of the text editor. @@ -36252,6 +36337,18 @@ This method controls whether the position between two cached points is interpola + + + + + + + + + + + + @@ -37404,6 +37501,14 @@ This method controls whether the position between two cached points is interpola + + + + + Returns the result of atan2 when called with the Vector's x and y as parameters (Math::atan2(x,y)). + Be aware that it therefore returns an angle oriented clockwise with regard to the (0, 1) unit vector, and not an angle oriented counter-clockwise with regard to the (1, 0) unit vector (which would be the typical trigonometric representation of the angle when calling Math::atan2(y,x)). + + @@ -37422,13 +37527,6 @@ This method controls whether the position between two cached points is interpola Returns the angle in radians between the line connecting the two points and the x coordinate. - - - - - Returns the result of atan2 when called with the Vector's x and y as parameters. - - @@ -37529,7 +37627,7 @@ This method controls whether the position between two cached points is interpola - Reflects/mirrors the vector around another vector. + Like "slide", but reflects the Vector instead of continuing along the wall. @@ -37593,10 +37691,10 @@ This method controls whether the position between two cached points is interpola - An Array of Vector2's. + An Array of Vector2. - An Array specifically designed to hold Vector2's. + An Array specifically designed to hold Vector2. @@ -37605,21 +37703,21 @@ This method controls whether the position between two cached points is interpola - Get the Vector2 at the given index. + Returns the Vector2 at the given index. - Insert a new Vector2. + Inserts a Vector2 at the end. - Set the size of the Vector2Array. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array. + Sets the size of the Vector2Array. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array. @@ -37628,7 +37726,7 @@ This method controls whether the position between two cached points is interpola - Set the Vector2 at the given index. + Changes the Vector2 at the given index. @@ -37663,12 +37761,14 @@ This method controls whether the position between two cached points is interpola + Returns a new vector with all components in absolute values (e.g. positive). + Returns a new vector with all components rounded up. @@ -37692,7 +37792,7 @@ This method controls whether the position between two cached points is interpola - Perform a cubic interpolation between vectors a,b,c,d (b is current), by the given amount (i). + Perform a cubic interpolation between vectors pre_a, a, b, post_b (a is current), by the given amount (t). @@ -37701,7 +37801,7 @@ This method controls whether the position between two cached points is interpola - Return the squared distance (distance minus the last square root) to b. + Return the squared distance (distance minus the last square root) to b. Prefer this function over distance_to if you need to sort vectors or need the squared distance for some formula. @@ -37726,13 +37826,14 @@ This method controls whether the position between two cached points is interpola + Returns a new vector with all components rounded down. - Returns the inverse of the vector. this is the same as Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z ) + Returns the inverse of the vector. This is the same as Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z ) @@ -37746,7 +37847,7 @@ This method controls whether the position between two cached points is interpola - Return the length of the vector, squared. + Return the length of the vector, squared. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula. @@ -37757,26 +37858,28 @@ This method controls whether the position between two cached points is interpola - Linearly interpolates the vector to a given one (b), by the given amount (i). + Linearly interpolates the vector to a given one (b), by the given amount (t). + Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the largest. + Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the smallest. - Return a copy of the normalized vector to unit length. This is the same as v / v.length() + Return a copy of the normalized vector to unit length. This is the same as v / v.length(). @@ -37785,6 +37888,7 @@ This method controls whether the position between two cached points is interpola + Like "slide", but reflects the Vector instead of continuing along the wall. @@ -37795,6 +37899,7 @@ This method controls whether the position between two cached points is interpola + Rotates the vector around some axis by phi radians. @@ -37803,6 +37908,7 @@ This method controls whether the position between two cached points is interpola + Slides the vector along a wall. @@ -37824,6 +37930,7 @@ This method controls whether the position between two cached points is interpola + Returns a Vector3 with the given components. @@ -37837,17 +37944,22 @@ This method controls whether the position between two cached points is interpola + Enumerated value for the X axis. Returned by functions like max_axis or min_axis. + Enumerated value for the Y axis. + Enumerated value for the Z axis. + An Array of Vector3. + An Array specifically designed to hold Vector3. @@ -37856,18 +37968,21 @@ This method controls whether the position between two cached points is interpola + Returns the Vector3 at the given index. + Inserts a Vector3 at the end. + Sets the size of the Vector3Array. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array. @@ -37876,12 +37991,14 @@ This method controls whether the position between two cached points is interpola + Changes the Vector3 at the given index. + Returns the size of the array. @@ -37890,6 +38007,7 @@ This method controls whether the position between two cached points is interpola + Constructs a new Vector3Array. Optionally, you can pass in an Array that will be converted. diff --git a/doc/core_classes.xml b/doc/core_classes.xml index 02b46ac4b9..c37b50f122 100644 --- a/doc/core_classes.xml +++ b/doc/core_classes.xml @@ -575,8 +575,8 @@ 3x3 Matrix. - Matrix represent a 3x3 (3 rows by 3 columns) transformation matrix. it is used mainly to represent and accumulate transformations such as rotation or scale when used as an OCS (oriented coordinate system). + @@ -937,8 +937,8 @@ Vector used for 2D Math. - Vector class, which performs basic 2D vector math operations. + diff --git a/doc/engine_classes.xml b/doc/engine_classes.xml index af153a16ef..43602e26e9 100644 --- a/doc/engine_classes.xml +++ b/doc/engine_classes.xml @@ -1502,7 +1502,7 @@ - + diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index b473e8493f..39b448d6e0 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -4641,6 +4641,9 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const { if (light_flags.uses_light) { enablers.push_back("#define USE_LIGHT_SHADER_CODE\n"); } + if (light_flags.uses_shadow_color) { + enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n"); + } if (light_flags.uses_time || fragment_flags.uses_time || vertex_flags.uses_time) { enablers.push_back("#define USE_TIME\n"); uses_time=true; diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index c8f59ce22b..f981529ee3 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -221,6 +221,10 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a uses_light=true; } + if (vnode->name==vname_shadow) { + uses_shadow_color=true; + } + } if (type==ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX) { @@ -783,13 +787,14 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() { replace_table["texscreen"]= "texscreen"; replace_table["texpos"]= "texpos"; - mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["POSITION"] = "gl_Position"; + mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SRC_VERTEX"] = "vertex_in.xyz"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SRC_NORMAL"] = "normal_in"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SRC_TANGENT"]="tangent_in"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SRC_BINORMALF"]="binormalf"; - + + mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["POSITION"] = "gl_Position"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["VERTEX"]="vertex_interp"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["NORMAL"]="normal_interp"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["TANGENT"]="tangent_interp"; @@ -858,6 +863,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() { mode_replace_table[ShaderLanguage::SHADER_MATERIAL_LIGHT]["LIGHT"]="light"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_LIGHT]["POINT_COORD"]="gl_PointCoord"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_LIGHT]["TIME"]="time"; + mode_replace_table[ShaderLanguage::SHADER_MATERIAL_LIGHT]["SHADOW"]="shadow_color"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX]["SRC_VERTEX"]="src_vtx"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX]["VERTEX"]="outvec.xy"; diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl index 38fb03ab5c..ccd80bf2f0 100644 --- a/drivers/gles2/shaders/material.glsl +++ b/drivers/gles2/shaders/material.glsl @@ -1175,6 +1175,10 @@ FRAGMENT_SHADER_CODE vec3 mdiffuse = diffuse.rgb; vec3 light; +#if defined(USE_LIGHT_SHADOW_COLOR) + vec3 shadow_color=vec3(0.0,0.0,0.0); +#endif + #if defined(USE_LIGHT_SHADER_CODE) //light is written by the light shader { @@ -1195,6 +1199,10 @@ LIGHT_SHADER_CODE #endif diffuse.rgb = const_light_mult * ambient_light *diffuse.rgb + light * attenuation * shadow_attenuation; +#if defined(USE_LIGHT_SHADOW_COLOR) + diffuse.rgb += light * shadow_color * attenuation * (1.0 - shadow_attenuation); +#endif + #ifdef USE_FOG diffuse.rgb = mix(diffuse.rgb,fog_interp.rgb,fog_interp.a); diff --git a/main/main.cpp b/main/main.cpp index b4f4c48643..80a7cbc5fc 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -432,7 +432,6 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas } else if (I->get()=="-e" || I->get()=="-editor") { // fonud editor editor=true; - init_maximized=true; } else if (I->get()=="-nowindow") { // fullscreen OS::get_singleton()->set_no_window_mode(true); @@ -649,6 +648,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas if (editor) { main_args.push_back("-editor"); + init_maximized=true; use_custom_res=false; } @@ -876,6 +876,7 @@ Error Main::setup2() { boot_logo_path = boot_logo_path.strip_edges(); if (boot_logo_path!=String() /*&& FileAccess::exists(boot_logo_path)*/) { + print_line("Boot splash path: "+boot_logo_path); Error err = boot_logo.load(boot_logo_path); } @@ -893,7 +894,7 @@ Error Main::setup2() { } else { #ifndef NO_DEFAULT_BOOT_LOGO - MAIN_PRINT("Main: Create botsplash"); + MAIN_PRINT("Main: Create bootsplash"); Image splash(boot_splash_png); MAIN_PRINT("Main: ClearColor"); @@ -1085,7 +1086,7 @@ bool Main::start() { #endif - if(script=="" && game_path=="" && !editor && String(GLOBAL_DEF("application/main_scene",""))!="") { + if(script=="" && game_path=="" && String(GLOBAL_DEF("application/main_scene",""))!="") { game_path=GLOBAL_DEF("application/main_scene",""); } diff --git a/platform/android/java/src/com/android/godot/GodotView.java b/platform/android/java/src/com/android/godot/GodotView.java index ad0354e624..1a84923065 100644 --- a/platform/android/java/src/com/android/godot/GodotView.java +++ b/platform/android/java/src/com/android/godot/GodotView.java @@ -371,8 +371,8 @@ public class GodotView extends GLSurfaceView { if (use_32) { setEGLConfigChooser( translucent ? - new ConfigChooser(8, 8, 8, 8, 24, stencil) : - new ConfigChooser(8, 8, 8, 8, 24, stencil) ); + new FallbackConfigChooser(8, 8, 8, 8, 24, stencil, new ConfigChooser(8, 8, 8, 8, 16, stencil)) : + new FallbackConfigChooser(8, 8, 8, 8, 24, stencil, new ConfigChooser(5, 6, 5, 0, 16, stencil)) ); } else { setEGLConfigChooser( translucent ? @@ -410,6 +410,25 @@ public class GodotView extends GLSurfaceView { Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error)); } } + /* Fallback if 32bit View is not supported*/ + private static class FallbackConfigChooser extends ConfigChooser { + private ConfigChooser fallback; + + public FallbackConfigChooser(int r, int g, int b, int a, int depth, int stencil, ConfigChooser fallback) { + super(r, g, b, a, depth, stencil); + this.fallback = fallback; + } + + @Override + public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display, EGLConfig[] configs) { + EGLConfig ec = super.chooseConfig(egl, display, configs); + if (ec == null) { + Log.w(TAG, "Trying ConfigChooser fallback"); + ec = fallback.chooseConfig(egl, display, configs); + } + return ec; + } + } private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser { diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 0c0f924f52..efda8a66e1 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -308,7 +308,9 @@ void AcceptDialog::_bind_methods() { ADD_SIGNAL( MethodInfo("confirmed") ); ADD_SIGNAL( MethodInfo("custom_action",PropertyInfo(Variant::STRING,"action")) ); - + ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"dialog/text",PROPERTY_HINT_MULTILINE_TEXT,"",PROPERTY_USAGE_DEFAULT_INTL),_SCS("set_text"),_SCS("get_text")); + ADD_PROPERTY( PropertyInfo(Variant::BOOL, "dialog/hide_on_ok"),_SCS("set_hide_on_ok"),_SCS("get_hide_on_ok") ); + } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 99663fb2e2..20f28ecf10 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -170,7 +170,14 @@ void PopupMenu::_activate_submenu(int over) { Point2 p = get_global_pos(); Rect2 pr(p,get_size()); Ref style = get_stylebox("panel"); - pm->set_pos(p+Point2(get_size().width,items[over]._ofs_cache-style->get_offset().y)); + + Point2 pos = p+Point2(get_size().width,items[over]._ofs_cache-style->get_offset().y); + Size2 size = pm->get_size(); + // fix pos + if (pos.x+size.width > get_viewport_rect().size.width) + pos.x=p.x-size.width; + + pm->set_pos(pos); pm->popup(); PopupMenu *pum = pm->cast_to(); diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index d5204f45d5..7b67eaeda8 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -1435,6 +1435,7 @@ const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={ {MODE_MATERIAL,SHADER_TYPE_LIGHT,"ShadeParam","SHADE_PARAM","",SLOT_TYPE_SCALAR,SLOT_IN}, //light out {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Light","LIGHT","",SLOT_TYPE_VEC,SLOT_OUT}, + {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Shadow", "SHADOW", "",SLOT_TYPE_VEC, SLOT_OUT }, //canvas item vertex in {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Vertex","vec3(SRC_VERTEX,0)","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"UV","SRC_UV","",SLOT_TYPE_VEC,SLOT_IN}, diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index c155f5204a..6c5a2de97b 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -132,7 +132,7 @@ void AudioServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("voice_stop","voice"), &AudioServer::voice_stop ); - ObjectTypeDB::bind_method(_MD("free","rid"), &AudioServer::free ); + ObjectTypeDB::bind_method(_MD("free_rid","rid"), &AudioServer::free ); ObjectTypeDB::bind_method(_MD("set_stream_global_volume_scale","scale"), &AudioServer::set_stream_global_volume_scale ); ObjectTypeDB::bind_method(_MD("get_stream_global_volume_scale"), &AudioServer::get_stream_global_volume_scale ); diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 6532c3f0ac..6c5f64edd9 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -1113,7 +1113,8 @@ const ShaderLanguage::BuiltinsDef ShaderLanguage::light_builtins_defs[]={ { "SPECULAR_EXP", TYPE_FLOAT}, { "SHADE_PARAM", TYPE_FLOAT}, { "LIGHT", TYPE_VEC3}, - { "POINT_COORD", TYPE_VEC2}, + { "SHADOW", TYPE_VEC3 }, + { "POINT_COORD", TYPE_VEC2 }, // { "SCREEN_POS", TYPE_VEC2}, // { "SCREEN_TEXEL_SIZE", TYPE_VEC2}, { "TIME", TYPE_FLOAT}, diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 22acfd4d07..4e22592880 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -2011,6 +2011,11 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { + } break; + case SCENE_TAB_CLOSE: { + _remove_scene(tab_closing); + _update_scene_tabs(); + current_option = -1; } break; case FILE_SAVE_SCENE: { @@ -2023,7 +2028,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { return; }; // fallthrough to save_as - }; + } break; case FILE_SAVE_AS_SCENE: { Node *scene = editor_data.get_edited_scene_root(); @@ -2957,23 +2962,23 @@ void EditorNode::_remove_edited_scene() { _update_title(); _update_scene_tabs(); - if (editor_data.get_edited_scene_count()==1) { - //make new scene appear saved - set_current_version(editor_data.get_undo_redo().get_version()); - unsaved_cache=false; - } +// if (editor_data.get_edited_scene_count()==1) { +// //make new scene appear saved +// set_current_version(editor_data.get_undo_redo().get_version()); +// unsaved_cache=false; +// } } void EditorNode::_remove_scene(int index) { // printf("Attempting to remove scene %d (current is %d)\n", index, editor_data.get_edited_scene()); + if (editor_data.get_edited_scene() == index) { //Scene to remove is current scene _remove_edited_scene(); } else { - // Scene to remove is not active scene."); + // Scene to remove is not active scene editor_data.remove_scene(index); - editor_data.get_undo_redo().clear_history(); } } @@ -4019,6 +4024,8 @@ void EditorNode::_bind_methods() { ObjectTypeDB::bind_method("_prepare_history",&EditorNode::_prepare_history); ObjectTypeDB::bind_method("_select_history",&EditorNode::_select_history); + ObjectTypeDB::bind_method("_toggle_search_bar",&EditorNode::_toggle_search_bar); + ObjectTypeDB::bind_method("_clear_search_box",&EditorNode::_clear_search_box); ObjectTypeDB::bind_method(_MD("add_editor_import_plugin", "plugin"), &EditorNode::add_editor_import_plugin); ObjectTypeDB::bind_method(_MD("remove_editor_import_plugin", "plugin"), &EditorNode::remove_editor_import_plugin); @@ -4467,8 +4474,19 @@ void EditorNode::_scene_tab_script_edited(int p_tab) { } void EditorNode::_scene_tab_closed(int p_tab) { - _remove_scene(p_tab); - _update_scene_tabs(); + current_option = SCENE_TAB_CLOSE; + tab_closing = p_tab; + if (unsaved_cache) { + confirmation->get_ok()->set_text("Yes"); + //confirmation->get_cancel()->show(); + confirmation->set_text("Close scene? (Unsaved changes will be lost)"); + confirmation->popup_centered_minsize(); + } + else { + _remove_scene(p_tab); + //_update_scene_tabs(); + } + } @@ -4501,6 +4519,30 @@ void EditorNode::_scene_tab_changed(int p_tab) { } +void EditorNode::_toggle_search_bar(bool p_pressed) { + + property_editor->set_use_filter(p_pressed); + + if (p_pressed) { + + search_bar->show(); + search_box->grab_focus(); + search_box->select_all(); + } else { + + search_bar->hide(); + } +} + +void EditorNode::_clear_search_box() { + + if (search_box->get_text()=="") + return; + + search_box->clear(); + property_editor->update_tree(); +} + EditorNode::EditorNode() { EditorHelp::generate_doc(); //before any editor classes are crated @@ -5306,6 +5348,12 @@ EditorNode::EditorNode() { editor_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); prop_editor_hb->add_child(editor_path); + search_button = memnew( ToolButton ); + search_button->set_toggle_mode(true); + search_button->set_pressed(false); + search_button->set_icon(gui_base->get_icon("Zoom","EditorIcons")); + prop_editor_hb->add_child(search_button); + search_button->connect("toggled",this,"_toggle_search_bar"); object_menu = memnew( MenuButton ); object_menu->set_icon(gui_base->get_icon("Tools","EditorIcons")); @@ -5317,6 +5365,22 @@ EditorNode::EditorNode() { create_dialog->set_base_type("Resource"); create_dialog->connect("create",this,"_resource_created"); + search_bar = memnew( HBoxContainer ); + search_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL); + prop_editor_base->add_child(search_bar); + search_bar->hide(); + + l = memnew( Label("Search: ") ); + search_bar->add_child(l); + + search_box = memnew( LineEdit ); + search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); + search_bar->add_child(search_box); + + ToolButton *clear_button = memnew( ToolButton ); + clear_button->set_icon(gui_base->get_icon("Close","EditorIcons")); + search_bar->add_child(clear_button); + clear_button->connect("pressed",this,"_clear_search_box"); property_editor = memnew( PropertyEditor ); property_editor->set_autoclear(true); @@ -5325,6 +5389,7 @@ EditorNode::EditorNode() { property_editor->set_use_doc_hints(true); property_editor->hide_top_label(); + property_editor->register_text_enter(search_box); prop_editor_base->add_child( property_editor ); property_editor->set_undo_redo(&editor_data.get_undo_redo()); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index bd88e1a4b9..7d8b97688e 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -173,6 +173,7 @@ class EditorNode : public Node { SOURCES_REIMPORT, DEPENDENCY_LOAD_CHANGED_IMAGES, DEPENDENCY_UPDATE_IMPORTED, + SCENE_TAB_CLOSE, IMPORT_PLUGIN_BASE=100, @@ -217,6 +218,7 @@ class EditorNode : public Node { //main tabs Tabs *scene_tabs; + int tab_closing; int old_split_ofs; @@ -248,6 +250,7 @@ class EditorNode : public Node { ToolButton *play_scene_button; ToolButton *play_custom_scene_button; MenuButton *debug_button; + ToolButton *search_button; TextureProgress *audio_vu; //MenuButton *fileserver_menu; @@ -266,6 +269,9 @@ class EditorNode : public Node { ScenesDock *scenes_dock; EditorRunNative *run_native; + HBoxContainer *search_bar; + LineEdit *search_box; + CreateDialog *create_dialog; CallDialog *call_dialog; @@ -515,6 +521,9 @@ class EditorNode : public Node { void _save_docks(); void _load_docks(); + void _toggle_search_bar(bool p_pressed); + void _clear_search_box(); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index 893df04709..04705017d2 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -624,11 +624,6 @@ void ProjectManager::_open_project_confirm() { args.push_back("-editor"); - const String &selected_main = E->get(); - if (selected_main!="") { - args.push_back(selected_main); - } - String exec = OS::get_singleton()->get_executable_path(); OS::ProcessID pid=0; diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 25a2750166..2fd8b37753 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -59,6 +59,9 @@ void ProjectSettings::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { + search_button->set_icon(get_icon("Zoom","EditorIcons")); + clear_button->set_icon(get_icon("Close","EditorIcons")); + translation_list->connect("button_pressed",this,"_translation_delete"); _update_actions(); popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),"Key",InputEvent::KEY); @@ -1171,6 +1174,31 @@ void ProjectSettings::_update_autoload() { } +void ProjectSettings::_toggle_search_bar(bool p_pressed) { + + globals_editor->set_use_filter(p_pressed); + + if (p_pressed) { + + search_bar->show(); + add_prop_bar->hide(); + search_box->grab_focus(); + search_box->select_all(); + } else { + + search_bar->hide(); + add_prop_bar->show(); + } +} + +void ProjectSettings::_clear_search_box() { + + if (search_box->get_text()=="") + return; + + search_box->clear(); + globals_editor->update_tree(); +} void ProjectSettings::_bind_methods() { @@ -1212,6 +1240,9 @@ void ProjectSettings::_bind_methods() { ObjectTypeDB::bind_method(_MD("_update_autoload"),&ProjectSettings::_update_autoload); ObjectTypeDB::bind_method(_MD("_autoload_delete"),&ProjectSettings::_autoload_delete); + ObjectTypeDB::bind_method(_MD("_clear_search_box"),&ProjectSettings::_clear_search_box); + ObjectTypeDB::bind_method(_MD("_toggle_search_bar"),&ProjectSettings::_toggle_search_bar); + } ProjectSettings::ProjectSettings(EditorData *p_data) { @@ -1232,87 +1263,93 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { //tab_container->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 15 ); //tab_container->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); - Control *props_base = memnew( Control ); + VBoxContainer *props_base = memnew( VBoxContainer ); + props_base->set_alignment(BoxContainer::ALIGN_BEGIN); + props_base->set_v_size_flags(Control::SIZE_EXPAND_FILL); tab_container->add_child(props_base); props_base->set_name("General"); - globals_editor = memnew( PropertyEditor ); - props_base->add_child(globals_editor); - globals_editor->set_area_as_parent_rect(); - globals_editor->hide_top_label(); - globals_editor->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 55 ); - globals_editor->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); - globals_editor->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 ); - globals_editor->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 ); - globals_editor->set_capitalize_paths(false); - globals_editor->get_scene_tree()->connect("cell_selected",this,"_item_selected"); - globals_editor->connect("property_toggled",this,"_item_checked"); - globals_editor->connect("property_edited",this,"_settings_prop_edited"); + HBoxContainer *hbc = memnew( HBoxContainer ); + hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); + props_base->add_child(hbc); + + search_button = memnew( ToolButton ); + search_button->set_toggle_mode(true); + search_button->set_pressed(false); + search_button->set_text("Search"); + hbc->add_child(search_button); + search_button->connect("toggled",this,"_toggle_search_bar"); + + hbc->add_child( memnew( VSeparator ) ); + + add_prop_bar = memnew( HBoxContainer ); + add_prop_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL); + hbc->add_child(add_prop_bar); Label *l = memnew( Label ); - props_base->add_child(l); - l->set_pos(Point2(6,5)); + add_prop_bar->add_child(l); l->set_text("Category:"); - - l = memnew( Label ); - l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); - props_base->add_child(l); - l->set_begin(Point2(0.21,5)); - l->set_text("Property:"); - - l = memnew( Label ); - l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); - props_base->add_child(l); - l->set_begin(Point2(0.51,5)); - l->set_text("Type:"); - category = memnew( LineEdit ); - props_base->add_child(category); - category->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); - category->set_begin( Point2(5,25) ); - category->set_end( Point2(0.20,26) ); + category->set_h_size_flags(Control::SIZE_EXPAND_FILL); + add_prop_bar->add_child(category); category->connect("text_entered",this,"_item_adds"); + l = memnew( Label ); + add_prop_bar->add_child(l); + l->set_text("Property:"); + property = memnew( LineEdit ); - props_base->add_child(property); - property->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); - property->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); - property->set_begin( Point2(0.21,25) ); - property->set_end( Point2(0.50,26) ); + property->set_h_size_flags(Control::SIZE_EXPAND_FILL); + add_prop_bar->add_child(property); property->connect("text_entered",this,"_item_adds"); + l = memnew( Label ); + add_prop_bar->add_child(l); + l->set_text("Type:"); type = memnew( OptionButton ); - props_base->add_child(type); - type->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); - type->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); - type->set_begin( Point2(0.51,25) ); - type->set_end( Point2(0.70,26) ); + type->set_h_size_flags(Control::SIZE_EXPAND_FILL); + add_prop_bar->add_child(type); type->add_item("bool"); type->add_item("int"); type->add_item("float"); type->add_item("string"); Button *add = memnew( Button ); - props_base->add_child(add); - add->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); - add->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); - add->set_begin( Point2(0.71,25) ); - add->set_end( Point2(0.85,26) ); + add_prop_bar->add_child(add); add->set_text("Add"); add->connect("pressed",this,"_item_add"); Button *del = memnew( Button ); - props_base->add_child(del); - del->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); - del->set_anchor(MARGIN_RIGHT,ANCHOR_END); - del->set_begin( Point2(0.86,25) ); - del->set_end( Point2(5,26) ); + add_prop_bar->add_child(del); del->set_text("Del"); del->connect("pressed",this,"_item_del"); - /* + search_bar = memnew( HBoxContainer ); + search_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL); + hbc->add_child(search_bar); + search_bar->hide(); + + search_box = memnew( LineEdit ); + search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); + search_bar->add_child(search_box); + + clear_button = memnew( ToolButton ); + search_bar->add_child(clear_button); + clear_button->connect("pressed",this,"_clear_search_box"); + + globals_editor = memnew( PropertyEditor ); + props_base->add_child(globals_editor); + globals_editor->hide_top_label(); + globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); + globals_editor->register_text_enter(search_box); + globals_editor->set_capitalize_paths(false); + globals_editor->get_scene_tree()->connect("cell_selected",this,"_item_selected"); + globals_editor->connect("property_toggled",this,"_item_checked"); + globals_editor->connect("property_edited",this,"_settings_prop_edited"); + +/* Button *save = memnew( Button ); props_base->add_child(save); @@ -1325,17 +1362,16 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { save->set_text("Save"); save->connect("pressed",this,"_save"); */ + + hbc = memnew( HBoxContainer ); + props_base->add_child(hbc); + popup_platform = memnew( MenuButton ); popup_platform->set_text("Copy To Platform.."); popup_platform->set_disabled(true); - props_base->add_child(popup_platform); + hbc->add_child(popup_platform); - popup_platform->set_anchor(MARGIN_LEFT,ANCHOR_BEGIN); - popup_platform->set_anchor(MARGIN_RIGHT,ANCHOR_BEGIN); - popup_platform->set_anchor(MARGIN_TOP,ANCHOR_END); - popup_platform->set_anchor(MARGIN_BOTTOM,ANCHOR_END); - popup_platform->set_begin( Point2(10,28) ); - popup_platform->set_end( Point2(150,20) ); + hbc->add_spacer(); List ep; EditorImportExport::get_singleton()->get_export_platforms(&ep); diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h index 7c91254764..b122609e52 100644 --- a/tools/editor/project_settings.h +++ b/tools/editor/project_settings.h @@ -47,6 +47,12 @@ class ProjectSettings : public AcceptDialog { UndoRedo *undo_redo; PropertyEditor *globals_editor; + HBoxContainer *search_bar; + ToolButton *search_button; + LineEdit *search_box; + ToolButton *clear_button; + + HBoxContainer *add_prop_bar; ConfirmationDialog *message; LineEdit *category; LineEdit *property; @@ -130,6 +136,9 @@ class ProjectSettings : public AcceptDialog { void _translation_res_option_changed(); void _translation_res_option_delete(Object *p_item,int p_column, int p_button); + void _toggle_search_bar(bool p_pressed); + void _clear_search_box(); + ProjectSettings(); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index d6eae51fbd..31393ebcbc 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -2363,6 +2363,8 @@ void PropertyEditor::update_tree() { TreeItem * current_category=NULL; + String filter = search_box ? search_box->get_text() : ""; + for (List::Element *I=plist.front() ; I ; I=I->next()) { PropertyInfo& p = I->get(); @@ -2426,7 +2428,24 @@ void PropertyEditor::update_tree() { } else if ( ! (p.usage&PROPERTY_USAGE_EDITOR ) ) continue; + String name = (p.name.find("/")!=-1)?p.name.right( p.name.find_last("/")+1 ):p.name; + + if (capitalize_paths) + name = name.camelcase_to_underscore().capitalize(); + String path=p.name.left( p.name.find_last("/") ) ; + + if (use_filter && filter!="") { + + String cat = path; + + if (capitalize_paths) + cat = cat.capitalize(); + + if (cat.findn(filter)==-1 && name.findn(filter)==-1) + continue; + } + //printf("property %s\n",p.name.ascii().get_data()); TreeItem * parent = get_parent_node(path,item_path,current_category?current_category:root ); //if (parent->get_parent()==root) @@ -2448,8 +2467,6 @@ void PropertyEditor::update_tree() { TreeItem * item = tree->create_item( parent ); - String name = (p.name.find("/")!=-1)?p.name.right( p.name.find_last("/")+1 ):p.name; - if (level>0) { item->set_custom_bg_color(0,col); //item->set_custom_bg_color(1,col); @@ -2465,11 +2482,7 @@ void PropertyEditor::update_tree() { item->set_checked(0,p.usage&PROPERTY_USAGE_CHECKED); } - if (capitalize_paths) - item->set_text( 0, name.camelcase_to_underscore().capitalize() ); - else - item->set_text( 0, name ); - + item->set_text(0, name); item->set_tooltip(0, p.name); if (use_doc_hints) { @@ -3403,6 +3416,11 @@ void PropertyEditor::_draw_flags(Object *t,const Rect2& p_rect) { } +void PropertyEditor::_filter_changed(const String& p_text) { + + update_tree(); +} + void PropertyEditor::_bind_methods() { ObjectTypeDB::bind_method( "_item_edited",&PropertyEditor::_item_edited); @@ -3415,6 +3433,7 @@ void PropertyEditor::_bind_methods() { ObjectTypeDB::bind_method( "_changed_callback",&PropertyEditor::_changed_callbacks); ObjectTypeDB::bind_method( "_draw_flags",&PropertyEditor::_draw_flags); ObjectTypeDB::bind_method( "_set_range_def",&PropertyEditor::_set_range_def); + ObjectTypeDB::bind_method( "_filter_changed",&PropertyEditor::_filter_changed); ADD_SIGNAL( MethodInfo("property_toggled",PropertyInfo( Variant::STRING, "property"),PropertyInfo( Variant::BOOL, "value"))); ADD_SIGNAL( MethodInfo("resource_selected", PropertyInfo( Variant::OBJECT, "res"),PropertyInfo( Variant::STRING, "prop") ) ); @@ -3469,12 +3488,32 @@ void PropertyEditor::set_show_categories(bool p_show) { update_tree(); } +void PropertyEditor::set_use_filter(bool p_use) { + + if (p_use==use_filter) + return; + + use_filter=p_use; + update_tree(); +} + +void PropertyEditor::register_text_enter(Node* p_line_edit) { + + ERR_FAIL_NULL(p_line_edit); + search_box=p_line_edit->cast_to(); + + if (search_box) + search_box->connect("text_changed",this,"_filter_changed"); + +} + PropertyEditor::PropertyEditor() { _prop_edited="property_edited"; _prop_edited_name.push_back(String()); undo_redo=NULL; obj=NULL; + search_box=NULL; changing=false; update_tree_pending=false; @@ -3527,7 +3566,9 @@ PropertyEditor::PropertyEditor() { show_categories=false; refresh_countdown=0; use_doc_hints=false; - + + use_filter=false; + } diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index dcb7b66abd..5fb8386b1b 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -147,6 +147,7 @@ class PropertyEditor : public Control { Tree *tree; Label *top_label; //Object *object; + LineEdit *search_box; Object* obj; @@ -163,6 +164,8 @@ class PropertyEditor : public Control { float refresh_countdown; bool use_doc_hints; + bool use_filter; + HashMap pending; String selected_property; @@ -201,6 +204,8 @@ class PropertyEditor : public Control { void _refresh_item(TreeItem *p_item); void _set_range_def(Object *p_item, String prop, float p_frame); + void _filter_changed(const String& p_text); + UndoRedo *undo_redo; protected: @@ -230,7 +235,10 @@ public: void set_show_categories(bool p_show); void set_use_doc_hints(bool p_enable) { use_doc_hints=p_enable; } - + + void set_use_filter(bool p_use); + void register_text_enter(Node *p_line_edit); + PropertyEditor(); ~PropertyEditor(); diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 0cafe7459b..8b5bf8c1e1 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -1264,7 +1264,10 @@ void SceneTreeDock::import_subscene() { void SceneTreeDock::_import_subscene() { Node* parent = scene_tree->get_selected(); - ERR_FAIL_COND(!parent); + if (!parent) { + parent = editor_data->get_edited_scene_root(); + ERR_FAIL_COND(!parent); + } import_subscene_dialog->move(parent,edited_scene); editor_data->get_undo_redo().clear_history(); //no undo for now.. diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp index f73de26eec..6d8f849427 100644 --- a/tools/editor/settings_config_dialog.cpp +++ b/tools/editor/settings_config_dialog.cpp @@ -72,6 +72,10 @@ void EditorSettingsDialog::popup_edit_settings() { property_editor->edit(EditorSettings::get_singleton()); property_editor->update_tree(); + + search_box->select_all(); + search_box->grab_focus(); + popup_centered_ratio(0.7); } @@ -244,11 +248,21 @@ void EditorSettingsDialog::_update_plugins() { } +void EditorSettingsDialog::_clear_search_box() { + + if (search_box->get_text()=="") + return; + + search_box->clear(); + property_editor->update_tree(); +} + void EditorSettingsDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { rescan_plugins->set_icon(get_icon("Reload","EditorIcons")); + clear_button->set_icon(get_icon("Close","EditorIcons")); _update_plugins(); } } @@ -261,6 +275,7 @@ void EditorSettingsDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("_plugin_settings"),&EditorSettingsDialog::_plugin_settings); ObjectTypeDB::bind_method(_MD("_plugin_edited"),&EditorSettingsDialog::_plugin_edited); ObjectTypeDB::bind_method(_MD("_plugin_install"),&EditorSettingsDialog::_plugin_install); + ObjectTypeDB::bind_method(_MD("_clear_search_box"),&EditorSettingsDialog::_clear_search_box); } EditorSettingsDialog::EditorSettingsDialog() { @@ -271,16 +286,38 @@ EditorSettingsDialog::EditorSettingsDialog() { add_child(tabs); set_child_rect(tabs); + VBoxContainer *vbc = memnew( VBoxContainer ); + tabs->add_child(vbc); + vbc->set_name("General"); + + HBoxContainer *hbc = memnew( HBoxContainer ); + hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); + vbc->add_child(hbc); + + Label *l = memnew( Label ); + l->set_text("Search: "); + hbc->add_child(l); + + search_box = memnew( LineEdit ); + search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); + hbc->add_child(search_box); + + clear_button = memnew( ToolButton ); + hbc->add_child(clear_button); + clear_button->connect("pressed",this,"_clear_search_box"); + property_editor = memnew( PropertyEditor ); property_editor->hide_top_label(); - tabs->add_child(property_editor); - property_editor->set_name("General"); + property_editor->set_use_filter(true); + property_editor->register_text_enter(search_box); + property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); + vbc->add_child(property_editor); - VBoxContainer *vbc = memnew( VBoxContainer ); + vbc = memnew( VBoxContainer ); tabs->add_child(vbc); vbc->set_name("Plugins"); - HBoxContainer *hbc = memnew( HBoxContainer ); + hbc = memnew( HBoxContainer ); vbc->add_child(hbc); hbc->add_child( memnew( Label("Plugin List: "))); hbc->add_spacer(); diff --git a/tools/editor/settings_config_dialog.h b/tools/editor/settings_config_dialog.h index cca1ef33d5..50159cf488 100644 --- a/tools/editor/settings_config_dialog.h +++ b/tools/editor/settings_config_dialog.h @@ -51,6 +51,8 @@ class EditorSettingsDialog : public AcceptDialog { Button *rescan_plugins; Tree *plugins; + LineEdit *search_box; + ToolButton *clear_button; PropertyEditor *property_editor; Timer *timer; @@ -71,6 +73,8 @@ class EditorSettingsDialog : public AcceptDialog { void _rescan_plugins(); void _update_plugins(); + void _clear_search_box(); + protected: static void _bind_methods();