addon for remapping inputs
classified. i give in to gip#5886
bendn 2022-12-08
parent 3a0ca19 · commit a9edea7
-rw-r--r--README.md48
-rw-r--r--Test.tscn9
-rw-r--r--addons/remap/ActionLabel.gd1
-rw-r--r--addons/remap/README.md48
-rw-r--r--addons/remap/RemapButton.gd1
-rw-r--r--addons/remap/icons/action_icon.svg2
-rw-r--r--addons/remap/icons/action_label.svg53
-rw-r--r--addons/remap/icons/remap_button.svg2
-rw-r--r--addons/remap/package.json2
-rw-r--r--project.godot16
10 files changed, 118 insertions, 64 deletions
diff --git a/README.md b/README.md
index 4abbe2c..1e5831c 100644
--- a/README.md
+++ b/README.md
@@ -33,3 +33,51 @@ label.action = "ui_left"
label._name = "left"
add_child(label)
```
+
+## Installation
+
+<details open>
+ <summary>With the Godot Package Manager</summary>
+
+> **Note** The information here may not be up to date. For most up to date information, see [you-win/gpm#using-packages](https://github.com/you-win/godot-package-manager#using-packages-quickstart)
+
+> **Warning** This addon is not compatible with being used as a sub addon(a addon to another addon), as it uses classes.
+
+This addon is installable via the [gpm](https://github.com/you-win/godot-package-manager).
+To install, create a `godot.package` file.
+It should look something like this.
+
+```json
+{
+ "packages": {
+ "@bendn/remap": "1.0.0"
+ }
+}
+```
+
+Change `1.0.0` to whatever version you want to use.
+Then, clone the repo(`git clone --depth 1 https://github.com/you-win/godot-package-manager`),
+move the `./godot-package-manager/addons/godot-package-manager` folder to your `addons` folder(`mkdir addons && mv ./godot-package-manager/addons/godot-package-manager adons/`).
+
+Downloading addons:
+
+- For godot4:
+ Open the terminal, and run this:
+
+ ```bash
+ godot --headless -s ./addons/godot-package-manager/cli.gd --update
+ ```
+
+ Ignore any errors produced, as long as it says "Finished".
+
+- For godot3:
+ Open the godot editor, and click on the godot-package-manager tab, then press update.
+
+</details>
+<details>
+ <summary>Manually</summary>
+
+- Clone the repo(`git clone --depth 1 https://github.com/bend-n/remap`).
+- Move the `remap/addons/remap` folder into your `addons` folder(`mkdir addons && mv remap/addons/remap addons/`)
+
+</details>
diff --git a/Test.tscn b/Test.tscn
index 8d9fb14..a2359a9 100644
--- a/Test.tscn
+++ b/Test.tscn
@@ -14,17 +14,11 @@ theme = ExtResource("1_cy8qq")
[node name="v" type="GridContainer" parent="."]
layout_mode = 2
-offset_left = 474.0
-offset_top = 274.0
-offset_right = 678.0
-offset_bottom = 374.0
columns = 5
[node name="actionlabel" type="HBoxContainer" parent="v"]
custom_minimum_size = Vector2(100, 100)
layout_mode = 2
-offset_right = 100.0
-offset_bottom = 100.0
script = ExtResource("4")
_name = "left"
action = "input"
@@ -34,9 +28,6 @@ font_size = 50
[node name="remapbutton" type="HBoxContainer" parent="v"]
custom_minimum_size = Vector2(100, 100)
layout_mode = 2
-offset_left = 104.0
-offset_right = 204.0
-offset_bottom = 100.0
script = ExtResource("2_dj1bu")
_name = "left"
action = "input"
diff --git a/addons/remap/ActionLabel.gd b/addons/remap/ActionLabel.gd
index 2d7ebe4..e04f419 100644
--- a/addons/remap/ActionLabel.gd
+++ b/addons/remap/ActionLabel.gd
@@ -1,6 +1,7 @@
## A action label. Displays the inputevents for a action, with a label.
extends HBoxContainer
+class_name ActionLabel
@icon("./icons/action_label.svg")
const IconMap := preload("./private/IconMap.gd")
diff --git a/addons/remap/README.md b/addons/remap/README.md
index 709a45b..4274e7e 100644
--- a/addons/remap/README.md
+++ b/addons/remap/README.md
@@ -32,3 +32,51 @@ label.action = "ui_left"
label._name = "left"
add_child(label)
```
+
+## Installation
+
+<details open>
+ <summary>With the Godot Package Manager</summary>
+
+> **Note** The information here may not be up to date. For most up to date information, see [you-win/gpm#using-packages](https://github.com/you-win/godot-package-manager#using-packages-quickstart)
+
+> **Warning** This addon is not compatible with being used as a sub addon(a addon to another addon), as it uses classes.
+
+This addon is installable via the [gpm](https://github.com/you-win/godot-package-manager).
+To install, create a `godot.package` file.
+It should look something like this.
+
+```json
+{
+ "packages": {
+ "@bendn/remap": "1.0.0"
+ }
+}
+```
+
+Change `1.0.0` to whatever version you want to use.
+Then, clone the repo(`git clone --depth 1 https://github.com/you-win/godot-package-manager`),
+move the `./godot-package-manager/addons/godot-package-manager` folder to your `addons` folder(`mkdir addons && mv ./godot-package-manager/addons/godot-package-manager adons/`).
+
+Downloading addons:
+
+- For godot4:
+ Open the terminal, and run this:
+
+ ```bash
+ godot --headless -s ./addons/godot-package-manager/cli.gd --update
+ ```
+
+ Ignore any errors produced, as long as it says "Finished".
+
+- For godot3:
+ Open the godot editor, and click on the godot-package-manager tab, then press update.
+
+</details>
+<details>
+ <summary>Manually</summary>
+
+- Clone the repo(`git clone --depth 1 https://github.com/bend-n/remap`).
+- Move the `remap/addons/remap` folder into your `addons` folder(`mkdir addons && mv remap/addons/remap addons/`)
+
+</details>
diff --git a/addons/remap/RemapButton.gd b/addons/remap/RemapButton.gd
index 5fc8a69..9f06735 100644
--- a/addons/remap/RemapButton.gd
+++ b/addons/remap/RemapButton.gd
@@ -1,6 +1,7 @@
## Provides a button that allows remapping [InputEventAction]s.
extends HBoxContainer
+class_name RemapButton
@icon("./icons/remap_button.svg")
const ActionIcons := preload("./private/ActionIcons.gd")
diff --git a/addons/remap/icons/action_icon.svg b/addons/remap/icons/action_icon.svg
index 467602e..e09082b 100644
--- a/addons/remap/icons/action_icon.svg
+++ b/addons/remap/icons/action_icon.svg
@@ -1 +1 @@
-<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M8 2a6 6 0 0 0-6 6 6 6 0 0 0 6 6 6 6 0 0 0 6-6 6 6 0 0 0-6-6Zm0 2a4 4 0 0 1 4 4 4 4 0 0 1-4 4 4 4 0 0 1-4-4 4 4 0 0 1 4-4Z" fill="#8eef97"/><path d="M10.008 9.939H8.974l-.268-.784H7.269L7 9.94H5.992l1.433-3.878h1.15zM8.464 8.444l-.477-1.39-.476 1.39Z" aria-label="A" style="font-weight:700;font-size:5.33333px;line-height:1.25;font-family:Verdana;-inkscape-font-specification:'Verdana Bold';letter-spacing:2px;fill:#8eef97;stroke:#8eef97;stroke-width:.2"/></svg> \ No newline at end of file
+<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M8 2a6 6 0 0 0-6 6 6 6 0 0 0 6 6 6 6 0 0 0 6-6 6 6 0 0 0-6-6Zm0 2a4 4 0 0 1 4 4 4 4 0 0 1-4 4 4 4 0 0 1-4-4 4 4 0 0 1 4-4Z" fill="#8eef97"/><path d="M10.32 9.906H9.125L8.815 9h-1.66l-.31.907H5.68l1.656-4.48h1.328ZM8.536 8.179l-.551-1.607-.55 1.607z" aria-label="A" style="font-weight:700;font-size:5.33333px;line-height:1.25;font-family:Verdana;-inkscape-font-specification:'Verdana Bold';letter-spacing:2px;fill:#8eef97;stroke:#8eef97;stroke-width:.231092"/></svg> \ No newline at end of file
diff --git a/addons/remap/icons/action_label.svg b/addons/remap/icons/action_label.svg
index 5de9a33..3f36026 100644
--- a/addons/remap/icons/action_label.svg
+++ b/addons/remap/icons/action_label.svg
@@ -1,52 +1 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- height="16"
- viewBox="0 0 16 16"
- width="16"
- version="1.1"
- id="svg4"
- sodipodi:docname="action_label.svg"
- inkscape:version="1.2.1 (9c6d41e410, 2022-07-14, custom)"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:svg="http://www.w3.org/2000/svg">
- <defs
- id="defs8" />
- <sodipodi:namedview
- id="namedview6"
- pagecolor="#505050"
- bordercolor="#ffffff"
- borderopacity="1"
- inkscape:showpageshadow="0"
- inkscape:pageopacity="0"
- inkscape:pagecheckerboard="1"
- inkscape:deskcolor="#505050"
- showgrid="false"
- inkscape:zoom="9.4933989"
- inkscape:cx="-18.907875"
- inkscape:cy="30.758214"
- inkscape:window-width="1920"
- inkscape:window-height="1025"
- inkscape:window-x="0"
- inkscape:window-y="55"
- inkscape:window-maximized="1"
- inkscape:current-layer="svg4" />
- <path
- id="path2"
- d="M 6 3 A 1.0001 1.0001 0 0 0 5.2929688 3.2929688 L 1.2929688 7.2929688 A 1.0001 1.0001 0 0 0 1.2929688 8.7070312 L 5.2929688 12.707031 A 1.0001 1.0001 0 0 0 6 13 L 14 13 A 1.0001 1.0001 0 0 0 15 12 L 15 4 A 1.0001 1.0001 0 0 0 14 3 L 6 3 z M 10.902344 5.0742188 A 2.9254353 2.9254353 0 0 1 13.826172 8 A 2.9254353 2.9254353 0 0 1 10.902344 10.925781 A 2.9254353 2.9254353 0 0 1 7.9765625 8 A 2.9254353 2.9254353 0 0 1 10.902344 5.0742188 z M 5 7 A 1 1 0 0 1 6 8 A 1 1 0 0 1 5 9 A 1 1 0 0 1 4 8 A 1 1 0 0 1 5 7 z "
- style="fill:#8eef97;fill-opacity:1" />
- <g
- id="g443-3"
- transform="matrix(0.37008351,0,0,0.36026328,3.3156431,3.6702108)">
- <path
- d="m 20.500831,6.0177285 a 6,6 0 0 0 -6,6.0000005 6,6 0 0 0 6,5.999999 6,6 0 0 0 6,-5.999999 6,6 0 0 0 -6,-6.0000005 z m 0,2 a 4,4 0 0 1 4,4.0000005 4,4 0 0 1 -4,3.999999 4,4 0 0 1 -4,-3.999999 4,4 0 0 1 4,-4.0000005 z"
- fill="#8eef97"
- id="path287-5" />
- <path
- d="m 22.508831,13.956729 h -1.034 l -0.268,-0.784001 h -1.437 l -0.269,0.785 h -1.008 l 1.433,-3.877999 h 1.15 z m -1.544,-1.495 -0.477,-1.390001 -0.476,1.390001 z"
- aria-label="A"
- style="font-weight:700;font-size:5.33333px;line-height:1.25;font-family:Verdana;-inkscape-font-specification:'Verdana Bold';letter-spacing:2px;fill:#8eef97;stroke:#8eef97;stroke-width:0.2"
- id="path289-6" />
- </g>
-</svg>
+<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path style="fill:#8eef97;fill-opacity:1;stroke-width:1.15168" d="M6.569 1.187c-.578 0-1.124.265-1.48.72l-3.452 4.41a2.652 2.652 0 0 0-.565 1.635v.096c0 .593.2 1.169.565 1.635l3.452 4.41c.356.455.902.72 1.48.72h7.444c.505 0 .915-.41.915-.915V2.102a.915.915 0 0 0-.915-.915zm2.751 1.92A4.892 4.892 0 0 1 14.213 8a4.892 4.892 0 0 1-4.893 4.892A4.892 4.892 0 0 1 4.428 8 4.892 4.892 0 0 1 9.32 3.108ZM2.716 6.974A1.028 1.028 0 0 1 3.744 8a1.028 1.028 0 0 1-1.028 1.027A1.028 1.028 0 0 1 1.69 8a1.028 1.028 0 0 1 1.027-1.027Z"/><path d="M12.18 10.204h-1.473l-.381-1.117H8.28l-.383 1.118H6.462l2.04-5.52h1.637Zm-2.2-2.129-.679-1.979-.677 1.98Z" aria-label="A" style="font-weight:700;font-size:5.33333px;line-height:1.25;font-family:Verdana;-inkscape-font-specification:'Verdana Bold';letter-spacing:2px;fill:#8eef97;stroke:#8eef97;stroke-width:.284719"/></svg> \ No newline at end of file
diff --git a/addons/remap/icons/remap_button.svg b/addons/remap/icons/remap_button.svg
index 9034fce..37562f2 100644
--- a/addons/remap/icons/remap_button.svg
+++ b/addons/remap/icons/remap_button.svg
@@ -1 +1 @@
-<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M5.5 9.43c-.831 0-1.5.668-1.5 1.5v1.5H2v2h12v-2h-2v-1.5c0-.832-.669-1.5-1.5-1.5zM8 1.57a3.503 3.503 0 0 0-3.503 3.504A3.503 3.503 0 0 0 8 8.578a3.503 3.503 0 0 0 3.503-3.504A3.503 3.503 0 0 0 8 1.571zm0 1.17a2.336 2.336 0 0 1 2.336 2.335A2.336 2.336 0 0 1 8 7.41a2.336 2.336 0 0 1-2.336-2.336A2.336 2.336 0 0 1 8 2.74z" fill="#8eef97"/><path d="M10.008 4.255H8.974l-.268-.784H7.269L7 4.256H5.992L7.425.378h1.15zM8.464 2.76l-.477-1.39-.476 1.39z" aria-label="A" style="font-weight:700;font-size:5.33333px;line-height:1.25;font-family:Verdana;-inkscape-font-specification:'Verdana Bold';letter-spacing:2px;fill:#8eef97;stroke:#8eef97;stroke-width:.2" transform="translate(3.329 3.722) scale(.5839)"/></svg> \ No newline at end of file
+<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M5.633 11.65c-.659 0-1.19.53-1.19 1.19v1.19H2.857v1.586h9.519V14.03h-1.587v-1.19c0-.66-.53-1.19-1.19-1.19z" fill="#8eef97" style="stroke-width:.793212"/><path d="M8 .384a5.273 5.273 0 0 0-5.273 5.273A5.273 5.273 0 0 0 8 10.931a5.273 5.273 0 0 0 5.273-5.274A5.273 5.273 0 0 0 8 .384Zm0 1.758a3.516 3.516 0 0 1 3.516 3.515A3.516 3.516 0 0 1 8 9.173a3.516 3.516 0 0 1-3.516-3.516A3.516 3.516 0 0 1 8 2.142Z" fill="#8eef97" style="stroke-width:.878916"/><path d="M10.15 7.547H9.043l-.287-.84H7.217l-.288.84h-1.08l1.535-4.153h1.232zM8.497 5.945l-.51-1.488-.51 1.488Z" aria-label="A" style="font-weight:700;font-size:5.33333px;line-height:1.25;font-family:Verdana;-inkscape-font-specification:'Verdana Bold';letter-spacing:2px;fill:#8eef97;stroke:#8eef97;stroke-width:.214193"/></svg> \ No newline at end of file
diff --git a/addons/remap/package.json b/addons/remap/package.json
index e09825a..cc7057d 100644
--- a/addons/remap/package.json
+++ b/addons/remap/package.json
@@ -1,6 +1,6 @@
{
"name": "@bendn/remap",
- "version": "4.2.2",
+ "version": "5.0.2",
"description": "godot input remapping",
"main": "InteractiveActionLabel.gd",
"scripts": {
diff --git a/project.godot b/project.godot
index e8a4ed5..6e6c7b3 100644
--- a/project.godot
+++ b/project.godot
@@ -8,6 +8,22 @@
config_version=5
+_global_script_classes=[{
+"base": "HBoxContainer",
+"class": &"ActionLabel",
+"language": &"GDScript",
+"path": "res://addons/remap/ActionLabel.gd"
+}, {
+"base": "HBoxContainer",
+"class": &"RemapButton",
+"language": &"GDScript",
+"path": "res://addons/remap/RemapButton.gd"
+}]
+_global_script_class_icons={
+"ActionLabel": "res://addons/remap/icons/action_label.svg",
+"RemapButton": "res://addons/remap/icons/remap_button.svg"
+}
+
[application]
config/name="test"