diff options
29 files changed, 341 insertions, 94 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 71bbc271e2..602d0e4d0e 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -21,6 +21,9 @@ <member name="ClassDB" type="ClassDB" setter="" getter=""> The [ClassDB] singleton. </member> + <member name="DisplayServer" type="DisplayServer" setter="" getter=""> + The [DisplayServer] singleton. + </member> <member name="Engine" type="Engine" setter="" getter=""> The [Engine] singleton. </member> diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml index 0c1317f19d..4190cbe6b9 100644 --- a/doc/classes/Area2D.xml +++ b/doc/classes/Area2D.xml @@ -29,14 +29,14 @@ </description> </method> <method name="get_overlapping_areas" qualifiers="const"> - <return type="Array"> + <return type="Area2D[]"> </return> <description> Returns a list of intersecting [Area2D]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. </description> </method> <method name="get_overlapping_bodies" qualifiers="const"> - <return type="Array"> + <return type="Node2D[]"> </return> <description> Returns a list of intersecting [PhysicsBody2D]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. diff --git a/doc/classes/Area3D.xml b/doc/classes/Area3D.xml index 1adfc878e2..a94cecd879 100644 --- a/doc/classes/Area3D.xml +++ b/doc/classes/Area3D.xml @@ -28,14 +28,14 @@ </description> </method> <method name="get_overlapping_areas" qualifiers="const"> - <return type="Array"> + <return type="Area3D[]"> </return> <description> Returns a list of intersecting [Area3D]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. </description> </method> <method name="get_overlapping_bodies" qualifiers="const"> - <return type="Array"> + <return type="Node3D[]"> </return> <description> Returns a list of intersecting [PhysicsBody3D]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead. diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml index 9e742ea581..b45716544a 100644 --- a/doc/classes/ArrayMesh.xml +++ b/doc/classes/ArrayMesh.xml @@ -22,6 +22,8 @@ m.mesh = arr_mesh [/codeblock] The [MeshInstance3D] is ready to be added to the [SceneTree] to be shown. + See also [ImmediateGeometry3D], [MeshDataTool] and [SurfaceTool] for procedural geometry generation. + [b]Note:[/b] Godot uses clockwise [url=https://learnopengl.com/Advanced-OpenGL/Face-culling]winding order[/url] for front faces of triangle primitive modes. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/content/procedural_geometry/arraymesh.html</link> @@ -56,7 +58,6 @@ Surfaces are created to be rendered using a [code]primitive[/code], which may be any of the types defined in [enum Mesh.PrimitiveType]. (As a note, when using indices, it is recommended to only use points, lines or triangles.) [method Mesh.get_surface_count] will become the [code]surf_idx[/code] for this new surface. The [code]arrays[/code] argument is an array of arrays. See [enum ArrayType] for the values used in this array. For example, [code]arrays[0][/code] is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array or be empty, except for [constant ARRAY_INDEX] if it is used. Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data, and the index array defines the order of the vertices. - Godot uses clockwise winding order for front faces of triangle primitive modes. </description> </method> <method name="clear_blend_shapes"> diff --git a/doc/classes/EditorSelection.xml b/doc/classes/EditorSelection.xml index 6cada84455..1ff9744b70 100644 --- a/doc/classes/EditorSelection.xml +++ b/doc/classes/EditorSelection.xml @@ -27,7 +27,7 @@ </description> </method> <method name="get_selected_nodes"> - <return type="Array"> + <return type="Node[]"> </return> <description> Gets the list of selected nodes. diff --git a/doc/classes/ImmediateGeometry3D.xml b/doc/classes/ImmediateGeometry3D.xml index 1c0831c922..d2d663847f 100644 --- a/doc/classes/ImmediateGeometry3D.xml +++ b/doc/classes/ImmediateGeometry3D.xml @@ -5,6 +5,9 @@ </brief_description> <description> Draws simple geometry from code. Uses a drawing mode similar to OpenGL 1.x. + See also [ArrayMesh], [MeshDataTool] and [SurfaceTool] for procedural geometry generation. + [b]Note:[/b] ImmediateGeometry3D is best suited to small amounts of mesh data that change every frame. It will be slow when handling large amounts of mesh data. If mesh data doesn't change often, use [ArrayMesh], [MeshDataTool] or [SurfaceTool] instead. + [b]Note:[/b] Godot uses clockwise [url=https://learnopengl.com/Advanced-OpenGL/Face-culling]winding order[/url] for front faces of triangle primitive modes. </description> <tutorials> </tutorials> diff --git a/doc/classes/MeshDataTool.xml b/doc/classes/MeshDataTool.xml index 81ff5969e3..dcc3bbf2a6 100644 --- a/doc/classes/MeshDataTool.xml +++ b/doc/classes/MeshDataTool.xml @@ -17,6 +17,8 @@ mesh.surface_remove(0) mdt.commit_to_surface(mesh) [/codeblock] + See also [ArrayMesh], [ImmediateGeometry3D] and [SurfaceTool] for procedural geometry generation. + [b]Note:[/b] Godot uses clockwise [url=https://learnopengl.com/Advanced-OpenGL/Face-culling]winding order[/url] for front faces of triangle primitive modes. </description> <tutorials> </tutorials> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 8c588f0373..1c745de7f0 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -221,7 +221,7 @@ </description> </method> <method name="get_children" qualifiers="const"> - <return type="Array"> + <return type="Node[]"> </return> <description> Returns an array of references to node's children. diff --git a/doc/classes/PhysicsBody2D.xml b/doc/classes/PhysicsBody2D.xml index 28d6ce7048..6afbd1ee8e 100644 --- a/doc/classes/PhysicsBody2D.xml +++ b/doc/classes/PhysicsBody2D.xml @@ -20,7 +20,7 @@ </description> </method> <method name="get_collision_exceptions"> - <return type="Array"> + <return type="PhysicsBody2D[]"> </return> <description> Returns an array of nodes that were added as collision exceptions for this body. diff --git a/doc/classes/PhysicsBody3D.xml b/doc/classes/PhysicsBody3D.xml index f0ba2a7f5f..2301a07a5c 100644 --- a/doc/classes/PhysicsBody3D.xml +++ b/doc/classes/PhysicsBody3D.xml @@ -20,7 +20,7 @@ </description> </method> <method name="get_collision_exceptions"> - <return type="Array"> + <return type="PhysicsBody3D[]"> </return> <description> Returns an array of nodes that were added as collision exceptions for this body. diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 4eb089e511..feded45c27 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -806,6 +806,18 @@ <member name="memory/limits/multithreaded_server/rid_pool_prealloc" type="int" setter="" getter="" default="60"> This is used by servers when used in multi-threading mode (servers and visual). RIDs are preallocated to avoid stalling the server requesting them on threads. If servers get stalled too often when loading resources in a thread, increase this number. </member> + <member name="mono/debugger_agent/port" type="int" setter="" getter="" default="23685"> + </member> + <member name="mono/debugger_agent/wait_for_debugger" type="bool" setter="" getter="" default="false"> + </member> + <member name="mono/debugger_agent/wait_timeout" type="int" setter="" getter="" default="3000"> + </member> + <member name="mono/profiler/args" type="String" setter="" getter="" default=""log:calls,alloc,sample,output=output.mlpd""> + </member> + <member name="mono/profiler/enabled" type="bool" setter="" getter="" default="false"> + </member> + <member name="mono/unhandled_exception_policy" type="int" setter="" getter="" default="0"> + </member> <member name="network/limits/debugger/max_chars_per_second" type="int" setter="" getter="" default="32768"> Maximum amount of characters allowed to send as output from the debugger. Over this value, content is dropped. This helps not to stall the debugger connection. </member> diff --git a/doc/classes/RDPipelineColorBlendState.xml b/doc/classes/RDPipelineColorBlendState.xml index 7cb31f6986..adc6f1f6a3 100644 --- a/doc/classes/RDPipelineColorBlendState.xml +++ b/doc/classes/RDPipelineColorBlendState.xml @@ -7,40 +7,10 @@ <tutorials> </tutorials> <methods> - <method name="add_attachment"> - <return type="void"> - </return> - <argument index="0" name="atachment" type="RDPipelineColorBlendStateAttachment"> - </argument> - <description> - </description> - </method> - <method name="add_blend_mix_attachment"> - <return type="void"> - </return> - <description> - </description> - </method> - <method name="add_no_blend_attachment"> - <return type="void"> - </return> - <description> - </description> - </method> - <method name="clear_attachments"> - <return type="void"> - </return> - <description> - </description> - </method> - <method name="get_attachments" qualifiers="const"> - <return type="Array"> - </return> - <description> - </description> - </method> </methods> <members> + <member name="attachments" type="RDPipelineColorBlendStateAttachment[]" setter="set_attachments" getter="get_attachments" default="[ ]"> + </member> <member name="blend_constant" type="Color" setter="set_blend_constant" getter="get_blend_constant" default="Color( 0, 0, 0, 1 )"> </member> <member name="enable_logic_op" type="bool" setter="set_enable_logic_op" getter="get_enable_logic_op" default="false"> diff --git a/doc/classes/RDPipelineColorBlendStateAttachment.xml b/doc/classes/RDPipelineColorBlendStateAttachment.xml index a4caa622aa..7f118b5f0b 100644 --- a/doc/classes/RDPipelineColorBlendStateAttachment.xml +++ b/doc/classes/RDPipelineColorBlendStateAttachment.xml @@ -7,6 +7,12 @@ <tutorials> </tutorials> <methods> + <method name="set_as_mix"> + <return type="void"> + </return> + <description> + </description> + </method> </methods> <members> <member name="alpha_blend_op" type="int" setter="set_alpha_blend_op" getter="get_alpha_blend_op" enum="RenderingDevice.BlendOperation" default="0"> diff --git a/doc/classes/RDPipelineMultisampleState.xml b/doc/classes/RDPipelineMultisampleState.xml index b936ded4fe..4658c7d9ba 100644 --- a/doc/classes/RDPipelineMultisampleState.xml +++ b/doc/classes/RDPipelineMultisampleState.xml @@ -7,26 +7,6 @@ <tutorials> </tutorials> <methods> - <method name="add_sample_mask"> - <return type="void"> - </return> - <argument index="0" name="mask" type="int"> - </argument> - <description> - </description> - </method> - <method name="clear_sample_masks"> - <return type="void"> - </return> - <description> - </description> - </method> - <method name="get_sample_masks" qualifiers="const"> - <return type="PackedInt64Array"> - </return> - <description> - </description> - </method> </methods> <members> <member name="enable_alpha_to_coverage" type="bool" setter="set_enable_alpha_to_coverage" getter="get_enable_alpha_to_coverage" default="false"> @@ -39,6 +19,8 @@ </member> <member name="sample_count" type="int" setter="set_sample_count" getter="get_sample_count" enum="RenderingDevice.TextureSamples" default="0"> </member> + <member name="sample_masks" type="int[]" setter="set_sample_masks" getter="get_sample_masks" default="[ ]"> + </member> </members> <constants> </constants> diff --git a/doc/classes/RDVertexDescription.xml b/doc/classes/RDVertexAttribute.xml index 90e37ee023..56fe40b51d 100644 --- a/doc/classes/RDVertexDescription.xml +++ b/doc/classes/RDVertexAttribute.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RDVertexDescription" inherits="Reference" version="4.0"> +<class name="RDVertexAttribute" inherits="Reference" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RenderingDevice.xml b/doc/classes/RenderingDevice.xml index 6d68eafc70..8a44d213e8 100644 --- a/doc/classes/RenderingDevice.xml +++ b/doc/classes/RenderingDevice.xml @@ -296,7 +296,7 @@ <method name="framebuffer_format_create"> <return type="int"> </return> - <argument index="0" name="attachments" type="Array"> + <argument index="0" name="attachments" type="RDAttachmentFormat[]"> </argument> <description> </description> @@ -386,9 +386,9 @@ </argument> <argument index="1" name="format" type="int" enum="RenderingDevice.IndexBufferFormat"> </argument> - <argument index="2" name="data" type="PackedByteArray"> + <argument index="2" name="data" type="PackedByteArray" default="PackedByteArray( )"> </argument> - <argument index="3" name="arg3" type="bool" default="PackedByteArray( )"> + <argument index="3" name="arg3" type="bool" default="false"> </argument> <description> </description> @@ -576,7 +576,7 @@ </argument> <argument index="1" name="view" type="RDTextureView"> </argument> - <argument index="2" name="data" type="Array" default="[ ]"> + <argument index="2" name="data" type="PackedByteArray[]" default="[ ]"> </argument> <description> </description> @@ -712,7 +712,7 @@ <method name="vertex_format_create"> <return type="int"> </return> - <argument index="0" name="vertex_descriptions" type="Array"> + <argument index="0" name="vertex_descriptions" type="RDVertexAttribute[]"> </argument> <description> </description> diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml index e746d7fc96..8379fc5b58 100644 --- a/doc/classes/RigidBody2D.xml +++ b/doc/classes/RigidBody2D.xml @@ -81,7 +81,7 @@ </description> </method> <method name="get_colliding_bodies" qualifiers="const"> - <return type="Array"> + <return type="Node2D[]"> </return> <description> Returns a list of the bodies colliding with this one. Use [member contacts_reported] to set the maximum number reported. You must also set [member contact_monitor] to [code]true[/code]. diff --git a/doc/classes/Skeleton3D.xml b/doc/classes/Skeleton3D.xml index 08404fb467..4460b519fc 100644 --- a/doc/classes/Skeleton3D.xml +++ b/doc/classes/Skeleton3D.xml @@ -157,7 +157,7 @@ <method name="physical_bones_start_simulation"> <return type="void"> </return> - <argument index="0" name="bones" type="Array" default="[ ]"> + <argument index="0" name="bones" type="StringName[]" default="[ ]"> </argument> <description> </description> diff --git a/doc/classes/SurfaceTool.xml b/doc/classes/SurfaceTool.xml index 4304a8df5e..eeb6b6cd9d 100644 --- a/doc/classes/SurfaceTool.xml +++ b/doc/classes/SurfaceTool.xml @@ -15,6 +15,8 @@ The above [SurfaceTool] now contains one vertex of a triangle which has a UV coordinate and a specified [Color]. If another vertex were added without calling [method add_uv] or [method add_color], then the last values would be used. Vertex attributes must be passed [b]before[/b] calling [method add_vertex]. Failure to do so will result in an error when committing the vertex information to a mesh. Additionally, the attributes used before the first vertex is added determine the format of the mesh. For example, if you only add UVs to the first vertex, you cannot add color to any of the subsequent vertices. + See also [ArrayMesh], [ImmediateGeometry3D] and [MeshDataTool] for procedural geometry generation. + [b]Note:[/b] Godot uses clockwise [url=https://learnopengl.com/Advanced-OpenGL/Face-culling]winding order[/url] for front faces of triangle primitive modes. </description> <tutorials> </tutorials> diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index 5b7694b775..bfe6983f06 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -74,14 +74,14 @@ </description> </method> <method name="get_used_cells" qualifiers="const"> - <return type="Array"> + <return type="Vector2i[]"> </return> <description> Returns a [Vector2] array with the positions of all cells containing a tile from the tileset (i.e. a tile index different from [code]-1[/code]). </description> </method> <method name="get_used_cells_by_id" qualifiers="const"> - <return type="Array"> + <return type="Vector2i[]"> </return> <argument index="0" name="id" type="int"> </argument> diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index c6c6cae6c0..5ceab52523 100755 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -973,11 +973,14 @@ def format_table(f, data, remove_empty_columns=False): # type: (TextIO, Iterabl f.write("\n") -def make_type(t, state): # type: (str, State) -> str - if t in state.classes: - return ":ref:`{0}<class_{0}>`".format(t) - print_error("Unresolved type '{}', file: {}".format(t, state.current_class), state) - return t +def make_type(klass, state): # type: (str, State) -> str + link_type = klass + if link_type.endswith("[]"): # Typed array, strip [] to link to contained type. + link_type = link_type[:-2] + if link_type in state.classes: + return ":ref:`{}<class_{}>`".format(klass, link_type) + print_error("Unresolved type '{}', file: {}".format(klass, state.current_class), state) + return klass def make_enum(t, state): # type: (str, State) -> str diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index f10e439f10..b7c8769f64 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -754,14 +754,17 @@ public: for (Map<int, List<float>>::Element *E = key_ofs_map.front(); E; E = E->next()) { + int key = 0; for (List<float>::Element *F = E->value().front(); F; F = F->next()) { float key_ofs = F->get(); - if (from != key_ofs) + if (from != key_ofs) { + key++; continue; + } int track = E->key(); - key_ofs_map[track][key_ofs] = to; + key_ofs_map[track][key] = to; if (setting) return; diff --git a/editor/icons/Decal.svg b/editor/icons/Decal.svg new file mode 100644 index 0000000000..23502c9d72 --- /dev/null +++ b/editor/icons/Decal.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 2c-3.3137085 0-6 2.6862915-6 6 0 2.220299 1.2092804 4.153789 3.0019531 5.191406-.05462-.325384-.089844-.657141-.089844-.998047 0-3.3137076 2.6862921-5.9999996 5.9999999-5.9999996 1.093408 0 2.115228.2976087 2.998047.8085937-.476307-2.8374399-2.937354-5.0019531-5.910156-5.0019531z" fill="#fc9c9c"/><path d="m5.001954 13.191406 8.908202-6.1894529c-.882819-.510985-1.904638-.808594-2.998046-.808594-3.3137079 0-6 2.686292-6 5.9999999 0 .340906.03522.672663.08984.998047z" fill="#ff5d5d"/><path d="m13.910156 7.0019531-8.908202 6.1894529c.882819.510985 1.904638.808594 2.998046.808594 3.313708 0 6-2.686292 6-5.9999999 0-.340906-.03522-.672663-.08984-.998047z" fill="#fc9c9c" fill-opacity=".392157"/></svg>
\ No newline at end of file diff --git a/misc/hooks/pre-commit-black b/misc/hooks/pre-commit-black index 2dcc2e8cf1..76d97294da 100755 --- a/misc/hooks/pre-commit-black +++ b/misc/hooks/pre-commit-black @@ -6,7 +6,7 @@ ################################################################## # SETTINGS # Set path to black binary. -BLACK=`which black` +BLACK=`which black 2>/dev/null` BLACK_OPTIONS="-l 120" # Remove any older patches from previous commits. Set to true or false. @@ -18,13 +18,22 @@ FILE_EXTS="py" # Use pygmentize instead of cat to parse diff with highlighting. # Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac) -PYGMENTIZE=`which pygmentize` +PYGMENTIZE=`which pygmentize 2>/dev/null` if [ ! -z "$PYGMENTIZE" ]; then READER="pygmentize -l diff" else READER=cat fi +# Path to zenity +ZENITY=`which zenity 2>/dev/null` + +# Path to xmessage +XMSG=`which xmessage 2>/dev/null` + +# Path to powershell (Windows only) +PWSH=`which powershell 2>/dev/null` + ################################################################## # There should be no need to change anything below this line. @@ -53,6 +62,19 @@ else fi if [ ! -x "$BLACK" ] ; then + if [ ! -t 1 ] ; then + if [ -x "$ZENITY" ] ; then + $ZENITY --error --title="Error" --text="Error: black executable not found." + exit 1 + elif [ -x "$XMSG" ] ; then + $XMSG -center -title "Error" "Error: black executable not found." + exit 1 + elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then + winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")" + $PWSH -noprofile -executionpolicy bypass -file "$winmessage" -center -title "Error" --text "Error: black executable not found." + exit 1 + fi + fi printf "Error: black executable not found.\n" printf "Set the correct path in $(canonicalize_filename "$0").\n" exit 1 @@ -99,14 +121,62 @@ fi # a patch has been created, notify the user and exit printf "\nThe following differences were found between the code to commit " printf "and the black formatter rules:\n\n" -$READER "$patch" -printf "\n" -# Allows us to read user input below, assigns stdin to keyboard -exec < /dev/tty +if [ -t 1 ] ; then + $READER "$patch" + printf "\n" + # Allows us to read user input below, assigns stdin to keyboard + exec < /dev/tty + terminal="1" +else + cat "$patch" + printf "\n" + # Allows non zero zenity/powershell output + set +e + terminal="0" +fi while true; do - read -p "Do you want to apply that patch (Y - Apply, N - Do not apply, S - Apply and stage files)? [Y/N/S] " yn + if [ $terminal = "0" ] ; then + if [ -x "$ZENITY" ] ; then + ans=$($ZENITY --text-info --filename="$patch" --width=800 --height=600 --title="Do you want to apply that patch?" --ok-label="Apply" --cancel-label="Do not apply" --extra-button="Apply and stage") + if [ "$?" = "0" ] ; then + yn="Y" + else + if [ "$ans" = "Apply and stage" ] ; then + yn="S" + else + yn="N" + fi + fi + elif [ -x "$XMSG" ] ; then + $XMSG -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?" + ans=$? + if [ "$ans" = "100" ] ; then + yn="Y" + elif [ "$ans" = "200" ] ; then + yn="S" + else + yn="N" + fi + elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then + winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")" + $PWSH -noprofile -executionpolicy bypass -file "$winmessage" -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?" + ans=$? + if [ "$ans" = "100" ] ; then + yn="Y" + elif [ "$ans" = "200" ] ; then + yn="S" + else + yn="N" + fi + else + printf "Error: zenity, xmessage, or powershell executable not found.\n" + exit 1 + fi + else + read -p "Do you want to apply that patch (Y - Apply, N - Do not apply, S - Apply and stage files)? [Y/N/S] " yn + fi case $yn in [Yy] ) git apply $patch; printf "The patch was applied. You can now stage the changes and commit again.\n\n"; diff --git a/misc/hooks/pre-commit-clang-format b/misc/hooks/pre-commit-clang-format index c5cf4ecbb1..4e1fbdeb20 100755 --- a/misc/hooks/pre-commit-clang-format +++ b/misc/hooks/pre-commit-clang-format @@ -16,7 +16,7 @@ ################################################################## # SETTINGS # Set path to clang-format binary. -CLANG_FORMAT=`which clang-format` +CLANG_FORMAT=`which clang-format 2>/dev/null` # Remove any older patches from previous commits. Set to true or false. DELETE_OLD_PATCHES=false @@ -31,13 +31,22 @@ FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc .java .glsl" # Use pygmentize instead of cat to parse diff with highlighting. # Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac) -PYGMENTIZE=`which pygmentize` +PYGMENTIZE=`which pygmentize 2>/dev/null` if [ ! -z "$PYGMENTIZE" ]; then READER="pygmentize -l diff" else READER=cat fi +# Path to zenity +ZENITY=`which zenity 2>/dev/null` + +# Path to xmessage +XMSG=`which xmessage 2>/dev/null` + +# Path to powershell (Windows only) +PWSH=`which powershell 2>/dev/null` + ################################################################## # There should be no need to change anything below this line. @@ -66,6 +75,19 @@ else fi if [ ! -x "$CLANG_FORMAT" ] ; then + if [ ! -t 1 ] ; then + if [ -x "$ZENITY" ] ; then + $ZENITY --error --title="Error" --text="Error: clang-format executable not found." + exit 1 + elif [ -x "$XMSG" ] ; then + $XMSG -center -title "Error" "Error: clang-format executable not found." + exit 1 + elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then + winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")" + $PWSH -noprofile -executionpolicy bypass -file "$winmessage" -center -title "Error" --text "Error: clang-format executable not found." + exit 1 + fi + fi printf "Error: clang-format executable not found.\n" printf "Set the correct path in $(canonicalize_filename "$0").\n" exit 1 @@ -117,14 +139,62 @@ fi # a patch has been created, notify the user and exit printf "\nThe following differences were found between the code to commit " printf "and the clang-format rules:\n\n" -$READER "$patch" -printf "\n" -# Allows us to read user input below, assigns stdin to keyboard -exec < /dev/tty +if [ -t 1 ] ; then + $READER "$patch" + printf "\n" + # Allows us to read user input below, assigns stdin to keyboard + exec < /dev/tty + terminal="1" +else + cat "$patch" + printf "\n" + # Allows non zero zenity/powershell output + set +e + terminal="0" +fi while true; do - read -p "Do you want to apply that patch (Y - Apply, N - Do not apply, S - Apply and stage files)? [Y/N/S] " yn + if [ $terminal = "0" ] ; then + if [ -x "$ZENITY" ] ; then + ans=$($ZENITY --text-info --filename="$patch" --width=800 --height=600 --title="Do you want to apply that patch?" --ok-label="Apply" --cancel-label="Do not apply" --extra-button="Apply and stage") + if [ "$?" = "0" ] ; then + yn="Y" + else + if [ "$ans" = "Apply and stage" ] ; then + yn="S" + else + yn="N" + fi + fi + elif [ -x "$XMSG" ] ; then + $XMSG -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?" + ans=$? + if [ "$ans" = "100" ] ; then + yn="Y" + elif [ "$ans" = "200" ] ; then + yn="S" + else + yn="N" + fi + elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then + winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")" + $PWSH -noprofile -executionpolicy bypass -file "$winmessage" -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?" + ans=$? + if [ "$ans" = "100" ] ; then + yn="Y" + elif [ "$ans" = "200" ] ; then + yn="S" + else + yn="N" + fi + else + printf "Error: zenity, xmessage, or powershell executable not found.\n" + exit 1 + fi + else + read -p "Do you want to apply that patch (Y - Apply, N - Do not apply, S - Apply and stage files)? [Y/N/S] " yn + fi case $yn in [Yy] ) git apply $patch; printf "The patch was applied. You can now stage the changes and commit again.\n\n"; diff --git a/misc/hooks/winmessage.ps1 b/misc/hooks/winmessage.ps1 new file mode 100755 index 0000000000..3672579544 --- /dev/null +++ b/misc/hooks/winmessage.ps1 @@ -0,0 +1,103 @@ +Param ( + [string]$file = "", + [string]$text = "", + [string]$buttons = "OK:0", + [string]$default = "", + [switch]$nearmouse = $false, + [switch]$center = $false, + [string]$geometry = "", + [int32]$timeout = 0, + [string]$title = "Message" +) +Add-Type -assembly System.Windows.Forms + +$global:Result = 0 + +$main_form = New-Object System.Windows.Forms.Form +$main_form.Text = $title + +$geometry_data = $geometry.Split("+") +if ($geometry_data.Length -ge 1) { + $size_data = $geometry_data[0].Split("x") + if ($size_data.Length -eq 2) { + $main_form.Width = $size_data[0] + $main_form.Height = $size_data[1] + } +} +if ($geometry_data.Length -eq 3) { + $main_form.StartPosition = [System.Windows.Forms.FormStartPosition]::Manual + $main_form.Location = New-Object System.Drawing.Point($geometry_data[1], $geometry_data[2]) +} +if ($nearmouse) { + $main_form.StartPosition = [System.Windows.Forms.FormStartPosition]::Manual + $main_form.Location = System.Windows.Forms.Cursor.Position +} +if ($center) { + $main_form.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen +} + +$main_form.SuspendLayout() + +$button_panel = New-Object System.Windows.Forms.FlowLayoutPanel +$button_panel.SuspendLayout() +$button_panel.FlowDirection = [System.Windows.Forms.FlowDirection]::RightToLeft +$button_panel.Dock = [System.Windows.Forms.DockStyle]::Bottom +$button_panel.Autosize = $true + +if ($file -ne "") { + $text = [IO.File]::ReadAllText($file).replace("`n", "`r`n") +} + +if ($text -ne "") { + $text_box = New-Object System.Windows.Forms.TextBox + $text_box.Multiline = $true + $text_box.ReadOnly = $true + $text_box.Autosize = $true + $text_box.Text = $text + $text_box.Select(0,0) + $text_box.Dock = [System.Windows.Forms.DockStyle]::Fill + $main_form.Controls.Add($text_box) +} + +$buttons_array = $buttons.Split(",") +foreach ($button in $buttons_array) { + $button_data = $button.Split(":") + $button_ctl = New-Object System.Windows.Forms.Button + if ($button_data.Length -eq 2) { + $button_ctl.Tag = $button_data[1] + } else { + $button_ctl.Tag = 100 + $buttons_array.IndexOf($button) + } + if ($default -eq $button_data[0]) { + $main_form.AcceptButton = $button_ctl + } + $button_ctl.Autosize = $true + $button_ctl.Text = $button_data[0] + $button_ctl.Add_Click( + { + Param($sender) + $global:Result = $sender.Tag + $main_form.Close() + } + ) + $button_panel.Controls.Add($button_ctl) +} +$main_form.Controls.Add($button_panel) + +$button_panel.ResumeLayout($false) +$main_form.ResumeLayout($false) + +if ($timeout -gt 0) { + $timer = New-Object System.Windows.Forms.Timer + $timer.Add_Tick( + { + $global:Result = 0 + $main_form.Close() + } + ) + $timer.Interval = $timeout + $timer.Start() +} +$dlg_res = $main_form.ShowDialog() + +[Environment]::Exit($global:Result) diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 221cce205a..7ad0682637 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -2150,7 +2150,7 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p } const GDScriptParser::ClassNode *clss = p_context._class; - bool _static = !p_context.function || p_context.function->_static; + bool _static = p_context.function && p_context.function->_static; while (clss) { GDScriptCompletionContext c = p_context; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index a83416375c..c74d8cfbb0 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -746,6 +746,13 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s if (tokenizer->get_token() == GDScriptTokenizer::TK_CURSOR) { _make_completable_call(0); completion_node = op; + + if (op->arguments[0]->type == GDScriptParser::Node::Type::TYPE_BUILT_IN_FUNCTION) { + BuiltInFunctionNode *bn = static_cast<BuiltInFunctionNode *>(op->arguments[0]); + if (bn->function == GDScriptFunctions::Function::RESOURCE_LOAD) { + completion_type = COMPLETION_RESOURCE_PATH; + } + } } if (!replaced) { if (!_parse_arguments(op, op->arguments, p_static, true, p_parsing_constant)) @@ -2794,6 +2801,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { return; } + _mark_line_as_safe(line); NewLineNode *nl2 = alloc_node<NewLineNode>(); nl2->line = line; p_block->statements.push_back(nl2); @@ -3307,6 +3315,8 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { return; } + int assert_line = tokenizer->get_token_line(); + tokenizer->advance(); Vector<Node *> args; @@ -3320,8 +3330,14 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { return; } +#ifdef DEBUG_ENABLED + // Mark as safe, let type check mark as unsafe if needed + _mark_line_as_safe(assert_line); + _reduce_node_type(args[0]); +#endif AssertNode *an = alloc_node<AssertNode>(); an->condition = _reduce_expression(args[0], p_static); + an->line = assert_line; if (args.size() == 2) { an->message = _reduce_expression(args[1], p_static); diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 1eb1ee0d29..71febd3433 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1699,7 +1699,7 @@ public: valid = false; } else { Error errn; - DirAccessRef da = DirAccess::open(sdk_path.plus_file("tools"), &errn); + DirAccessRef da = DirAccess::open(sdk_path.plus_file("platform-tools"), &errn); if (errn != OK) { err += TTR("Invalid Android SDK path for custom build in Editor Settings.") + "\n"; valid = false; |