Skip to content

Commit aae768b

Browse files
author
Nusiq
committed
Add option to hide UV mask effect.
1 parent 9aacd78 commit aae768b

12 files changed

+33
-2
lines changed

docs/img/color_mask.png

220 Bytes
Loading

docs/img/color_palette_mask.png

-225 Bytes
Loading

docs/img/ellipse_mask.png

321 Bytes
Loading

docs/img/gradient_mask.png

1.15 KB
Loading

docs/img/mix_mask.PNG

735 Bytes
Loading

docs/img/random_mask.png

298 Bytes
Loading

docs/img/rectangle_mask.png

247 Bytes
Loading

docs/img/stripes_mask.png

-102 Bytes
Loading

docs/texture_customization/index.md

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ sides (side1-6) are corelated to their placement on the texture.
1515
New masks are added with "Add mask" dropdown menu. There are 8 different types
1616
of masks.
1717

18+
19+
!!! note
20+
21+
All masks have an eye icon in the upper right corner that can be used to
22+
temporarily disable / enable the mask.
23+
1824
## Color Palette Mask
1925
![](../img/color_palette_mask.png)
2026

mcblend/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"author": "Artur",
6666
"description": "",
6767
"blender": (2, 80, 0),
68-
"version": (5, 0, 4), # COMPATIBILITY BREAKING CHANGE, NEW FEATURE, BUGFIX
68+
"version": (5, 1, 0), # COMPATIBILITY BREAKING CHANGE, NEW FEATURE, BUGFIX
6969
"location": "",
7070
"warning": "",
7171
"category": "Generic"

mcblend/operator_func/texture_generator.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ def apply(self, image: np.ndarray):
145145
def get_mask(self, image: np.array) -> np.array:
146146
'''Returns 2D matrix with the filter array.'''
147147

148+
149+
class DummyMask(MultiplicativeMask):
150+
'''
151+
A multiplicative mask that always return a white image.
152+
'''
153+
def get_mask(self, image):
154+
w, h, _ = image.shape
155+
return np.ones((w, h))[:,:, np.newaxis]
156+
157+
148158
class Stripe(NamedTuple):
149159
'''
150160
Stripes are used in StripesMask and ColorPaletteMask mask in a collection
@@ -620,7 +630,10 @@ def _get_masks_from_side(side: Iterable, n_steps: int) -> Sequence[Mask]:
620630
mode=s_props.mode)
621631
else:
622632
raise ValueError('Unknown mask type')
623-
result.append(mask)
633+
if s_props.ui_hidden:
634+
result.append(DummyMask())
635+
else:
636+
result.append(mask)
624637
return tuple(result)
625638

626639
return _get_masks_from_side(iter(side), n_steps=len(side))

mcblend/panel.py

+12
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class OBJECT_NusiqMcblendColorProperties(bpy.types.PropertyGroup):
3636
# UV-mask properties
3737
class OBJECT_NusiqMcblendUvMaskProperties(bpy.types.PropertyGroup):
3838
'''Properties of UV-mask.'''
39+
ui_hidden: BoolProperty( # type: ignore
40+
name='Hide', default=False)
3941
ui_collapsed: BoolProperty( # type: ignore
4042
name='Collapse', default=False)
4143
mask_type: EnumProperty( # type: ignore
@@ -511,6 +513,7 @@ def draw_mask(
511513
# box.scale_x = True
512514
col = box.column()
513515
row = col.row()
516+
514517
if mask.ui_collapsed:
515518
row.prop(
516519
mask, "ui_collapsed", text="", icon='DISCLOSURE_TRI_RIGHT',
@@ -535,6 +538,15 @@ def draw_mask(
535538
text='')
536539
op_props.move_from = index
537540
op_props.move_to = index + 1
541+
# Hide button
542+
if mask.ui_hidden:
543+
row.prop(
544+
mask, "ui_hidden", text="", icon='HIDE_ON',
545+
emboss=False)
546+
else:
547+
row.prop(
548+
mask, "ui_hidden", text="", icon='HIDE_OFF',
549+
emboss=False)
538550
# Delete button
539551
op_props = row.operator(
540552
"object.nusiq_mcblend_remove_uv_mask", icon='X', text='')

0 commit comments

Comments
 (0)