-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Dragging properties from inspector into code generates code to get the property #8017
Comments
This comment was marked as outdated.
This comment was marked as outdated.
But if I want to |
@aXu-AP No guessing. Either supporting a set or not. To support set we could introduce another modifier key. Yet, the value set would have to be the current value of the property. My current thinking is that could a following proposal and pull request. Perhaps it could be in this one if people really want that. |
People really want that. The original purpose of supporting drag & drop property names into scripts is to make setting AnimationTree parameters easier. |
@timothyqiu In that case help with this, what should be the other modifier? This is the one we have:
It could be Shift, it could be Alt, it could be something else, and I do not know if there is a guideline for this somewhere. |
I think |
Could be Shift. Alt should act as a last resort I believe. Regarding this proposal and #8014, I doubt if we really want to generate such code snippet. Best practices for engine contributors suggests we should only add solutions for real frequent problems. For example
For general properties, I don't know the reason to add such feature. Not knowing the property exists when learning the engine sounds reasonable, but then you won't need this after a few tries.
Regarding this and nested resources. I find it hard to adapt to something like
|
@timothyqiu I can argue that this proposal and all those features you mention do not solve any real problem because you can always type the code. Or, I can argue that it is trying to solve the general problem (so it works for different nodes, unique name, sub resources and so on), which the contributor guidelines recommend against. In fact, in the past, I have convinced myself against making proposals on similar grounds. In the case somehow I convinced myself that if it is not desired, then it won't be merged, and that's fine. Addendum: I'm getting a theme from what you said: autocompletion should be fixed/improved. |
Yeah, the existing drag & drop behavior completes what current autocompletion implementation is not good at :P And onready generation is to alleviate boilerplates. Since autocompletion works fine on general property access, I think this seems unnecessary. But yeah, this is only my personal opinion. The PR itself seems good. |
Describe the project you are working on
None in particular
Describe the problem or limitation you are having in your project
When we drag a property from the inspector to the code editor we get the name of the property between quotes.
However, this ignores the path required to access the property.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I want that when I drag a property from the inspector to the code editor while holding CTRL it will generate code to access the property (including node path), and only quoted if necessary:
Examples:
property_name
$relative/node/path.property_name
%unique_name.property_name
get("property/name")
$relative/node/path.get("property/name")
%unique_name.get("property/name")
Note: this is a counter-proposal to #8014
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
When a property is dragged and dropped from the inspector, get this data:
This is the general algorithm I have come up with:
get(property_name)
property_name
%unique_name
$path.get(property_name)
or%unique_name.get(property_name)
$path.property_name
or%unique_name.property_name
The proposed approach has the following limitation: It cannot generate code for a property of a resource in a sub inspector. I want advice on how to implement this.This has been resolved in the pull request.If this enhancement will not be used often, can it be worked around with a few lines of script?
This is a core feature.
Is there a reason why this should be core and not an add-on in the asset library?
This is a core feature.
The text was updated successfully, but these errors were encountered: