-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refine: make multi skeleton component shared one instance of spine.Skeleton while spine working at sharedCache mode #16593
Conversation
native/cocos/editor-support/spine-wasm/spine-skeleton-instance.cpp
Outdated
Show resolved
Hide resolved
} | ||
|
||
void SpineSkeletonInstance::release() { | ||
--_referenceCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to assert _referenceCount > 0.
…eleton while spine working at sharedCache mode
Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -52023,8 +52023,9 @@
static createSpineSkeletonDataWithJson(jsonStr: string, atlasText: string): SkeletonData;
static createSpineSkeletonDataWithBinary(byteSize: number, atlasText: string): SkeletonData;
static registerSpineSkeletonDataWithUUID(data: SkeletonData, uuid: string);
static destroySpineSkeletonDataWithUUID(uuid: string);
+ static destroySpineSkeleton(skeleton: Skeleton): void;
static getCurrentListenerID(): number;
static getCurrentEventType(): EventType;
static getCurrentTrackEntry(): TrackEntry;
static getCurrentEvent(): Event;
@@ -67477,8 +67478,9 @@
curAnimationCache: _cocos_spine_skeleton_cache__AnimationCache | null;
animationsCache: {
[key: string]: _cocos_spine_skeleton_cache__AnimationCache;
};
+ assetUUID: string;
}
export class _cocos_spine_skeleton_cache__SkeletonCache {
static readonly FrameTime: number;
static sharedCache: _cocos_spine_skeleton_cache__SkeletonCache;
@@ -67492,10 +67494,11 @@
constructor();
enablePrivateMode(): void;
clear(): void;
invalidAnimationCache(uuid: string): void;
- removeSkeleton(uuid: string): void;
- getSkeletonCache(uuid: string, skeletonData: sp.spine.SkeletonData): _cocos_spine_skeleton_cache__SkeletonCacheItemInfo;
+ destroySkeleton(assetUuid: string): void;
+ createSkeletonInfo(skeletonAsset: sp.SkeletonData): _cocos_spine_skeleton_cache__SkeletonCacheItemInfo;
+ getSkeletonInfo(skeletonAsset: sp.SkeletonData): null | _cocos_spine_skeleton_cache__SkeletonCacheItemInfo;
getAnimationCache(uuid: string, animationName: string): null | _cocos_spine_skeleton_cache__AnimationCache;
initAnimationCache(uuid: string, data: sp.SkeletonData, animationName: string): null | _cocos_spine_skeleton_cache__AnimationCache;
destroyCachedAnimations(uuid?: string): void;
}
|
this._animationPool[`${uuid}#${aniKey}`] = animationCache; | ||
animationCache.clear(); | ||
}; | ||
const privateOperate = (aniKey: string, animationCache: AnimationCache): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it called privateOperate
? What does private
mean here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private corresponds to privateCache mode.
cocos/spine/skeleton-cache.ts
Outdated
let skeletonInfo = this._skeletonCache[uuid]; | ||
if (!skeletonInfo) { | ||
const skeleton = null; | ||
const skeleton = new spine.Skeleton(skeletonData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skeleton is forever null
in the old code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skeleton will constructor by skeleton component's _instance in old code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we move the spine.Skeleton
construction code to here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, previous logic multi skeleton component can not share the same object of spine.skeleton
Re: #
cocos/cocos-engine-external#449
#16598
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: