Skip to content

Commit

Permalink
Xeltalliv/clippingblending: Fix effect resetting on stopping project …
Browse files Browse the repository at this point in the history
…and incorrect clipping box inheritance by clones (#1451)

1. In the past, stopping the project would visually reset effects, but
they were still there internally, causing clones to inherit them.
2. In the past, creating clone would always result in a clone with
clipping box. If the original sprite/clone did not have it, the newly
created clipping box would be represented as an empty object (instead of
null), which meant all of the required values were undefined. This
caused clone to turn invisible. [Originally reported on discord by @
cas_thekid](https://discord.com/channels/837024174865776680/1169100193749291008)
  • Loading branch information
Xeltalliv authored May 9, 2024
1 parent 6784131 commit 00abd24
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion extensions/Xeltalliv/clippingblending.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
const proto = vm.runtime.targets[0].__proto__;
const osa = proto.onStopAll;
proto.onStopAll = function () {
this.clipbox = null;
this.blendMode = "default";
this.renderer.updateDrawableClipBox.call(
renderer,
this.drawableID,
Expand All @@ -168,7 +170,9 @@
proto.makeClone = function () {
const newTarget = mc.call(this);
if (this.clipbox || this.blendMode) {
newTarget.clipbox = Object.assign({}, this.clipbox);
newTarget.clipbox = this.clipbox
? Object.assign({}, this.clipbox)
: null;
newTarget.blendMode = this.blendMode;
renderer.updateDrawableClipBox.call(
renderer,
Expand Down

0 comments on commit 00abd24

Please sign in to comment.