You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
TextureEditorPlugin: Add borders to 3D and Layered editors
This commit is contained in:
@@ -83,9 +83,8 @@ void Texture3DEditor::_notification(int p_what) {
|
||||
|
||||
case NOTIFICATION_DRAW: {
|
||||
Ref<Texture2D> checkerboard = get_editor_theme_icon(SNAME("Checkerboard"));
|
||||
Size2 size = get_size();
|
||||
|
||||
draw_texture_rect(checkerboard, Rect2(Point2(), size), true);
|
||||
draw_texture_rect(checkerboard, texture_rect->get_rect(), true);
|
||||
_draw_outline();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
@@ -93,6 +92,7 @@ void Texture3DEditor::_notification(int p_what) {
|
||||
Ref<Font> metadata_label_font = get_theme_font(SNAME("expression"), EditorStringName(EditorFonts));
|
||||
info->add_theme_font_override(SceneStringName(font), metadata_label_font);
|
||||
}
|
||||
theme_cache.outline_color = get_theme_color(SNAME("extra_border_color_1"), EditorStringName(Editor));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@@ -120,6 +120,12 @@ void Texture3DEditor::_update_material(bool p_texture_changed) {
|
||||
material->set_shader_parameter("u_channel_factors", channel_selector->get_selected_channel_factors());
|
||||
}
|
||||
|
||||
void Texture3DEditor::_draw_outline() {
|
||||
const float outline_width = Math::round(EDSCALE);
|
||||
const Rect2 outline_rect = texture_rect->get_rect().grow(outline_width * 0.5);
|
||||
draw_rect(outline_rect, theme_cache.outline_color, false, outline_width);
|
||||
}
|
||||
|
||||
void Texture3DEditor::_make_shaders() {
|
||||
shader.instantiate();
|
||||
shader->set_code(texture_3d_shader);
|
||||
@@ -149,7 +155,7 @@ void Texture3DEditor::_texture_rect_update_area() {
|
||||
int ofs_x = (size.width - tex_width) / 2;
|
||||
int ofs_y = (size.height - tex_height) / 2;
|
||||
|
||||
texture_rect->set_position(Vector2(ofs_x, ofs_y));
|
||||
texture_rect->set_position(Vector2(ofs_x, ofs_y - Math::round(EDSCALE)));
|
||||
texture_rect->set_size(Vector2(tex_width, tex_height));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user