Skip to content

Commit 0c22afc

Browse files
Move MaskBinding to drawable.d
1 parent c75168d commit 0c22afc

File tree

3 files changed

+27
-41
lines changed

3 files changed

+27
-41
lines changed

source/inochi2d/core/nodes/common.d

Lines changed: 0 additions & 40 deletions
This file was deleted.

source/inochi2d/core/nodes/composite/package.d

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99
module inochi2d.core.nodes.composite;
1010
import inochi2d.core.nodes.drawable;
11-
import inochi2d.core.nodes.common;
1211
import inochi2d.core.nodes;
1312
import inochi2d.core.math;
1413
import inochi2d.core;

source/inochi2d/core/nodes/drawable/package.d

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,31 @@ public:
187187
void drawAsMask(float delta, DrawList drawList, MaskingMode mode) {
188188
drawList.setMesh(drawListSlot);
189189
}
190+
}
191+
192+
/**
193+
A binding between a mask and a mode
194+
*/
195+
struct MaskBinding {
196+
public:
197+
GUID maskSrcGUID;
198+
MaskingMode mode;
199+
Drawable maskSrc;
200+
201+
/**
202+
Serialization function
203+
*/
204+
void onSerialize(ref JSONValue object, bool recursive = true) {
205+
auto srcGuid = maskSrcGUID.toString();
206+
object["source"] = srcGuid.dup;
207+
object["mode"] = mode;
208+
}
209+
210+
/**
211+
Deserialization function
212+
*/
213+
void onDeserialize(ref JSONValue object) {
214+
maskSrcGUID = object.tryGetGUID("source", "source");
215+
mode = object.tryGet!string("mode", null).toMaskingMode;
216+
}
190217
}

0 commit comments

Comments
 (0)