UV: minor adjustments to opacity adjustment

- Allow 0.0..1.0 range, as even at 0.0 the selection is still visible.
- Correct versioning code, not to overwrite the value for new files.
This commit is contained in:
Campbell Barton 2020-04-17 13:53:15 +10:00
parent cbd6c5735d
commit 19c7ef3067
Notes: blender-bot 2023-02-13 22:50:12 +01:00
Referenced by issue #75815, Viewport Glitches while changing viewport anti-aliasing settings
2 changed files with 10 additions and 7 deletions

View File

@ -23,6 +23,7 @@
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "DNA_genfile.h"
#include "DNA_screen_types.h"
#include "BKE_collection.h"
@ -49,12 +50,14 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
/* Keep this block, even when empty. */
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
if (sl->spacetype == SPACE_IMAGE) {
SpaceImage *sima = (SpaceImage *)sl;
sima->uv_opacity = 1.0f;
if (!DNA_struct_elem_find(fd->filesdna, "SpaceImage", "float", "uv_opacity")) {
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
if (sl->spacetype == SPACE_IMAGE) {
SpaceImage *sima = (SpaceImage *)sl;
sima->uv_opacity = 1.0f;
}
}
}
}

View File

@ -2937,7 +2937,7 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
prop = RNA_def_property(srna, "uv_opacity", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "uv_opacity");
RNA_def_property_range(prop, 0.2f, 1.0f);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "UV Opacity", "Opacity of UV overlays");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);