Commit: afab33e0b97cc5e5278c3e8af5490b9583c3b95c Author: Jeroen Bakker Date: Wed Oct 7 16:29:15 2020 +0200 Branches: master https://developer.blender.org/rBafab33e0b97cc5e5278c3e8af5490b9583c3b95c
UV/Image Editor: Overlay Popover The overlay options in the image/uv editor is hidden in side panels and menus. Sometimes this panel is even hidden, while still useful. The goal of this task is to introduce an overlay pop-over just like the overlay-popover of the 3d viewport. Popover has * UV Stretching (only available in the UV mode, when active object mode is a mesh and in OB_EDIT mode) * Display As (only available in the UV mode, when active object mode is a mesh and in OB_EDIT mode) * Show Modified (only available in the UV mode, when active object mode is a mesh and in OB_EDIT mode) * Show UV Edges (including opacity slider; available UV, View, Paint, when active object mode is a mesh and in OB_EDIT mode) * Udim tiles when no image is available. Like the 3d viewport, there will be a editor toggle to enable/disable the overlays For compatibility reasons the RNA properties are added to both the `SpaceImage.uv_editor` amd `SpaceImage.overlay`. On DNA level they are still stored in the SpaceImage. only new properties are added to the SpaceImageOverlay struct. During the next major release we could remove these options from `SpaceImage.uv_editor`. This should be noted in the Python section of release notes. Reviewed By: Julian Eisel, Pablo Vazquez Differential Revision: https://developer.blender.org/D8890 =================================================================== M release/scripts/startup/bl_ui/space_image.py M source/blender/blenloader/intern/versioning_290.c M source/blender/draw/engines/overlay/overlay_edit_uv.c M source/blender/draw/engines/overlay/overlay_engine.c M source/blender/draw/engines/overlay/overlay_private.h M source/blender/draw/intern/draw_view.c M source/blender/editors/space_image/space_image.c M source/blender/makesdna/DNA_space_types.h M source/blender/makesrna/RNA_access.h M source/blender/makesrna/intern/rna_space.c =================================================================== diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 300f367ab27..9c6ad39e25b 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -742,6 +742,7 @@ class IMAGE_HT_header(Header): layout = self.layout sima = context.space_data + overlay = sima.overlay ima = sima.image iuser = sima.image_user tool_settings = context.tool_settings @@ -787,6 +788,13 @@ class IMAGE_HT_header(Header): layout.separator_spacer() + # Overlay toggle & popover + row = layout.row(align=True) + row.prop(overlay, "show_overlays", icon='OVERLAY', text="") + sub = row.row(align=True) + sub.active = overlay.show_overlays + sub.popover(panel="IMAGE_PT_overlay", text="") + if show_uvedit: uvedit = sima.uv_editor @@ -994,68 +1002,6 @@ class IMAGE_PT_view_display(Panel): col.prop(uvedit, "show_pixel_coords", text="Pixel Coordinates") -class IMAGE_PT_view_display_uv_edit_overlays(Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' - bl_label = "Overlays" - bl_parent_id = 'IMAGE_PT_view_display' - bl_category = "View" - bl_options = {'DEFAULT_CLOSED'} - - @classmethod - def poll(cls, context): - sima = context.space_data - return (sima and (sima.show_uvedit)) - - def draw(self, context): - layout = self.layout - layout.use_property_split = True - layout.use_property_decorate = False - - sima = context.space_data - uvedit = sima.uv_editor - - col = layout.column() - - col.prop(uvedit, "edge_display_type", text="Display As") - col.prop(uvedit, "show_faces", text="Faces") - - col = layout.column() - if context.preferences.experimental.use_image_editor_legacy_drawing: - col.prop(uvedit, "show_smooth_edges", text="Smooth") - col.prop(uvedit, "show_modified_edges", text="Modified") - col.prop(uvedit, "uv_opacity") - - -class IMAGE_PT_view_display_uv_edit_overlays_stretch(Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' - bl_label = "Stretching" - bl_parent_id = 'IMAGE_PT_view_display_uv_edit_overlays' - bl_category = "View" - bl_options = {'DEFAULT_CLOSED'} - - @classmethod - def poll(cls, context): - sima = context.space_data - return (sima and (sima.show_uvedit)) - - def draw_header(self, context): - sima = context.space_data - uvedit = sima.uv_editor - self.layout.prop(uvedit, "show_stretch", text="") - - def draw(self, context): - layout = self.layout - layout.use_property_split = True - - sima = context.space_data - uvedit = sima.uv_editor - - layout.active = uvedit.show_stretch - layout.prop(uvedit, "display_stretch_type", text="Type") - - class IMAGE_UL_render_slots(UIList): def draw_item(self, _context, layout, _data, item, _icon, _active_data, _active_propname, _index): slot = item @@ -1512,6 +1458,119 @@ class IMAGE_PT_udim_grid(Panel): col.prop(uvedit, "tile_grid_shape", text="Grid Shape") +class IMAGE_PT_overlay(Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'HEADER' + bl_label = "Overlays" + bl_ui_units_x = 13 + + def draw(self, context): + pass + + +class IMAGE_PT_overlay_uv_edit(Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'HEADER' + bl_label = "UV Editing" + bl_parent_id = 'IMAGE_PT_overlay' + + @classmethod + def poll(cls, context): + sima = context.space_data + return (sima and (sima.show_uvedit)) + + def draw(self, context): + layout = self.layout + + sima = context.space_data + uvedit = sima.uv_editor + overlay = sima.overlay + + layout.active = overlay.show_overlays + + # UV Stretching + row = layout.row() + row.prop(uvedit, "show_stretch") + subrow = row.row(align=True) + subrow.active = uvedit.show_stretch + subrow.prop(uvedit, "display_stretch_type", text="") + + + +class IMAGE_PT_overlay_uv_edit_geometry(Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'HEADER' + bl_label = "Geometry" + bl_parent_id = 'IMAGE_PT_overlay' + + @classmethod + def poll(cls, context): + sima = context.space_data + return (sima and (sima.show_uvedit)) + + def draw(self, context): + layout = self.layout + + sima = context.space_data + uvedit = sima.uv_editor + overlay = sima.overlay + + layout.active = overlay.show_overlays + + # Edges + col = layout.column() + col.prop(uvedit, "uv_opacity") + col.prop(uvedit, "edge_display_type", text="") + if context.preferences.experimental.use_image_editor_legacy_drawing: + col.prop(uvedit, "show_smooth_edges", text="Smooth") + col.prop(uvedit, "show_modified_edges", text="Modified Edges") + + # Faces + row = col.row() + row.active = not uvedit.show_stretch + row.prop(uvedit, "show_faces", text="Faces") + + + +class IMAGE_PT_overlay_texture_paint(Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'HEADER' + bl_label = "Geometry" + bl_parent_id = 'IMAGE_PT_overlay' + + @classmethod + def poll(cls, context): + sima = context.space_data + return (sima and (sima.show_paint)) + + def draw(self, context): + layout = self.layout + + sima = context.space_data + uvedit = sima.uv_editor + overlay = sima.overlay + + layout.active = overlay.show_overlays + layout.prop(uvedit, "show_texpaint") + + +class IMAGE_PT_overlay_image(Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'HEADER' + bl_label = "Image" + bl_parent_id = 'IMAGE_PT_overlay' + + def draw(self, context): + layout = self.layout + + sima = context.space_data + uvedit = sima.uv_editor + overlay = sima.overlay + + layout.active = overlay.show_overlays + layout.prop(uvedit, "show_metadata") + + # Grease Pencil properties class IMAGE_PT_annotation(AnnotationDataPanel, Panel): bl_space_type = 'IMAGE_EDITOR' @@ -1560,8 +1619,6 @@ classes = ( IMAGE_UL_udim_tiles, IMAGE_PT_udim_tiles, IMAGE_PT_view_display, - IMAGE_PT_view_display_uv_edit_overlays, - IMAGE_PT_view_display_uv_edit_overlays_stretch, IMAGE_PT_paint_select, IMAGE_PT_paint_settings, IMAGE_PT_paint_color, @@ -1587,6 +1644,11 @@ classes = ( IMAGE_PT_uv_cursor, IMAGE_PT_annotation, IMAGE_PT_udim_grid, + IMAGE_PT_overlay, + IMAGE_PT_overlay_uv_edit, + IMAGE_PT_overlay_uv_edit_geometry, + IMAGE_PT_overlay_texture_paint, + IMAGE_PT_overlay_image, ) diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index b9153307d70..520a5da878c 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -806,5 +806,19 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + /* UV/Image show overlay option. */ + if (!DNA_struct_find(fd->filesdna, "SpaceImageOverlay")) { + LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) { + if (space->spacetype == SPACE_IMAGE) { + SpaceImage *sima = (SpaceImage *)space; + sima->overlay.flag = SI_OVERLAY_SHOW_OVERLAYS; + } + } + } + } + } } } diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.c b/source/blender/draw/engines/overlay/overlay_edit_uv.c index bc41042ef02..af20e85a89b 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_uv.c +++ b/source/blender/draw/engines/overlay/overlay_edit_uv.c @@ -78,6 +78,7 @@ void OVERLAY_edit_uv_init(OVERLAY_Data *vedata) SpaceImage *sima = (SpaceImage *)draw_ctx->space_data; const Scene *scene = draw_ctx->scene; const ToolSettings *ts = scene->toolsettings; + const bool show_overlays = !pd->hide_overlays; Image *image = sima->image; /* By design no image is an image type. This so editor shows UV's by default. */ @@ -99,21 +100,20 @@ void OVERLAY_edit_uv_init(OVERLAY_Data *vedata) ((sima->flag & SI_DRAW_STRETCH) != 0); const bool do_tex_paint_shadows = (sima->flag & SI_NO_DRAW_TEXPAINT) == 0; - pd->edit_uv.do_faces = do_faces && !do_uvstretching_overlay; - pd->edit_uv.do_face_dots = do_faces && do_face_dots; - - pd->edit_uv.do_uv_overlay = do_uv_overlay; - pd->edit_uv.do_uv_shadow_overlay = is_image_type && + pd->edit_uv.do_faces = show_overlays && do_faces && !do_uvstretching_overlay; + pd->edit_uv.do_face_dots = show_overlays && do_faces && do_face_dots; + pd->edit_uv.do_uv_overlay = show_overlays && do_uv_overlay; + pd->edit_uv.do_uv_shadow_overlay = show_overlays && is_image_type && ((is_paint_mode && do_tex_paint_shadows && ((draw_ctx->object_mode & (OB_MODE_TEXTURE_PAINT | OB_MODE_EDIT)) != 0)) || (is_view_mode && do_tex_paint_shadows && ((draw_ctx->object_mode & (OB_MODE_TEXTURE_PAINT)) != 0)) || (do_uv_overlay && (show_modified_uvs))); - pd->edit_uv.do_uv_stretching_overlay = do_uvstretching_overlay; + pd->edit_uv.do_uv_stretching_overlay = show_overlays && do_uvstretching_overlay; pd->edit_uv.uv_opacity = sima->uv_opacity; - pd->edit_uv.do_tiled_image_overlay = is_image_type && is_tiled_image; - + pd->edit_uv.do_tiled_image_overlay = show_overlays && is_image_type && is_tiled_image; + pd->edit_uv.do_tiled_image_border_overlay = is_image_type && is_tiled_image; pd- @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
