diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 179f780a..1ca97690 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -16,7 +16,7 @@ jobs: name: Linting and Formatting runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/setup-python@v5 with: python-version: '3.11' @@ -38,9 +38,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Godot - uses: chickensoft-games/setup-godot@v2.2.0 + uses: chickensoft-games/setup-godot@v2.3.0 with: version: ${{ matrix.godot-version }} use-dotnet: false diff --git a/.github/workflows/godot-asset-library.yaml b/.github/workflows/godot-asset-library.yaml index e57363a1..e5941831 100644 --- a/.github/workflows/godot-asset-library.yaml +++ b/.github/workflows/godot-asset-library.yaml @@ -11,7 +11,7 @@ jobs: name: Push new release steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Push to Godot Asset Library uses: deep-entertainment/godot-asset-lib-action@v0.6.0 with: diff --git a/addons/block_code/blocks/log/to_string.tres b/addons/block_code/blocks/log/to_string.tres new file mode 100644 index 00000000..73931305 --- /dev/null +++ b/addons/block_code/blocks/log/to_string.tres @@ -0,0 +1,25 @@ +[gd_resource type="Resource" load_steps=4 format=3 uid="uid://bfugvntm6mdjm"] + +[ext_resource type="Script" uid="uid://bkapmk0btnk7y" path="res://addons/block_code/code_generation/option_data.gd" id="1_i1nej"] +[ext_resource type="Script" uid="uid://bau6qtv87fcdo" path="res://addons/block_code/code_generation/block_definition.gd" id="2_xs7a8"] + +[sub_resource type="Resource" id="Resource_ie4sg"] +script = ExtResource("1_i1nej") +selected = 0 +items = ["0", "true", "Vector2(0, 0)", "Vector3(0, 0, 0)", "Color(0, 0, 0, 1)", "Object(Object, \"script\": null)"] + +[resource] +script = ExtResource("2_xs7a8") +name = &"to_string" +target_node_class = "" +description = "Converts [i]parameter[/i] to a [b]String[/b]" +category = "Log" +type = 3 +variant_type = 4 +display_template = "{parameter: NIL} to string" +code_template = "str({{parameter}})" +defaults = { +"parameter": SubResource("Resource_ie4sg") +} +signal_name = "" +is_advanced = true diff --git a/addons/block_code/code_generation/block_definition.gd b/addons/block_code/code_generation/block_definition.gd index 6ee55468..75273a73 100644 --- a/addons/block_code/code_generation/block_definition.gd +++ b/addons/block_code/code_generation/block_definition.gd @@ -289,6 +289,6 @@ static func new_variable_getter(variable: VariableDefinition) -> Resource: Types.BlockType.VALUE, variable.var_type, "%s" % variable.var_name, - "%s", + "%s" % variable.var_name, ) return block_definition diff --git a/addons/block_code/locale/fr.po b/addons/block_code/locale/fr.po index 715af560..dabab71e 100644 --- a/addons/block_code/locale/fr.po +++ b/addons/block_code/locale/fr.po @@ -58,8 +58,6 @@ # res://addons/block_code/blocks/math/sin.tres # res://addons/block_code/blocks/math/subtract.tres # res://addons/block_code/blocks/math/tan.tres -# res://addons/block_code/blocks/math/vector2_x.tres -# res://addons/block_code/blocks/math/vector2_y.tres # res://addons/block_code/blocks/math/vector_from_angle.tres # res://addons/block_code/blocks/math/vector_multiply.tres # res://addons/block_code/blocks/physics/characterbody2d_move_and_slide.tres @@ -85,14 +83,6 @@ # res://addons/block_code/drag_manager/drag.gd # res://addons/block_code/drag_manager/drag_manager.gd # res://addons/block_code/drag_manager/drag_manager.tscn -# res://addons/block_code/examples/pong_game/ball.tscn -# res://addons/block_code/examples/pong_game/goal_area.tscn -# res://addons/block_code/examples/pong_game/player_score.tscn -# res://addons/block_code/examples/pong_game/pong_game.tscn -# res://addons/block_code/examples/pong_game/space.tscn -# res://addons/block_code/examples/spawner/ball.tscn -# res://addons/block_code/examples/spawner/spawner.tscn -# res://addons/block_code/examples/spawner/volatile_ball.tscn # res://addons/block_code/inspector_plugin/block_script_inspector.gd # res://addons/block_code/serialization/block_script_serialization.gd # res://addons/block_code/serialization/block_serialization.gd @@ -155,32 +145,39 @@ # res://addons/block_code/ui/title_bar/title_bar.tscn # res://addons/block_code/ui/tooltip/tooltip.gd # res://addons/block_code/ui/tooltip/tooltip.tscn -# +# res://addons/block_code/blocks/input/mouse_position.tres +# res://addons/block_code/blocks/math/vector2_xy.tres +# res://addons/block_code/blocks/math/vector3_xyz.tres +# res://addons/block_code/blocks/math/vector3_multiply.tres +# res://addons/block_code/blocks/communication/switch_scene.tres +# res://addons/block_code/blocks/variables/vector3.tres +# res://addons/block_code/blocks/lifecycle/physics_process.tres +# # FIRST AUTHOR , YEAR. -# +# # Translators: # Will Thompson , 2024 -# +# Manuel Quiñones, 2025 +# #, fuzzy msgid "" msgstr "" "Project-Id-Version: Block Coding Plugin\n" -"Last-Translator: Will Thompson , 2024\n" +"Last-Translator: Manuel Quiñones, 2025\n" "Language-Team: French (https://app.transifex.com/endless-os/teams/9016/fr/)\n" -"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8-bit\n" -"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % " -"1000000 == 0 ? 1 : 2;\n" +"Language: fr\n" +"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" #: addons/block_code/block_code_plugin.gd msgid "Regenerate %s POT file" -msgstr "" +msgstr "Regénérer le fichier POT %s" #: addons/block_code/block_code_plugin.gd msgid "Update %s translated files" -msgstr "" +msgstr "Mettre à jour les fichiers traduits %s" #: addons/block_code/blocks/communication/add_node_to_group.tres #: addons/block_code/blocks/communication/add_to_group.tres @@ -189,23 +186,23 @@ msgstr "" #: addons/block_code/blocks/communication/remove_from_group.tres #: addons/block_code/blocks/communication/remove_node_from_group.tres msgid "Communication | Groups" -msgstr "" +msgstr "Communication | Groupes" #: addons/block_code/blocks/communication/add_node_to_group.tres msgid "Add the node into the group" -msgstr "" +msgstr "Ajouter le nœud au groupe" #: addons/block_code/blocks/communication/add_node_to_group.tres msgid "add {node: OBJECT} to group {group: STRING}" -msgstr "" +msgstr "ajouter {node: OBJECT} au groupe {group: STRING}" #: addons/block_code/blocks/communication/add_to_group.tres msgid "Add this node into the group" -msgstr "" +msgstr "Ajouter ce nœud au groupe" #: addons/block_code/blocks/communication/add_to_group.tres msgid "add to group {group: STRING}" -msgstr "" +msgstr "ajouter au groupe {group: STRING}" #: addons/block_code/blocks/communication/area2d_on_entered.tres #: addons/block_code/blocks/communication/area2d_on_exited.tres @@ -216,195 +213,201 @@ msgstr "" #: addons/block_code/blocks/communication/rigidbody2d_on_exited.tres #: addons/block_code/blocks/communication/switch_scene.tres msgid "Communication | Methods" -msgstr "" +msgstr "Communication | Méthodes" #: addons/block_code/blocks/communication/area2d_on_entered.tres #: addons/block_code/blocks/communication/rigidbody2d_on_entered.tres msgid "when this node collides with [something: OBJECT]" -msgstr "" +msgstr "quand ce nœud entre en collision avec [quelque chose: OBJECT]" #: addons/block_code/blocks/communication/area2d_on_exited.tres #: addons/block_code/blocks/communication/rigidbody2d_on_exited.tres msgid "when this node stops colliding with [something: OBJECT]" -msgstr "" +msgstr "quand ce nœud arrête d'être en collision avec [quelque chose: OBJECT]" #: addons/block_code/blocks/communication/call_method_group.tres msgid "Calls the method/function on each member of the given group" -msgstr "" +msgstr "Appelle la méthode/fonction sur chaque membre du groupe donné" #: addons/block_code/blocks/communication/call_method_group.tres msgid "call method {method_name: STRING} in group {group: STRING}" msgstr "" +"appeler la méthode {method_name: STRING} dans le groupe {group: STRING}" #: addons/block_code/blocks/communication/call_method_node.tres msgid "Calls the method/function of the given node" -msgstr "" +msgstr "Appelle la méthode/fonction du nœud donné" #: addons/block_code/blocks/communication/call_method_node.tres msgid "call method {method_name: STRING} on node {node: OBJECT}" -msgstr "" +msgstr "appeler la méthode {method_name: STRING} sur le nœud {node: OBJECT}" #: addons/block_code/blocks/communication/define_method.tres msgid "Define a method/function with following statements" -msgstr "" +msgstr "Définir une méthode/fonction avec les instructions suivantes" #: addons/block_code/blocks/communication/define_method.tres msgid "define method {method_name: STRING_NAME}" -msgstr "" +msgstr "définir la méthode {method_name: STRING_NAME}" #: addons/block_code/blocks/communication/get_node.tres msgid "Communication | Nodes" -msgstr "" +msgstr "Communication | Nœuds" #: addons/block_code/blocks/communication/get_node.tres msgid "Get the node at the given path" -msgstr "" +msgstr "Obtenir le nœud au chemin donné" #: addons/block_code/blocks/communication/get_node.tres msgid "{path: NIL}" -msgstr "" +msgstr "{chemin: NIL}" #: addons/block_code/blocks/communication/is_in_group.tres msgid "Is this node in the group" -msgstr "" +msgstr "Est-ce que ce nœud est dans le groupe" #: addons/block_code/blocks/communication/is_in_group.tres msgid "is in group {group: STRING}" -msgstr "" +msgstr "est dans le groupe {group: STRING}" #: addons/block_code/blocks/communication/is_node_in_group.tres msgid "Is the node in the group" -msgstr "" +msgstr "Est-ce que le nœud est dans le groupe" #: addons/block_code/blocks/communication/is_node_in_group.tres msgid "{node: OBJECT} is in group {group: STRING}" -msgstr "" +msgstr "{node: OBJECT} est dans le groupe {group: STRING}" #: addons/block_code/blocks/communication/remove_from_group.tres msgid "Remove this node from the group" -msgstr "" +msgstr "Retirer ce nœud du groupe" #: addons/block_code/blocks/communication/remove_from_group.tres msgid "remove from group {group: STRING}" -msgstr "" +msgstr "retirer du groupe {group: STRING}" #: addons/block_code/blocks/communication/remove_node_from_group.tres msgid "Remove the node from the group" -msgstr "" +msgstr "Retirer le nœud du groupe" #: addons/block_code/blocks/communication/remove_node_from_group.tres msgid "remove {node: OBJECT} from group {group: NIL}" -msgstr "" +msgstr "retirer {node: OBJECT} du groupe {group: NIL}" #: addons/block_code/blocks/graphics/animationplayer_is_playing.tres #: addons/block_code/blocks/graphics/animationplayer_pause.tres #: addons/block_code/blocks/graphics/animationplayer_play.tres #: addons/block_code/blocks/graphics/animationplayer_stop.tres msgid "Graphics | Animation" -msgstr "" +msgstr "Graphismes | Animation" #: addons/block_code/blocks/graphics/animationplayer_is_playing.tres msgid "Check if an animation is currently playing." -msgstr "" +msgstr "Vérifier si une animation est en cours de lecture." #: addons/block_code/blocks/graphics/animationplayer_is_playing.tres msgid "is playing" -msgstr "" +msgstr "est en lecture" #: addons/block_code/blocks/graphics/animationplayer_pause.tres msgid "Pause the currently playing animation." -msgstr "" +msgstr "Mettre en pause l'animation en cours." #: addons/block_code/blocks/graphics/animationplayer_pause.tres msgid "pause" -msgstr "" +msgstr "mettre en pause" #: addons/block_code/blocks/graphics/animationplayer_play.tres msgid "Play the animation." -msgstr "" +msgstr "Lire l'animation." #: addons/block_code/blocks/graphics/animationplayer_play.tres msgid "play {animation: STRING} | {direction: NIL} {wait_mode: NIL}" -msgstr "" +msgstr "lire {animation: STRING} | {direction: NIL} {wait_mode: NIL}" #: addons/block_code/blocks/graphics/animationplayer_stop.tres msgid "Stop the currently playing animation." -msgstr "" +msgstr "Arrêter l'animation en cours." #: addons/block_code/blocks/graphics/animationplayer_stop.tres #: addons/block_code/blocks/sounds/audiostreamplayer_stop.tres msgid "stop" -msgstr "" +msgstr "arrêter" #: addons/block_code/blocks/graphics/viewport_center.tres #: addons/block_code/blocks/graphics/viewport_height.tres #: addons/block_code/blocks/graphics/viewport_width.tres msgid "Graphics | Viewport" -msgstr "" +msgstr "Graphismes | Vue" #: addons/block_code/blocks/graphics/viewport_center.tres msgid "Coordinates of the middle of the viewable screen when playing." -msgstr "" +msgstr "Coordonnées du centre de l'écran visible pendant le jeu." #: addons/block_code/blocks/graphics/viewport_center.tres msgid "viewport center" -msgstr "" +msgstr "centre de la vue" #: addons/block_code/blocks/graphics/viewport_height.tres msgid "How tall the viewable screen is when playing." -msgstr "" +msgstr "Hauteur de l'écran visible pendant le jeu." #: addons/block_code/blocks/graphics/viewport_height.tres msgid "viewport height" -msgstr "" +msgstr "hauteur de la vue" #: addons/block_code/blocks/graphics/viewport_width.tres msgid "How wide the viewable screen is when playing." -msgstr "" +msgstr "Largeur de l'écran visible pendant le jeu." #: addons/block_code/blocks/graphics/viewport_width.tres msgid "viewport width" -msgstr "" +msgstr "largeur de la vue" #: addons/block_code/blocks/input/characterbody2d_is_on_floor.tres #: addons/block_code/blocks/physics/characterbody2d_move_and_slide.tres msgid "Physics | Velocity" -msgstr "" +msgstr "Physique | Vitesse" #: addons/block_code/blocks/input/characterbody2d_is_on_floor.tres msgid "True if the character is on the floor." -msgstr "" +msgstr "Vrai si le personnage est sur le sol." #: addons/block_code/blocks/input/characterbody2d_is_on_floor.tres msgid "is on floor" -msgstr "" +msgstr "est sur le sol" #: addons/block_code/blocks/input/characterbody2d_move.tres #: addons/block_code/blocks/input/is_input_actioned.tres #: addons/block_code/blocks/input/mouse_position.tres msgid "Input" -msgstr "" +msgstr "Entrée" #: addons/block_code/blocks/input/characterbody2d_move.tres msgid "" "Move the character up, down, left, and right with the keyboard using the " -"given keys. The speed of movement can be adjusted separately for x (left and " -"right) and y (up and down)." +"given keys. The speed of movement can be adjusted separately for x (left and" +" right) and y (up and down)." msgstr "" +"Déplacer le personnage vers le haut, le bas, la gauche et la droite avec le " +"clavier en utilisant les touches données. La vitesse de déplacement peut " +"être ajustée séparément pour x (gauche et droite) et y (haut et bas)." #: addons/block_code/blocks/input/characterbody2d_move.tres msgid "" -"move with keys {up: STRING} {down: STRING} {left: STRING} {right: STRING} at " -"speed {speed: VECTOR2}" +"move with keys {up: STRING} {down: STRING} {left: STRING} {right: STRING} at" +" speed {speed: VECTOR2}" msgstr "" +"déplacer avec les touches {up: STRING} {down: STRING} {left: STRING} {right:" +" STRING} à la vitesse {speed: VECTOR2}" #: addons/block_code/blocks/input/is_input_actioned.tres msgid "True if the specified input action has been pressed or released." -msgstr "" +msgstr "Vrai si l'action d'entrée spécifiée a été pressée ou relâchée." #: addons/block_code/blocks/input/is_input_actioned.tres msgid "action {action_name: STRING_NAME} is {action: NIL}" -msgstr "" +msgstr "l'action {action_name: STRING_NAME} est {action: NIL}" #: addons/block_code/blocks/lifecycle/process.tres #: addons/block_code/blocks/lifecycle/queue_free.tres @@ -412,110 +415,118 @@ msgstr "" #: addons/block_code/blocks/lifecycle/ready.tres #: addons/block_code/blocks/lifecycle/physics_process.tres msgid "Lifecycle" -msgstr "" +msgstr "Cycle de vie" #: addons/block_code/blocks/lifecycle/process.tres msgid "" "Attached blocks will be executed during the processing step of the main loop" msgstr "" +"Les blocs attachés seront exécutés pendant l'étape de traitement de la " +"boucle principale" #: addons/block_code/blocks/lifecycle/process.tres msgid "every frame" -msgstr "" +msgstr "à chaque image" #: addons/block_code/blocks/lifecycle/queue_free.tres msgid "Queues this node to be deleted at the end of the current frame" msgstr "" +"Met ce nœud en file d'attente pour être supprimé à la fin de l'image " +"actuelle" #: addons/block_code/blocks/lifecycle/queue_free.tres msgid "remove" -msgstr "" +msgstr "supprimer" #: addons/block_code/blocks/lifecycle/queue_free_node.tres msgid "Queues the given node to be deleted at the end of the current frame" msgstr "" +"Met le nœud donné en file d'attente pour être supprimé à la fin de l'image " +"actuelle" #: addons/block_code/blocks/lifecycle/queue_free_node.tres msgid "remove {node: OBJECT}" -msgstr "" +msgstr "supprimer {node: OBJECT}" #: addons/block_code/blocks/lifecycle/ready.tres msgid "Attached blocks will be executed once when the node is \"ready\"" -msgstr "" +msgstr "Les blocs attachés seront exécutés une fois que le nœud est « prêt »" #: addons/block_code/blocks/lifecycle/ready.tres msgid "when starting" -msgstr "" +msgstr "au démarrage" #: addons/block_code/blocks/log/breakpoint.tres #: addons/block_code/blocks/log/concat.tres #: addons/block_code/blocks/log/print.tres msgid "Log" -msgstr "" +msgstr "Journal" #: addons/block_code/blocks/log/breakpoint.tres msgid "Pause execution and show the current line of code in the debugger." msgstr "" +"Mettre en pause l'exécution et afficher la ligne de code actuelle dans le " +"débogueur." #: addons/block_code/blocks/log/breakpoint.tres msgid "breakpoint" -msgstr "" +msgstr "point d'arrêt" #: addons/block_code/blocks/log/concat.tres msgid "{string1: STRING} + {string2: STRING}" -msgstr "" +msgstr "{chaîne1: STRING} + {chaîne2: STRING}" #: addons/block_code/blocks/log/print.tres msgid "Print the text to output" -msgstr "" +msgstr "Afficher le texte dans la sortie" #: addons/block_code/blocks/log/print.tres msgid "log text {text: STRING}" -msgstr "" +msgstr "afficher le texte {text: STRING}" #: addons/block_code/blocks/logic/and.tres #: addons/block_code/blocks/logic/not.tres #: addons/block_code/blocks/logic/or.tres msgid "Logic | Boolean" -msgstr "" +msgstr "Logique | Booléen" #: addons/block_code/blocks/logic/and.tres msgid "{bool1: BOOL} and {bool2: BOOL}" -msgstr "" +msgstr "{bool1: BOOL} et {bool2: BOOL}" #: addons/block_code/blocks/logic/compare.tres msgid "Logic | Comparison" -msgstr "" +msgstr "Logique | Comparaison" #: addons/block_code/blocks/logic/compare.tres msgid "{float1: FLOAT} {op: NIL} {float2: FLOAT}" -msgstr "" +msgstr "{flottant1: FLOAT} {op: NIL} {flottant2: FLOAT}" #: addons/block_code/blocks/logic/else.tres #: addons/block_code/blocks/logic/else_if.tres #: addons/block_code/blocks/logic/if.tres msgid "Logic | Conditionals" -msgstr "" +msgstr "Logique | Conditionnels" #: addons/block_code/blocks/logic/else.tres msgid "else" -msgstr "" +msgstr "sinon" #: addons/block_code/blocks/logic/else_if.tres msgid "else if {condition: BOOL}" -msgstr "" +msgstr "sinon si {condition: BOOL}" #: addons/block_code/blocks/logic/if.tres msgid "if {condition: BOOL}" -msgstr "" +msgstr "si {condition: BOOL}" #: addons/block_code/blocks/logic/not.tres msgid "not {bool: BOOL}" -msgstr "" +msgstr "non {bool: BOOL}" #: addons/block_code/blocks/logic/or.tres msgid "{bool1: BOOL} or {bool2: BOOL}" -msgstr "" +msgstr "{bool1: BOOL} ou {bool2: BOOL}" #: addons/block_code/blocks/loops/await_scene_ready.tres #: addons/block_code/blocks/loops/break.tres @@ -523,27 +534,27 @@ msgstr "" #: addons/block_code/blocks/loops/for.tres #: addons/block_code/blocks/loops/while.tres msgid "Loops" -msgstr "" +msgstr "Boucles" #: addons/block_code/blocks/loops/await_scene_ready.tres msgid "wait for the scene to be ready" -msgstr "" +msgstr "attendre que la scène soit prête" #: addons/block_code/blocks/loops/break.tres msgid "break" -msgstr "" +msgstr "arrêter la boucle" #: addons/block_code/blocks/loops/continue.tres msgid "continue" -msgstr "" +msgstr "continuer" #: addons/block_code/blocks/loops/for.tres msgid "Run the connected blocks [i]number[/i] times" -msgstr "" +msgstr "Exécuter les blocs connectés [i]nombre[/i] de fois" #: addons/block_code/blocks/loops/for.tres msgid "repeat {number: INT}" -msgstr "" +msgstr "répéter {number: INT}" #: addons/block_code/blocks/loops/while.tres msgid "" @@ -551,10 +562,13 @@ msgid "" "\n" "Hint: snap a [b]Comparison[/b] block into the condition." msgstr "" +"Exécuter les blocs connectés tant que la [i]condition[/i] est vraie.\n" +"\n" +"Conseil : attachez un bloc de [b]Comparaison[/b] à la condition." #: addons/block_code/blocks/loops/while.tres msgid "while {condition: BOOL}" -msgstr "" +msgstr "tant que {condition: BOOL}" #: addons/block_code/blocks/math/add.tres #: addons/block_code/blocks/math/cos.tres @@ -574,41 +588,44 @@ msgstr "" #: addons/block_code/blocks/math/vector3_multiply.tres #: addons/block_code/blocks/variables/vector3.tres msgid "Math" -msgstr "" +msgstr "Mathématiques" #: addons/block_code/blocks/math/add.tres msgid "{a: FLOAT} + {b: FLOAT}" -msgstr "" +msgstr "{a: FLOAT} + {b: FLOAT}" #: addons/block_code/blocks/math/cos.tres msgid "Calculate the cosine of [i]angle[/i]" -msgstr "" +msgstr "Calculer le cosinus de [i]l'angle[/i]" #: addons/block_code/blocks/math/cos.tres msgid "cos {angle: FLOAT}" -msgstr "" +msgstr "cos {angle: FLOAT}" #: addons/block_code/blocks/math/divide.tres msgid "{a: FLOAT} / {b: FLOAT}" -msgstr "" +msgstr "{a: FLOAT} / {b: FLOAT}" #: addons/block_code/blocks/math/multiply.tres msgid "{a: FLOAT} * {b: FLOAT}" -msgstr "" +msgstr "{a: FLOAT} * {b: FLOAT}" #: addons/block_code/blocks/math/pow.tres msgid "{base: FLOAT} ^ {exp: FLOAT}" -msgstr "" +msgstr "{base: FLOAT} ^ {exp: FLOAT}" #: addons/block_code/blocks/math/randf_range.tres msgid "" "Generate a random floating point number between [i]from[/i] and [i]to[/i] " "inclusively" msgstr "" +"Générer un nombre à virgule flottante aléatoire entre [i]de[/i] et [i]à[/i] " +"inclusivement" #: addons/block_code/blocks/math/randf_range.tres msgid "random floating point number between {from: FLOAT} and {to: FLOAT}" msgstr "" +"nombre à virgule flottante aléatoire entre {from: FLOAT} et {to: FLOAT}" #: addons/block_code/blocks/math/randi_range.tres msgid "" @@ -616,52 +633,57 @@ msgid "" "[i]to[/i] inclusively. [i]from[/i] and [i]to[/i] can be a negative or " "positive number" msgstr "" +"Générer un nombre entier signé de 32 bits aléatoire entre [i]de[/i] et " +"[i]à[/i] inclusivement. [i]de[/i] et [i]à[/i] peuvent être des nombres " +"négatifs ou positifs" #: addons/block_code/blocks/math/randi_range.tres msgid "random integer number between {from: INT} and {to: INT}" -msgstr "" +msgstr "nombre entier aléatoire entre {from: INT} et {to: INT}" #: addons/block_code/blocks/math/sin.tres msgid "Calculate the sine of [i]angle[/i]" -msgstr "" +msgstr "Calculer le sinus de [i]l'angle[/i]" #: addons/block_code/blocks/math/sin.tres msgid "sin {angle: FLOAT}" -msgstr "" +msgstr "sin {angle: FLOAT}" #: addons/block_code/blocks/math/subtract.tres msgid "{a: FLOAT} - {b: FLOAT}" -msgstr "" +msgstr "{a: FLOAT} - {b: FLOAT}" #: addons/block_code/blocks/math/tan.tres msgid "Calculate the tangent of [i]angle[/i]" -msgstr "" +msgstr "Calculer la tangente de [i]l'angle[/i]" #: addons/block_code/blocks/math/tan.tres msgid "tan {angle: FLOAT}" -msgstr "" +msgstr "tan {angle: FLOAT}" #: addons/block_code/blocks/math/vector_from_angle.tres msgid "Creates a unit Vector2 rotated to the given angle in radians." -msgstr "" +msgstr "Crée un Vector2 unitaire tourné à l'angle donné en radians." #: addons/block_code/blocks/math/vector_from_angle.tres msgid "vector from {angle: FLOAT}" -msgstr "" +msgstr "vecteur depuis {angle: FLOAT}" #: addons/block_code/blocks/math/vector_multiply.tres msgid "" "Multiplies a vector with a number. Use this, for example, to get a point " "some distance away along an angle." msgstr "" +"Multiplie un vecteur par un nombre. Utilisez cela, par exemple, pour obtenir" +" un point à une certaine distance le long d'un angle." #: addons/block_code/blocks/math/vector_multiply.tres msgid "multiply {vector: VECTOR2} by {number: FLOAT}" -msgstr "" +msgstr "multiplier {vector: VECTOR2} par {number: FLOAT}" #: addons/block_code/blocks/physics/characterbody2d_move_and_slide.tres msgid "move and slide" -msgstr "" +msgstr "déplacer et glisser" #: addons/block_code/blocks/sounds/audiostreamplayer_play.tres #: addons/block_code/blocks/sounds/audiostreamplayer_stop.tres @@ -674,155 +696,161 @@ msgstr "Sons" #: addons/block_code/blocks/sounds/audiostreamplayer_play.tres msgid "Play the audio stream" -msgstr "" +msgstr "Lire le flux audio" #: addons/block_code/blocks/sounds/audiostreamplayer_play.tres msgid "play" -msgstr "" +msgstr "lire" #: addons/block_code/blocks/sounds/audiostreamplayer_stop.tres #: addons/block_code/blocks/sounds/stop_sound.tres msgid "Stop the audio stream" -msgstr "" +msgstr "Arrêter le flux audio" #: addons/block_code/blocks/sounds/load_sound.tres msgid "Load a resource file as the audio stream" -msgstr "" +msgstr "Charger un fichier de ressource en tant que flux audio" #: addons/block_code/blocks/sounds/load_sound.tres msgid "load file {file_path: STRING} as sound {name: STRING}" -msgstr "" +msgstr "charger le fichier {file_path: STRING} comme son {name: STRING}" #: addons/block_code/blocks/sounds/pause_continue_sound.tres msgid "Pause/Continue the audio stream" -msgstr "" +msgstr "Mettre en pause/Continuer le flux audio" #: addons/block_code/blocks/sounds/pause_continue_sound.tres msgid "{pause: NIL} the sound {name: STRING}" -msgstr "" +msgstr "{pause: NIL} le son {name: STRING}" #: addons/block_code/blocks/sounds/play_sound.tres msgid "Play the audio stream with volume and pitch" -msgstr "" +msgstr "Lire le flux audio avec le volume et la hauteur" #: addons/block_code/blocks/sounds/play_sound.tres msgid "" "play the sound {name: STRING} | with volume {db: FLOAT} dB and pitch scale " "{pitch: FLOAT}" msgstr "" +"lire le son {name: STRING} | avec un volume de {db: FLOAT} dB et une hauteur" +" de {pitch: FLOAT}" #: addons/block_code/blocks/sounds/stop_sound.tres msgid "stop the sound {name: STRING}" -msgstr "" +msgstr "arrêter le son {name: STRING}" #: addons/block_code/blocks/spawn/cpuparticles2d_finished.tres msgid "Lifecycle | Spawn" -msgstr "" +msgstr "Cycle de vie | Génération" #: addons/block_code/blocks/spawn/cpuparticles2d_finished.tres msgid "Emitted when all active particles have finished processing." msgstr "" +"Émis lorsque toutes les particules actives ont terminé leur traitement." #: addons/block_code/blocks/spawn/cpuparticles2d_finished.tres msgid "when particles are finished" -msgstr "" +msgstr "quand les particules sont terminées" #: addons/block_code/blocks/transform/rigidbody2d_physics_position.tres msgid "Transform | Position" -msgstr "" +msgstr "Transformation | Position" #: addons/block_code/blocks/transform/rigidbody2d_physics_position.tres msgid "set physics position {position: VECTOR2}" -msgstr "" +msgstr "définir la position physique {position: VECTOR2}" #: addons/block_code/blocks/ui/label_set_text.tres msgid "UI" -msgstr "" +msgstr "Interface utilisateur" #: addons/block_code/blocks/ui/label_set_text.tres msgid "Set the text for the label." -msgstr "" +msgstr "Définir le texte de l'étiquette." #: addons/block_code/blocks/ui/label_set_text.tres msgid "set text to {text: STRING}" -msgstr "" +msgstr "définir le texte sur {text: STRING}" #: addons/block_code/blocks/variables/vector2.tres msgid "vector2 x: {x: FLOAT} y: {y: FLOAT}" -msgstr "" +msgstr "vecteur2 x : {x: FLOAT} y : {y: FLOAT}" #: addons/block_code/code_generation/block_definition.gd msgid "Set the %s property" -msgstr "" +msgstr "Définir la propriété %s" #: addons/block_code/code_generation/block_definition.gd msgid "set %%s to {value: %s}" -msgstr "" +msgstr "définir %%s sur {value: %s}" #: addons/block_code/code_generation/block_definition.gd msgid "Change the %s property" -msgstr "" +msgstr "Changer la propriété %s" #: addons/block_code/code_generation/block_definition.gd msgid "change %%s by {value: %s}" -msgstr "" +msgstr "changer %%s de {value: %s}" #: addons/block_code/code_generation/block_definition.gd msgid "The %s property" -msgstr "" +msgstr "La propriété %s" #: addons/block_code/code_generation/block_definition.gd msgid "Set the %s variable" -msgstr "" +msgstr "Définir la variable %s" #: addons/block_code/code_generation/block_definition.gd msgid "set %s to {value: %s}" -msgstr "" +msgstr "définir %s sur {value: %s}" #: addons/block_code/code_generation/block_definition.gd msgid "The %s variable" -msgstr "" +msgstr "La variable %s" #: addons/block_code/inspector_plugin/block_script_inspector.gd msgid "Open Block Script" -msgstr "" +msgstr "Ouvrir le script par blocs" #: addons/block_code/simple_nodes/simple_character/simple_character.gd msgid "move with {player: NIL} buttons as {kind: NIL}" -msgstr "" +msgstr "se déplacer avec les boutons {player: NIL} comme {kind: NIL}" #: addons/block_code/simple_nodes/simple_character/simple_character.gd msgid "" -"Move the character using the “Player 1” or “Player 2” controls as configured " -"in Godot.\n" +"Move the character using the “Player 1” or “Player 2” controls as configured in Godot.\n" "\n" -"“Top-down” enables the character to move in both x (horizontal) and y " -"(vertical) dimensions, as if the camera is above the character, looking " -"down. No gravity is added.\n" +"“Top-down” enables the character to move in both x (horizontal) and y (vertical) dimensions, as if the camera is above the character, looking down. No gravity is added.\n" "\n" -"“Platformer” enables the character to move as if the camera is looking from " -"the side, like a side-scroller. Gravity is applied on the y (vertical) axis, " -"making the character fall down until they collide with something.\n" +"“Platformer” enables the character to move as if the camera is looking from the side, like a side-scroller. Gravity is applied on the y (vertical) axis, making the character fall down until they collide with something.\n" "\n" -"“Spaceship” uses the left/right controls to rotate the character and up/down " -"controls to go forward or backward in the direction they are pointing." +"“Spaceship” uses the left/right controls to rotate the character and up/down controls to go forward or backward in the direction they are pointing." msgstr "" +"Déplacer le personnage en utilisant les commandes « Joueur 1 » ou « Joueur 2 » telles que configurées dans Godot.\n" +"\n" +"« Vue de dessus » permet au personnage de se déplacer à la fois dans les dimensions x (horizontale) et y (verticale), comme si la caméra était au-dessus du personnage, regardant vers le bas. Aucune gravité n'est ajoutée.\n" +"\n" +"« Plateformes » permet au personnage de se déplacer comme si la caméra regardait de côté, comme un jeu de défilement horizontal. La gravité est appliquée sur l'axe y (vertical), faisant tomber le personnage jusqu'à ce qu'il entre en collision avec quelque chose.\n" +"\n" +"« Vaisseau spatial » utilise les commandes gauche/droite pour faire pivoter le personnage et les commandes haut/bas pour avancer ou reculer dans la direction qu'il pointe." #: addons/block_code/simple_nodes/simple_ending/simple_ending.gd msgid "game over {result: STRING}" -msgstr "" +msgstr "fin de partie {result: STRING}" #: addons/block_code/simple_nodes/simple_ending/simple_ending.gd msgid "Show the game over label with the win or lose message." msgstr "" +"Afficher l'étiquette de fin de partie avec le message de victoire ou de " +"défaite." #: addons/block_code/simple_nodes/simple_ending/simple_ending.gd msgid "reset game over" -msgstr "" +msgstr "réinitialiser la fin de partie" #: addons/block_code/simple_nodes/simple_ending/simple_ending.gd msgid "Reset the game over label." -msgstr "" +msgstr "Réinitialiser l'étiquette de fin de partie." #: addons/block_code/simple_nodes/simple_scoring/simple_scoring.gd msgid "0" @@ -830,51 +858,51 @@ msgstr "0" #: addons/block_code/simple_nodes/simple_scoring/simple_scoring.gd msgid "set score to {score: INT}" -msgstr "" +msgstr "définir le score sur {score: INT}" #: addons/block_code/simple_nodes/simple_scoring/simple_scoring.gd msgid "change score by {score: INT}" -msgstr "" +msgstr "changer le score de {score: INT}" #: addons/block_code/simple_spawner/simple_spawner.gd msgid "spawn once" -msgstr "" +msgstr "générer une fois" #: addons/block_code/simple_spawner/simple_spawner.gd msgid "start spawning" -msgstr "" +msgstr "commencer à générer" #: addons/block_code/simple_spawner/simple_spawner.gd msgid "stop spawning" -msgstr "" +msgstr "arrêter de générer" #: addons/block_code/simple_spawner/simple_spawner.gd msgid "is spawning" -msgstr "" +msgstr "est en cours de génération" #: addons/block_code/simple_spawner/simple_spawner.gd msgid "set spawn period to {new_period: FLOAT}" -msgstr "" +msgstr "définir la période de génération sur {new_period: FLOAT}" #: addons/block_code/simple_spawner/simple_spawner.gd msgid "spawn period" -msgstr "" +msgstr "période de génération" #: addons/block_code/ui/main_panel.tscn msgid "Advanced" -msgstr "" +msgstr "Avancé" #: addons/block_code/ui/main_panel.tscn msgid "Show Generated Script" -msgstr "" +msgstr "Afficher le script généré" #: addons/block_code/ui/main_panel.tscn msgid "Delete Block Code" -msgstr "" +msgstr "Supprimer le code par blocs" #: addons/block_code/ui/main_panel.tscn msgid "Toggle Block Picker (Ctrl+BackSlash)" -msgstr "" +msgstr "Afficher/Masquer le sélecteur de blocs (Ctrl+Backslash)" #: addons/block_code/ui/block_canvas/block_canvas.tscn msgid "1.0x" @@ -882,57 +910,60 @@ msgstr "1.0×" #: addons/block_code/ui/block_canvas/block_canvas.tscn msgid "Select a node to create and edit block code." -msgstr "" +msgstr "Sélectionnez un nœud pour créer et modifier du code par blocs." #: addons/block_code/ui/block_canvas/block_canvas.tscn msgid "" -"Use block coding to create custom behavior and game mechanics for \"{node}\"." +"Use block coding to create custom behavior and game mechanics for " +"\"{node}\"." msgstr "" +"Utilisez le codage par blocs pour créer un comportement et des mécanismes de" +" jeu personnalisés pour « {node} »." #: addons/block_code/ui/block_canvas/block_canvas.tscn msgid "Add Block Code" -msgstr "" +msgstr "Ajouter du code par blocs" #: addons/block_code/ui/block_canvas/block_canvas.tscn msgid "\"{node}\" uses block coding." -msgstr "" +msgstr "« {node} » utilise le codage par blocs." #: addons/block_code/ui/block_canvas/block_canvas.tscn msgid "Open in Editor" -msgstr "" +msgstr "Ouvrir dans l'éditeur" #: addons/block_code/ui/block_canvas/block_canvas.tscn msgid "Override Block Code" -msgstr "" +msgstr "Remplacer le code par blocs" #: addons/block_code/ui/blocks/block/block.gd msgid "Type:" -msgstr "" +msgstr "Type :" #: addons/block_code/ui/blocks/utilities/drag_drop_area/drag_drop_area.gd msgid "Duplicate" -msgstr "" +msgstr "Dupliquer" #: addons/block_code/ui/blocks/utilities/drag_drop_area/drag_drop_area.gd msgid "Delete" -msgstr "" +msgstr "Supprimer" #: addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn msgid "Parameter" -msgstr "" +msgstr "Paramètre" #: addons/block_code/ui/picker/categories/block_category_button.tscn msgid "Example" -msgstr "" +msgstr "Exemple" #: addons/block_code/ui/picker/categories/variable_category/create_variable_button.tscn #: addons/block_code/ui/picker/categories/variable_category/create_variable_dialog.tscn msgid "Create New Variable" -msgstr "" +msgstr "Créer une nouvelle variable" #: addons/block_code/ui/picker/categories/variable_category/create_variable_dialog.tscn msgid "Create" -msgstr "Crée" +msgstr "Créer" #: addons/block_code/ui/picker/categories/variable_category/create_variable_dialog.tscn msgid "Name " @@ -940,68 +971,72 @@ msgstr "Nom" #: addons/block_code/ui/picker/categories/variable_category/create_variable_dialog.tscn msgid "Type " -msgstr "" +msgstr "Type" #: addons/block_code/ui/script_window/script_window.tscn msgid "Block Code Generated GDScript" -msgstr "" +msgstr "GDScript généré par le code par blocs" #: addons/block_code/ui/script_window/script_window.tscn msgid "Copy" -msgstr "" +msgstr "Copier" #: addons/block_code/blocks/input/mouse_position.tres msgid "The coordinates of the mouse position." -msgstr "" +msgstr "Les coordonnées de la position de la souris." #: addons/block_code/blocks/input/mouse_position.tres msgid "mouse position" -msgstr "" +msgstr "position de la souris" #: addons/block_code/blocks/math/vector2_xy.tres msgid "Gives the x or y of a [b]Vector2[/b]" -msgstr "" +msgstr "Donne le x ou le y d'un [b]Vector2[/b]" #: addons/block_code/blocks/math/vector2_xy.tres msgid "{xy: NIL} of {vector2: VECTOR2}" -msgstr "" +msgstr "{xy: NIL} de {vector2: VECTOR2}" #: addons/block_code/blocks/math/vector3_xyz.tres msgid "Gives the x, y, or z of a [b]Vector3[/b]" -msgstr "" +msgstr "Donne le x, le y ou le z d'un [b]Vector3[/b]" #: addons/block_code/blocks/math/vector3_xyz.tres msgid "{xyz: NIL} of {vector3: VECTOR3}" -msgstr "" +msgstr "{xyz: NIL} de {vector3: VECTOR3}" #: addons/block_code/blocks/math/vector3_multiply.tres msgid "" "Multiplies a Vector3 with a number. Use this, for example, to get a point " "some distance away along an angle." msgstr "" +"Multiplie un Vector3 par un nombre. Utilisez cela, par exemple, pour obtenir" +" un point à une certaine distance le long d'un angle." #: addons/block_code/blocks/math/vector3_multiply.tres msgid "multiply {vector: VECTOR3} by {number: FLOAT}" -msgstr "" +msgstr "multiplier {vector: VECTOR3} par {number: FLOAT}" #: addons/block_code/blocks/communication/switch_scene.tres msgid "" -"Stop playing the current scene, and switch to a different one. You might use " -"this to switch to a new level." +"Stop playing the current scene, and switch to a different one. You might use" +" this to switch to a new level." msgstr "" +"Arrêter la scène actuelle et passer à une autre. Vous pouvez l'utiliser pour" +" passer à un nouveau niveau." #: addons/block_code/blocks/communication/switch_scene.tres msgid "switch the scene to {file_path: STRING}" -msgstr "" +msgstr "passer la scène à {file_path: STRING}" #: addons/block_code/blocks/variables/vector3.tres msgid "vector3 x: {x: FLOAT} y: {y: FLOAT}: z: {z: FLOAT}" -msgstr "" +msgstr "vecteur3 x : {x: FLOAT} y : {y: FLOAT} z : {z: FLOAT}" #: addons/block_code/blocks/lifecycle/physics_process.tres msgid "Attached blocks will be executed before each physics step" -msgstr "" +msgstr "Les blocs attachés seront exécutés avant chaque étape de la physique" #: addons/block_code/blocks/lifecycle/physics_process.tres msgid "every physics step" -msgstr "" +msgstr "à chaque étape de la physique" diff --git a/addons/block_code/ui/blocks/block/block.gd b/addons/block_code/ui/blocks/block/block.gd index 9972cdfb..6a006174 100644 --- a/addons/block_code/ui/blocks/block/block.gd +++ b/addons/block_code/ui/blocks/block/block.gd @@ -129,7 +129,7 @@ func _get_format_string() -> String: if not definition: return "" - if definition.property_name: + if definition.property_name and TranslationServer.has_method(&"get_or_add_domain"): var domain: TranslationDomain = TranslationServer.get_or_add_domain("godot.properties") var translated_property: String = domain.translate(definition.property_name.capitalize()) # TODO: Ideally we should be also passing the context. See: diff --git a/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd b/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd index c9551bdf..6e03f275 100644 --- a/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd +++ b/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd @@ -6,6 +6,7 @@ signal drag_started(offset: Vector2) const Constants = preload("res://addons/block_code/ui/constants.gd") const OptionData = preload("res://addons/block_code/code_generation/option_data.gd") const Types = preload("res://addons/block_code/types/types.gd") +const Option_Theme = preload("res://addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn::StyleBoxFlat_7m75r") signal modified @@ -286,6 +287,24 @@ func _switch_input(node: Node): c.visible = c == node _background.visible = node not in [_option_input, null] _background.is_pointy_value = node == _bool_input + if option_data: + _option_input.add_theme_stylebox_override("focus", Option_Theme) + _option_input.add_theme_stylebox_override("hover", Option_Theme) + _option_input.add_theme_stylebox_override("pressed", Option_Theme) + _option_input.add_theme_stylebox_override("normal", Option_Theme) + var raw_input = get_raw_input() + var data = str_to_var("" if raw_input == null or raw_input is Block else raw_input) + if typeof(data): + var empty_theme = StyleBoxEmpty.new() + _option_input.add_theme_stylebox_override("focus", empty_theme) + _option_input.add_theme_stylebox_override("hover", empty_theme) + _option_input.add_theme_stylebox_override("pressed", empty_theme) + _option_input.add_theme_stylebox_override("normal", empty_theme) + variant_type = typeof(data) + _background.visible = true + _background.is_pointy_value = variant_type == TYPE_BOOL + snap_point.visible = true + snap_point.variant_type = variant_type func _update_option_input(current_value: Variant = null): @@ -350,6 +369,7 @@ func _update_background_color(new_color): func _on_option_input_item_selected(index): if not editable: return + _update_visible_input() modified.emit() diff --git a/addons/block_code/ui/main_panel.gd b/addons/block_code/ui/main_panel.gd index cdc8e8f7..83d47618 100644 --- a/addons/block_code/ui/main_panel.gd +++ b/addons/block_code/ui/main_panel.gd @@ -50,6 +50,7 @@ func _ready(): _picker.block_picked.connect(_drag_manager.copy_picked_block_and_drag) _picker.variable_created.connect(_create_variable) + _picker.variables_deleted.connect(_delete_variables) _block_canvas.reconnect_block.connect(_drag_manager.connect_block_canvas_signals) _drag_manager.block_dropped.connect(save_script) _drag_manager.block_modified.connect(save_script) @@ -284,3 +285,25 @@ func _create_variable(variable: VariableDefinition): undo_redo.commit_action() _picker.reload_blocks() + + +func _delete_variables(variables_to_delete: Array): + if _context.block_code_node == null: + print("No script loaded to delete variables from.") + return + + var block_script: BlockScriptSerialization = _context.block_script + + undo_redo.create_action("Delete variables %s in %s's block code script" % [variables_to_delete, _context.parent_node.name]) + undo_redo.add_undo_property(_context.block_script, "variables", _context.block_script.variables) + + var new_variables = block_script.variables.duplicate() + for index in range(new_variables.size() - 1, -1, -1): + var variable = new_variables[index] + if variable.var_name in variables_to_delete: + new_variables.erase(variable) + + undo_redo.add_do_property(_context.block_script, "variables", new_variables) + undo_redo.commit_action() + + _picker.reload_blocks() diff --git a/addons/block_code/ui/picker/categories/variable_category/delete_variables_button.gd b/addons/block_code/ui/picker/categories/variable_category/delete_variables_button.gd new file mode 100644 index 00000000..1306b932 --- /dev/null +++ b/addons/block_code/ui/picker/categories/variable_category/delete_variables_button.gd @@ -0,0 +1,20 @@ +@tool +extends MarginContainer + +signal delete_variables(variables: Array[String]) + +@onready var _delete_variables_dialog := %DeleteVariablesDialog +@onready var _delete_button := %DeleteButton +@onready var _delete_variables_icon = _delete_button.get_theme_icon("Remove", "EditorIcons") + + +func _ready() -> void: + _delete_button.icon = _delete_variables_icon + + +func _on_delete_button_pressed(): + _delete_variables_dialog.popup() + + +func _on_delete_variables_dialog_delete_variables(variables): + delete_variables.emit(variables) diff --git a/addons/block_code/ui/picker/categories/variable_category/delete_variables_button.gd.uid b/addons/block_code/ui/picker/categories/variable_category/delete_variables_button.gd.uid new file mode 100644 index 00000000..105c60b0 --- /dev/null +++ b/addons/block_code/ui/picker/categories/variable_category/delete_variables_button.gd.uid @@ -0,0 +1 @@ +uid://8b8f5cd61gic diff --git a/addons/block_code/ui/picker/categories/variable_category/delete_variables_button.tscn b/addons/block_code/ui/picker/categories/variable_category/delete_variables_button.tscn new file mode 100644 index 00000000..7f360703 --- /dev/null +++ b/addons/block_code/ui/picker/categories/variable_category/delete_variables_button.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=5 format=3 uid="uid://ba2ckluuotftw"] + +[ext_resource type="PackedScene" uid="uid://bxkdgyj0kpexu" path="res://addons/block_code/ui/picker/categories/variable_category/delete_variables_dialog.tscn" id="1_5id0e"] +[ext_resource type="Script" uid="uid://8b8f5cd61gic" path="res://addons/block_code/ui/picker/categories/variable_category/delete_variables_button.gd" id="1_fr423"] + +[sub_resource type="Image" id="Image_fr423"] +data = { +"data": PackedByteArray(255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 255, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 231, 255, 90, 90, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 90, 90, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 42, 255, 90, 90, 0, 255, 94, 94, 0, 255, 91, 91, 42, 255, 93, 93, 233, 255, 92, 92, 232, 255, 93, 93, 41, 255, 90, 90, 0, 255, 94, 94, 0, 255, 91, 91, 42, 255, 93, 93, 233, 255, 92, 92, 232, 255, 92, 92, 0, 255, 92, 92, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 45, 255, 93, 93, 44, 255, 91, 91, 0, 255, 91, 91, 42, 255, 91, 91, 42, 255, 93, 93, 0, 255, 91, 91, 45, 255, 93, 93, 44, 255, 91, 91, 0, 255, 91, 91, 42, 255, 91, 91, 42, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 45, 255, 92, 92, 235, 255, 92, 92, 234, 255, 89, 89, 43, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 45, 255, 92, 92, 235, 255, 92, 92, 234, 255, 89, 89, 43, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 91, 91, 59, 255, 92, 92, 61, 255, 92, 92, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 91, 91, 59, 255, 92, 92, 61, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0), +"format": "RGBA8", +"height": 16, +"mipmaps": false, +"width": 16 +} + +[sub_resource type="ImageTexture" id="ImageTexture_sdiwn"] +image = SubResource("Image_fr423") + +[node name="DeleteVariablesButton" type="MarginContainer"] +offset_right = 186.0 +offset_bottom = 43.0 +size_flags_horizontal = 0 +theme_override_constants/margin_bottom = 12 +script = ExtResource("1_fr423") + +[node name="DeleteButton" type="Button" parent="."] +unique_name_in_owner = true +layout_mode = 2 +theme_type_variation = &"InspectorActionButton" +text = "Delete Variables" +icon = SubResource("ImageTexture_sdiwn") + +[node name="DeleteVariablesDialog" parent="." instance=ExtResource("1_5id0e")] +unique_name_in_owner = true +visible = false + +[connection signal="pressed" from="DeleteButton" to="." method="_on_delete_button_pressed"] +[connection signal="delete_variables" from="DeleteVariablesDialog" to="." method="_on_delete_variables_dialog_delete_variables"] diff --git a/addons/block_code/ui/picker/categories/variable_category/delete_variables_dialog.gd b/addons/block_code/ui/picker/categories/variable_category/delete_variables_dialog.gd new file mode 100644 index 00000000..47644204 --- /dev/null +++ b/addons/block_code/ui/picker/categories/variable_category/delete_variables_dialog.gd @@ -0,0 +1,38 @@ +@tool +extends ConfirmationDialog + +const BlockCategoryDisplay = preload("res://addons/block_code/ui/picker/categories/block_category_display.gd") + +signal delete_variables(variables: Array[String]) + +@onready var _variables_container := %VariablesContainer +var _checkbox_template := CheckBox.new() +var _main_panel: Node + + +func _ready(): + _main_panel = get_parent() + + +func _on_confirmed(): + var variables := [] + for checkbox in _variables_container.get_children(): + if checkbox.button_pressed: + variables.append(checkbox.text) + + delete_variables.emit(variables) + + hide() + + +func _on_about_to_popup() -> void: + for checkbox in _variables_container.get_children(): + _variables_container.remove_child(checkbox) + checkbox.queue_free() + + while _main_panel.name != "MainPanel": + _main_panel = _main_panel.get_parent() + + for variable in _main_panel._context.block_script.variables: + _checkbox_template.text = variable.var_name + _variables_container.add_child(_checkbox_template.duplicate()) diff --git a/addons/block_code/ui/picker/categories/variable_category/delete_variables_dialog.gd.uid b/addons/block_code/ui/picker/categories/variable_category/delete_variables_dialog.gd.uid new file mode 100644 index 00000000..3fb38ae6 --- /dev/null +++ b/addons/block_code/ui/picker/categories/variable_category/delete_variables_dialog.gd.uid @@ -0,0 +1 @@ +uid://duu6fvcrvhxrh diff --git a/addons/block_code/ui/picker/categories/variable_category/delete_variables_dialog.tscn b/addons/block_code/ui/picker/categories/variable_category/delete_variables_dialog.tscn new file mode 100644 index 00000000..8fa29e15 --- /dev/null +++ b/addons/block_code/ui/picker/categories/variable_category/delete_variables_dialog.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=2 format=3 uid="uid://bxkdgyj0kpexu"] + +[ext_resource type="Script" uid="uid://duu6fvcrvhxrh" path="res://addons/block_code/ui/picker/categories/variable_category/delete_variables_dialog.gd" id="1_l45s3"] + +[node name="DeleteVariablesDialog" type="ConfirmationDialog"] +title = "Delete Variables" +initial_position = 1 +size = Vector2i(300, 183) +visible = true +ok_button_text = "Delete" +dialog_hide_on_ok = false +script = ExtResource("1_l45s3") + +[node name="VariablesContainer" type="VBoxContainer" parent="."] +unique_name_in_owner = true +offset_left = 8.0 +offset_top = 8.0 +offset_right = 292.0 +offset_bottom = 134.0 + +[connection signal="about_to_popup" from="." to="." method="_on_about_to_popup"] +[connection signal="confirmed" from="." to="." method="_on_confirmed"] diff --git a/addons/block_code/ui/picker/categories/variable_category/variable_category_display.gd b/addons/block_code/ui/picker/categories/variable_category/variable_category_display.gd index 23a0bd51..f497cea1 100644 --- a/addons/block_code/ui/picker/categories/variable_category/variable_category_display.gd +++ b/addons/block_code/ui/picker/categories/variable_category/variable_category_display.gd @@ -7,6 +7,7 @@ const VariableDefinition = preload("res://addons/block_code/code_generation/vari @onready var h_separator := %HSeparator signal variable_created(variable: VariableDefinition) +signal variables_deleted(variables: Array[String]) func _ready(): @@ -22,3 +23,7 @@ func _update_blocks(): func _on_create_variable(var_name, var_type): variable_created.emit(VariableDefinition.new(var_name, Types.STRING_TO_VARIANT_TYPE[var_type])) + + +func _on_delete_variables(variables): + variables_deleted.emit(variables) diff --git a/addons/block_code/ui/picker/categories/variable_category/variable_category_display.tscn b/addons/block_code/ui/picker/categories/variable_category/variable_category_display.tscn index 955747b4..92d687df 100644 --- a/addons/block_code/ui/picker/categories/variable_category/variable_category_display.tscn +++ b/addons/block_code/ui/picker/categories/variable_category/variable_category_display.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=5 format=3 uid="uid://byne4g2yvdf3"] +[gd_scene load_steps=6 format=3 uid="uid://byne4g2yvdf3"] [ext_resource type="PackedScene" uid="uid://duhpwtfo3k0sk" path="res://addons/block_code/ui/picker/categories/block_category_display.tscn" id="1_vermd"] -[ext_resource type="Script" path="res://addons/block_code/ui/picker/categories/variable_category/variable_category_display.gd" id="2_ggvi7"] +[ext_resource type="Script" uid="uid://d1owr45rep8tx" path="res://addons/block_code/ui/picker/categories/variable_category/variable_category_display.gd" id="2_ggvi7"] [ext_resource type="PackedScene" uid="uid://t0eoc4ekvjr1" path="res://addons/block_code/ui/picker/categories/variable_category/create_variable_button.tscn" id="3_gjvnq"] +[ext_resource type="PackedScene" uid="uid://ba2ckluuotftw" path="res://addons/block_code/ui/picker/categories/variable_category/delete_variables_button.tscn" id="4_ppkk1"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_0m6vh"] @@ -22,4 +23,8 @@ theme_override_styles/separator = SubResource("StyleBoxEmpty_0m6vh") [node name="CreateVariableButton" parent="VBoxContainer" index="3" instance=ExtResource("3_gjvnq")] layout_mode = 2 +[node name="DeleteVariablesButton" parent="VBoxContainer" index="4" instance=ExtResource("4_ppkk1")] +layout_mode = 2 + [connection signal="create_variable" from="VBoxContainer/CreateVariableButton" to="." method="_on_create_variable"] +[connection signal="delete_variables" from="VBoxContainer/DeleteVariablesButton" to="." method="_on_delete_variables"] diff --git a/addons/block_code/ui/picker/picker.gd b/addons/block_code/ui/picker/picker.gd index 92ffafdf..b09a4b56 100644 --- a/addons/block_code/ui/picker/picker.gd +++ b/addons/block_code/ui/picker/picker.gd @@ -26,6 +26,7 @@ const CATEGORY_ORDER_OVERRIDE = { signal block_picked(block: Block, offset: Vector2) signal variable_created(variable: VariableDefinition) +signal variables_deleted(variables: Array[String]) @onready var _context := BlockEditorContext.get_default() @@ -120,6 +121,7 @@ func _get_or_create_block_category_display(category: BlockCategory) -> BlockCate else: block_category_display = VariableCategoryDisplayScene.instantiate() block_category_display.variable_created.connect(func(variable): variable_created.emit(variable)) + block_category_display.variables_deleted.connect(func(variables): variables_deleted.emit(variables)) block_category_display.title = category.name if category else "" block_category_display.block_picked.connect(func(block: Block, offset: Vector2): block_picked.emit(block, offset))