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 support for partial custom editor themes #51648

Merged
merged 1 commit into from
Aug 17, 2021

Conversation

YuriSizov
Copy link
Contributor

@YuriSizov YuriSizov commented Aug 13, 2021

This allows custom editor themes to be incomplete by merging them with the generated theme. This ensures that every theme item expected by the editor exists in some form, and allows custom themes to be more granular. For example:

godot windows tools 64_2021-08-14_00-57-34

This result is achieved with a theme resource that looks something like this:

[gd_resource type="Theme" load_steps=2 format=2]

[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 8.0
content_margin_right = 8.0
content_margin_top = 5.0
content_margin_bottom = 18.0
bg_color = Color( 0.172549, 0.341176, 0.137255, 1 )
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 12
border_color = Color( 0.686275, 0.580392, 0.215686, 1 )

[resource]
Button/styles/normal = SubResource( 1 )

This should address problems like the one shown in #51414. This might also be useful for merging the default theme and the custom project theme for the projects made with Godot so there is less time spent on lookups, but that's a story for another time.


This also removes unnecessary theme operations in the canvas item editor plugin. It was the only place in the engine that relied on copying the theme, which is completely unnecessary. From my superficial testing the operation took 630-640 microseconds and now takes 20. This only happens once, as the editor is created, but it may remove some hitching for some users, I think. Either way, the theming code is better now, plus the styling applied can now be customized with the editor theme.

@akien-mga akien-mga merged commit 53cc7a9 into godotengine:3.x Aug 17, 2021
@akien-mga
Copy link
Member

Thanks!

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.

2 participants