4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
10.83k stars 850 forks source link

Allow copy/paste of parameters inside an extension function #3545

Closed tristanbob closed 2 years ago

tristanbob commented 2 years ago

Description

GDevelop lets you copy/paste a LOT of things (scenes, functions, extensions, objects, events, etc).
However, it does NOT let you copy function parameters.

Some parameters can get very long when they have a list of strings to choose from (for example, a list of all tween options). Having the ability to copy/paste function parameters will speed up extension development.

Solution suggested

1) User is editing a function in the extension editor. 2) The "PARAMETERS" tab is open. 3) User clicks on the three stacked dots on the right-side of a parameter. 4) They get the same "Copy/Cut/Paste" that is used for things like functions/behaviors/scenes 5) After copy/pasting a parameter, a new copy is inserted that has a unique parameter name.

Screenshot 2022-01-23 192710

D8H commented 2 years ago

As a workaround, to avoid you a repetitive tasks while this feature is implemented, the parameter can be copy paste with a text editor.

This is a parameter with choices that can be copy:

                {
                  "codeOnly": false,
                  "defaultValue": "",
                  "description": "Easing",
                  "longDescription": "",
                  "name": "Easing",
                  "optional": false,
                  "supplementaryInformation": "[\"linear\",\"easeInQuad\",\"easeOutQuad\",\"easeInOutQuad\",\"easeInCubic\",\"easeOutCubic\",\"easeInOutCubic\",\"easeInQuart\",\"easeOutQuart\",\"easeInOutQuart\",\"easeInQuint\",\"easeOutQuint\",\"easeInOutQuint\",\"easeInOutSine\",\"easeInExpo\",\"easeOutExpo\",\"easeInOutExpo\",\"easeInCirc\",\"easeOutCirc\",\"easeInOutCirc\",\"easeOutBounce\",\"easeInBack\",\"easeOutBack\",\"easeInOutBack\",\"elastic\",\"swingFromTo\",\"swingFrom\",\"swingTo\",\"bounce\",\"bouncePast\",\"easeFromTo\",\"easeFrom\",\"easeTo\"]",
                  "type": "stringWithSelector"
                }

This is a function definition where parameters can be paste:

            {
              "description": "Cancel last drag",
              "fullName": "Cancel drag",
              "functionType": "Action",
              "name": "CancelLastDragging",
              "private": false,
              "sentence": "Cancel last dragging of _PARAM0_ in _PARAM2_ ms with easing _PARAM3_",
              "events": [],
              "parameters": []
4ian commented 2 years ago

Indeed we could add copy/paste or a "Replace with list from..." menu item that shows the names of other parameters of other functions (like "Parameter XXX from function/behavior method YYY") and when one is chosen, replace the list with it. So that keep lists in sync is only a few clicks.