Skip to content

Commit 6d9ddfd

Browse files
committed
Add basic parsing of PROP_LOCK_VISIBILITY (required for new test files)
1 parent 28ce1ae commit 6d9ddfd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

gimpformats/GimpIOBase.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def __init__(self, parent: Any = None) -> None:
6767
self.isGroup = None
6868
self.groupItemFlags: int = 0
6969
self.positionLocked: bool = False
70+
self.visibilityLocked: bool = False
7071
self.opacity: float = 1.0
7172
self.colorTag: TagColor = TagColor.Blue
7273
self.compositeMode: CompositeMode = CompositeMode.Union
@@ -320,6 +321,8 @@ def _propertyDecode(self, prop: int, data: bytearray) -> int:
320321
self.groupItemFlags = ioBuf.u32
321322
elif _prop_cmp(prop, AllProps.PROP_LOCK_POSITION):
322323
self.positionLocked = ioBuf.boolean
324+
elif _prop_cmp(prop, AllProps.PROP_LOCK_VISIBILITY):
325+
self.visibilityLocked = ioBuf.boolean
323326
elif _prop_cmp(prop, AllProps.PROP_FLOAT_OPACITY):
324327
self.opacity = ioBuf.float32
325328
elif _prop_cmp(prop, AllProps.PROP_COLOR_TAG):
@@ -479,6 +482,9 @@ def _propertyEncode(self, prop: int) -> bytearray:
479482
elif _prop_cmp(prop, AllProps.PROP_LOCK_POSITION):
480483
if self.positionLocked is not None and self.positionLocked:
481484
ioBuf.boolean = self.positionLocked
485+
elif _prop_cmp(prop, AllProps.PROP_LOCK_VISIBILITY):
486+
if self.visibilityLocked is not None and self.visibilityLocked:
487+
ioBuf.boolean = self.visibilityLocked
482488
elif _prop_cmp(prop, AllProps.PROP_FLOAT_OPACITY):
483489
if self.opacity is not None and isinstance(self.opacity, float):
484490
ioBuf.float32 = self.opacity

gimpformats/enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class GeneralProperties(Enum):
151151
PROP_VISIBLE = 8
152152
PROP_TATTOO = 20
153153
# PROP_ITEM_SET_ITEM = 41
154-
# PROP_LOCK_VISIBILITY = 42
154+
PROP_LOCK_VISIBILITY = 42
155155

156156

157157
class ImageProperties(Enum):

0 commit comments

Comments
 (0)