-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Display enum name next to its value in the Remote Inspector #255
Comments
I'm guessing this applies to the remote inspector; in the local one you can set an export type to either a built-in or named enum and get this capability. In that case, the value is masked and the name is used in the inspector. In that instance, Showing only the name of an enum value and not the value itself is not usually an issue as the labels often exist not just for syntactic convenience but also to help future-proof code. |
/signed I'm starting to think that the person who added enums to Godot doesn't even understand why programmers like the concept of enums. They seem so broken and there isn't a fully satisfactory workaround for their jank. Having to declare every enumerated value's name again every time you export a var that uses that enum is ridiculous. |
@frozenMustelid Nobody contributes to Godot specifically to annoy others 🙂 I have to remind you that we have a Code of Conduct. Please stay constructive. |
I'm running into this inconvenience also. I wouldn't call it an issue but it's a feature I'd really like to see so I don't have to make my own debugger in cases where I have dictionaries of enums that are time consuming to decipher. |
I'll join in here - it would be very helpful to be able to find out the name for enum values in a simple way. Not only specifically in the remote inspector, but generally. Another use case:
func e_name(key: int) -> String:
return MyEnum.keys()[key] Perhaps part of the solution to the above problem could be a revision of the enums to allow such functionality, or at least derive the name of an enum from the type (e.g. MyEnum.toString() -> “MyEnum” or something). |
func enum_to_enum_name(enum_dict:Dictionary, enum_int:int) -> String:
var enum_name : String = ""
var keys : Array = enum_dict.keys()
for key in keys:
if enum_dict[key] == enum_int:
enum_name = key
break
return enum_name.capitalize() (I wrote it a long time ago, I don't think it needs a for loop in it) |
Thanks @PLyczkowski for your answer. It helped me a lot to develop an even more generic solution where I assign universally unique integers to every value and then use this function: func e_name(key: int) -> String:
var all_enums: Array[Dictionary] = [MyType, MyOtherType, MyNewType]
var result: String
for dict in all_enums:
for name in dict.keys():
if dict[name] == key:
result = name
break
return result Could probably be tweak concerning efficiency, but since the enums never contain more then 6-7 values, I don't care too much. |
Hey, I just noticed that the regular inspector displays enum names, when you hover over an exported variable. On the other hand the remote inspector doesn't show descriptions, regardless of the variable type A workaround is that you can add @export to the variable and during debugging, scroll down to the script parameters (below the members section) |
Describe the problem or limitation you are having in your project:
During debugging, it's slow to have to check what the value of an enum means in my code by searching for the enum declaration.
Describe how this feature / enhancement will help you overcome this problem or limitation:
This feature would tell me instantly what a value of an enum means.
Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
If this enhancement will not be used often, can it be worked around with a few lines of script?:
Not really, it's low level editor code I'm guessing.
Is there a reason why this should be core and not an add-on in the asset library?:
There are now drawback to this being core as far as I can see.
The text was updated successfully, but these errors were encountered: