-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
@export var with different name instead of variable name #10973
Comments
What you can currently is have proxy parameters. @export var foo:
set(new_value):
_internal_foo = new_value
get:
return _internal_foo
Side Note: They're useful for properties that are connected, because if each property sets the other, that can cause an infinite loop of setters. |
The current implementation has bugs: Exclusion may be achieved by determining the types of the two property editors. # plugin.gd
@tool
extends EditorPlugin
var ip: EditorInspectorPlugin = load("res://addons/exportname/inspectorPlugin.gd").new()
func _enter_tree():
add_inspector_plugin(ip)
func _exit_tree():
remove_inspector_plugin(ip) # inspectorPlugin.gd
@tool
extends EditorInspectorPlugin
var replaces = {}
func _can_handle(object):
if object is Node:
return true
func _parse_property(object, type, name, hint_type, hint_string, usage_flags, wide):
var export_name = hint_string.split("$")
if export_name.size() > 2:
replaces[name] = export_name[1]
func _parse_end(object):
replacePropertyEditor()
func replacePropertyEditor():
var eps = EditorInterface.get_inspector().find_children("*", "EditorProperty", true, false)
for ep in eps:
if replaces.has(ep.get_edited_property()):
ep.label = replaces[ep.get_edited_property()] |
i would suggest maybe an even shorter way like this if its possible:
this example (adding a unit to my variable name in editor) is where i first was looking if this is possible. |
nevermind. i found an existing solution for my topic: @export_custom(PROPERTY_HINT_NONE, "suffix:sec") var useDelay:float |
Describe the project you are working on
2D/3D Game
Describe the problem or limitation you are having in your project
Export variable name can be too long, especially in
@export_group
, short name would be better.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Give option to have different export name instead of var name.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Something like
If this enhancement will not be used often, can it be worked around with a few lines of script?
Currently probably there's no option to give different name to export var.
Is there a reason why this should be core and not an add-on in the asset library?
If it is able to implement this with addons, please teach me the way.
(This proposal is just same as godotengine/godot#4222)
The text was updated successfully, but these errors were encountered: