UV: support changing the opacity of the UV stretching overlay #117381
|
@ -1568,10 +1568,10 @@ class IMAGE_PT_overlay_guides(Panel):
|
|||
layout.prop(uvedit, "tile_grid_shape", text="Tiles")
|
||||
|
||||
|
||||
class IMAGE_PT_overlay_uv_edit(Panel):
|
||||
class IMAGE_PT_overlay_uv_stretch(Panel):
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = "UV Editing"
|
||||
bl_label = "UV Stretch"
|
||||
bl_parent_id = "IMAGE_PT_overlay"
|
||||
|
||||
@classmethod
|
||||
|
@ -1588,15 +1588,12 @@ class IMAGE_PT_overlay_uv_edit(Panel):
|
|||
|
||||
layout.active = overlay.show_overlays
|
||||
|
||||
# UV Stretching
|
||||
row = layout.row()
|
||||
row.prop(uvedit, "show_stretch")
|
||||
subrow = row.row(align=True)
|
||||
row = layout.row(align=True)
|
||||
row.row().prop(uvedit, "show_stretch", text="")
|
||||
subrow = row.row()
|
||||
subrow.active = uvedit.show_stretch
|
||||
subrow.prop(uvedit, "display_stretch_type", text="")
|
||||
row = layout.row(align=True)
|
||||
row.active = uvedit.show_stretch
|
||||
row.prop(uvedit, "stretching_opacity")
|
||||
subrow.prop(uvedit, "stretch_opacity", text="Opacity")
|
||||
|
||||
|
||||
class IMAGE_PT_overlay_uv_edit_geometry(Panel):
|
||||
|
@ -1748,7 +1745,7 @@ classes = (
|
|||
IMAGE_PT_gizmo_display,
|
||||
IMAGE_PT_overlay,
|
||||
IMAGE_PT_overlay_guides,
|
||||
IMAGE_PT_overlay_uv_edit,
|
||||
IMAGE_PT_overlay_uv_stretch,
|
||||
IMAGE_PT_overlay_uv_edit_geometry,
|
||||
IMAGE_PT_overlay_texture_paint,
|
||||
IMAGE_PT_overlay_image,
|
||||
|
|
|
@ -2849,13 +2849,13 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 18)) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SpaceImage", "float", "stretching_opacity")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SpaceImage", "float", "stretch_opacity")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
if (sl->spacetype == SPACE_IMAGE) {
|
||||
SpaceImage *sima = (SpaceImage *)sl;
|
||||
sima->stretching_opacity = 1.0f;
|
||||
sima->stretch_opacity = 0.9f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ void OVERLAY_edit_uv_init(OVERLAY_Data *vedata)
|
|||
|
||||
pd->edit_uv.do_uv_stretching_overlay = show_overlays && do_uvstretching_overlay;
|
||||
pd->edit_uv.uv_opacity = sima->uv_opacity;
|
||||
pd->edit_uv.stretching_opacity = sima->stretching_opacity;
|
||||
pd->edit_uv.stretch_opacity = sima->stretch_opacity;
|
||||
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->edit_uv.dash_length = 4.0f * UI_SCALE_FAC;
|
||||
|
@ -286,7 +286,7 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata)
|
|||
DRW_shgroup_uniform_block(pd->edit_uv_stretching_grp, "globalsBlock", G_draw.block_ubo);
|
||||
DRW_shgroup_uniform_vec2_copy(pd->edit_uv_stretching_grp, "aspect", pd->edit_uv.uv_aspect);
|
||||
DRW_shgroup_uniform_float_copy(
|
||||
pd->edit_uv_stretching_grp, "stretching_opacity", pd->edit_uv.stretching_opacity);
|
||||
pd->edit_uv_stretching_grp, "stretch_opacity", pd->edit_uv.stretch_opacity);
|
||||
}
|
||||
else /* SI_UVDT_STRETCH_AREA */ {
|
||||
GPUShader *sh = OVERLAY_shader_edit_uv_stretching_area_get();
|
||||
|
@ -295,7 +295,7 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata)
|
|||
DRW_shgroup_uniform_float(
|
||||
pd->edit_uv_stretching_grp, "totalAreaRatio", &pd->edit_uv.total_area_ratio, 1);
|
||||
DRW_shgroup_uniform_float_copy(
|
||||
pd->edit_uv_stretching_grp, "stretching_opacity", pd->edit_uv.stretching_opacity);
|
||||
pd->edit_uv_stretching_grp, "stretch_opacity", pd->edit_uv.stretch_opacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -395,7 +395,7 @@ struct OVERLAY_PrivateData {
|
|||
|
||||
float uv_opacity;
|
||||
|
||||
float stretching_opacity;
|
||||
float stretch_opacity;
|
||||
|
||||
int image_size[2];
|
||||
float image_aspect[2];
|
||||
|
|
|
@ -379,7 +379,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_mask_image)
|
|||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching)
|
||||
.vertex_in(0, Type::VEC2, "pos")
|
||||
.push_constant(Type::VEC2, "aspect")
|
||||
.push_constant(Type::FLOAT, "stretching_opacity")
|
||||
.push_constant(Type::FLOAT, "stretch_opacity")
|
||||
.vertex_out(overlay_edit_nopersp_color_iface)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("overlay_edit_uv_stretching_vert.glsl")
|
||||
|
|
|
@ -82,5 +82,5 @@ void main()
|
|||
|
||||
#endif
|
||||
|
||||
finalColor = vec4(weight_to_rgb(stretch), stretching_opacity);
|
||||
finalColor = vec4(weight_to_rgb(stretch), stretch_opacity);
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ static SpaceLink *image_create(const ScrArea * /*area*/, const Scene * /*scene*/
|
|||
simage->lock = true;
|
||||
simage->flag = SI_SHOW_GPENCIL | SI_USE_ALPHA | SI_COORDFLOATS;
|
||||
simage->uv_opacity = 1.0f;
|
||||
simage->stretching_opacity = 1.0f;
|
||||
simage->stretch_opacity = 1.0f;
|
||||
simage->overlay.flag = SI_OVERLAY_SHOW_OVERLAYS | SI_OVERLAY_SHOW_GRID_BACKGROUND;
|
||||
|
||||
BKE_imageuser_default(&simage->iuser);
|
||||
|
|
|
@ -1269,7 +1269,7 @@ typedef struct SpaceImage {
|
|||
|
||||
float uv_opacity;
|
||||
|
||||
float stretching_opacity;
|
||||
float stretch_opacity;
|
||||
|
||||
int tile_grid_shape[2];
|
||||
/**
|
||||
|
|
|
@ -3719,10 +3719,10 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "UV Opacity", "Opacity of UV overlays");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "stretching_opacity", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "stretching_opacity");
|
||||
prop = RNA_def_property(srna, "stretch_opacity", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "stretch_opacity");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Stretching Opacity", "Opacity of the stretching overlay");
|
||||
RNA_def_property_ui_text(prop, "Stretch Opacity", "Opacity of the UV Stretch overlay");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "pixel_round_mode", PROP_ENUM, PROP_NONE);
|
||||
|
|
Loading…
Reference in New Issue