Skip to content

Commit 77f8212

Browse files
authored
Add internal flag allowing to disable entirely hitboxes of Spine objects to avoid unnecessary recomputations (#7834)
Only show in developer changelog
1 parent ff028ff commit 77f8212

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Extensions/Spine/spineruntimeobject.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ namespace gdjs {
5353

5454
readonly spineResourceName: string;
5555

56+
static isHitBoxesUpdateDisabled = false;
57+
5658
/**
5759
* @param instanceContainer The container the object belongs to.
5860
* @param objectData The object data used to initialize the object
@@ -74,6 +76,10 @@ namespace gdjs {
7476
this.setAnimationIndex(0);
7577
this._renderer.updateAnimation(0);
7678

79+
if (SpineRuntimeObject.isHitBoxesUpdateDisabled) {
80+
this.hitBoxes.length = 0;
81+
}
82+
7783
// *ALWAYS* call `this.onCreated()` at the very end of your object constructor.
7884
this.onCreated();
7985
}
@@ -188,6 +194,14 @@ namespace gdjs {
188194
}
189195
}
190196

197+
updateHitBoxes(): void {
198+
if (SpineRuntimeObject.isHitBoxesUpdateDisabled) {
199+
return;
200+
}
201+
202+
super.updateHitBoxes();
203+
}
204+
191205
extraInitializationFromInitialInstance(
192206
initialInstanceData: InstanceData
193207
): void {

0 commit comments

Comments
 (0)