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

[3.x] Add property name style toggle to Inspector #59313

Merged
merged 1 commit into from
Mar 28, 2022

Conversation

timothyqiu
Copy link
Member

@timothyqiu timothyqiu commented Mar 19, 2022

This PR adds a button to the Inspector. It switches among three different property name styles:

Style Preview
Raw http_proxy
Capitalized HTTP Proxy
Localized HTTP 代理

The Inspector defaults to the interface/inspector/default_property_name_style editor setting at startup. This setting defaults to "Capitalized" and it replaces the old interface/inspector/capitalize_properties.

Three Menu Items In Action
ksnip_20220323-104401 Peek 2022-03-23 10-41

Localization is currently disabled for "en":

ksnip_20220323-104429

The previous PR added a interface/editor/translate_properties setting for all properties. This is now replaced by interface/editor/localize_settings to focus on settings. It defaults to true because settings are usually accessed via GUI instead of code. You can still access the path via right click menu or tooltip.

Editor settings take a few seconds to make effect:

Peek 2022-03-19 19-03

The EditorInspector defaults to Capitalized. Common usages such as the import dock and the export dialog are set to honor localize_settings too. The local stack variables inspector in Debugger is kept Raw.


I'll make a PR for master after this is discussed.

@timothyqiu timothyqiu requested review from a team as code owners March 19, 2022 11:43
@Calinou Calinou added this to the 3.5 milestone Mar 19, 2022
@fire-forge
Copy link
Contributor

What do you think about moving the options to this menu instead? The search bar and sub-resource dropdown button having different lengths looks a little odd.

image

If we want to disable the "Localized" option for some languages

Localization could probably be disabled for English since localized and capitalized are the same in that case, right?

@timothyqiu
Copy link
Member Author

timothyqiu commented Mar 20, 2022

Added a blacklist of languages, currently "en" only. It now disables the menu item and adds a tooltip. It also selects Capitalized on startup if you set Localized in Editor Settings for these languages.

ksnip_20220320-111322


The search bar and sub-resource dropdown button having different lengths looks a little odd.

It's also unbalanced a few versions ago ;) I tried locally to move the switch into the properties menu. I think it looks a bit lack of context, maybe wording should be changed? I'll include this if you think it's OK.

ksnip_20220320-120413

@fire-forge
Copy link
Contributor

@timothyqiu yes, I think that's better.

I think it looks a bit lack of context, maybe wording should be changed?

You could add text to the separator right above it that says something like "Property Name Style".

@timothyqiu
Copy link
Member Author

Updated. Moved the menu into the object properties menu. Not sure about the separator, but it can be discussed :)

ksnip_20220320-155045

Comment on lines +470 to +474
if (!EditorPropertyNameProcessor::is_localization_available()) {
const int index = p->get_item_index(PROPERTY_NAME_STYLE_LOCALIZED);
p->set_item_disabled(index, true);
p->set_item_tooltip(index, TTR("Localization not available for current language."));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't seem to work for me on Linux with the en locale, the option is still enabled.

Copy link
Member Author

@timothyqiu timothyqiu Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/godotengine/godot/blob/8ecdb0b6e93e165b030e791366db551c8a5d531f/editor/editor_property_name_processor.cpp#L54-L57

This is based on interface/editor/editor_language. I tried launching the editor using LANG=en_US, the editor setting is "en", and the option is disabled. What's your interface/editor/editor_language?

p.s. Also, it's only the Inspector drop down that will be disabled. The option in editor settings will not be disabled, since it's for default value, independent of editor language.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm I just tested again and it's working fine now, weird.


p->add_separator(TTR("Property Name Style"));
p->add_radio_check_item(TTR("Raw"), PROPERTY_NAME_STYLE_RAW);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel "Raw" might not be very explicit. Maybe "Raw Path" or just "Path"/"Property Path"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only part of a path, i.e. there is no slash in it, more like a snake cased identifier. I think it's confusing to call it Path style.

@akien-mga akien-mga merged commit 3575db7 into godotengine:3.x Mar 28, 2022
@akien-mga
Copy link
Member

Thanks!

@timothyqiu timothyqiu deleted the name-style-3.x branch March 28, 2022 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants