Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smartly create a new variable when Ctrl-dropping a resource in an empty script line #7673

Closed
mieldepoche opened this issue Sep 15, 2023 · 5 comments · Fixed by godotengine/godot#81708

Comments

@mieldepoche
Copy link

Describe the project you are working on

trying things in godot

Describe the problem or limitation you are having in your project

In this clip, I drop first a node and then a resource while holding Ctrl.

simplescreenrecorder-2023-09-15_15.21.48.webm

One of those cases create a variable for you, the other doesn't.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

When holding Ctrl and dropping a resource from the filesystem on an empty line in a script, automatically create a variable in a similar way.

The type should be as narrow as possible (and should include user-defined resources).
If dropped on an non-empty line, the current behavior should apply.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

simplescreenrecorder-2023-09-15_15.41.30.webm

If this enhancement will not be used often, can it be worked around with a few lines of script?

it allows saving a bit of typing and it's a consistency improvment

Is there a reason why this should be core and not an add-on in the asset library?

small ux improvement

@JoNax97
Copy link

JoNax97 commented Sep 15, 2023

I'd like to tackle this one if that's ok 👍

@Calinou
Copy link
Member

Calinou commented Sep 15, 2023

I'd like to tackle this one if that's ok 👍

Feel free to open a pull request for this 🙂

@nubels
Copy link

nubels commented Sep 25, 2023

Great idea! I think the scene should be saved as a constant in UPPER_CASE, though.

@JoNax97
Copy link

JoNax97 commented Sep 25, 2023

Now that I think about it, why would always assume that the correct action is to preload into a constant?

Isn't loading into a variable an equally valid option?
At any rate, it makes less assumptions about user intent.

@nubels
Copy link

nubels commented Sep 25, 2023

Now that I think about it, why would always assume that the correct action is to preload into a constant?

Isn't loading into a variable an equally valid option? At any rate, it makes less assumptions about user intent.

I think loaded scenes are a good examples for immutability but maybe I'm wrong. Could you please give me an example where it would make sense to change the value of a variable that was initialized with a preload?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants