-
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
Support binary data in asset pack, support typed array in compiled serialization #15904
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jareguo
reviewed
Aug 9, 2023
shrinktofit
changed the title
Support binary data in asset pack, support typed array in compiled serialization
(DON'T MERGE)Support binary data in asset pack, support typed array in compiled serialization
Aug 10, 2023
shrinktofit
commented
Aug 10, 2023
|
||
const [byteOffset, byteLength] = binaryStorageSpan; | ||
|
||
// Note: we do copy 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.
@holycanvas @jareguo Notable change.
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.
up to you guys
jareguo
approved these changes
Aug 12, 2023
Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -28139,9 +28139,9 @@
* @param details - Additional loading result.
* @param options Deserialization Options.
* @return The original object.
*/
- export function deserialize(data: __private._cocos_serialization_deserialize__IDeserializeInput | string | any, details?: Details, options?: __private._cocos_serialization_deserialize__IOptions & __private._cocos_serialization_deserialize_dynamic__DeserializeDynamicOptions): unknown;
+ export function deserialize(data: __private._cocos_serialization_deserialize__IDeserializeInput | string | CCON | any, details?: Details, options?: __private._cocos_serialization_deserialize__IOptions & __private._cocos_serialization_deserialize_dynamic__DeserializeDynamicOptions): unknown;
export namespace deserialize {
export namespace Internal {
export type SharedString_ = __private._cocos_serialization_deserialize__SharedString;
export type Empty_ = __private._cocos_serialization_deserialize__Empty;
@@ -28156,14 +28156,15 @@
Class = 4,
ValueTypeCreated = 5,
AssetRefByInnerObj = 6,
TRS = 7,
- ValueType = 8,
- Array_Class = 9,
- CustomizedClass = 10,
- Dict = 11,
- Array = 12,
- ARRAY_LENGTH = 13
+ TypedArray = 8,
+ ValueType = 9,
+ Array_Class = 10,
+ CustomizedClass = 11,
+ Dict = 12,
+ Array = 13,
+ ARRAY_LENGTH = 14
}
export type DataTypes_ = __private._cocos_serialization_deserialize__DataTypes;
export type AnyData_ = __private._cocos_serialization_deserialize__AnyData;
export type OtherObjectData_ = __private._cocos_serialization_deserialize__OtherObjectData;
@@ -28176,8 +28177,9 @@
export type ICustomObjectData_ = __private._cocos_serialization_deserialize__ICustomObjectData;
export type ITRSData_ = __private._cocos_serialization_deserialize__ITRSData;
export type IDictData_ = __private._cocos_serialization_deserialize__IDictData;
export type IArrayData_ = __private._cocos_serialization_deserialize__IArrayData;
+ export type ITypedArrayData_ = TypedArrayData;
export const enum Refs_ {
EACH_RECORD_LENGTH = 3,
OWNER_OFFSET = 0,
KEY_OFFSET = 1,
@@ -28196,9 +28198,11 @@
Refs = 7,
DependObjs = 8,
DependKeys = 9,
DependUuidIndices = 10,
- ARRAY_LENGTH = 11
+ ARRAY_LENGTH = 11,
+ RUNTIME_BEGIN = 11,
+ BinaryStorage_runtime = 11
}
export type IFileData_ = __private._cocos_serialization_deserialize__IFileData;
export type IPackedFileData_ = __private._cocos_serialization_deserialize__IPackedFileData;
}
@@ -63710,8 +63714,9 @@
[deserialize.Internal.DataTypeID_.Class]: _cocos_serialization_deserialize__IClassObjectData;
[deserialize.Internal.DataTypeID_.ValueTypeCreated]: _cocos_serialization_deserialize__IValueTypeData;
[deserialize.Internal.DataTypeID_.AssetRefByInnerObj]: number;
[deserialize.Internal.DataTypeID_.TRS]: _cocos_serialization_deserialize__ITRSData;
+ [deserialize.Internal.DataTypeID_.TypedArray]: TypedArrayData;
[deserialize.Internal.DataTypeID_.ValueType]: _cocos_serialization_deserialize__IValueTypeData;
[deserialize.Internal.DataTypeID_.Array_Class]: _cocos_serialization_deserialize__DataTypes[deserialize.Internal.DataTypeID_.Class][];
[deserialize.Internal.DataTypeID_.CustomizedClass]: _cocos_serialization_deserialize__ICustomObjectData;
[deserialize.Internal.DataTypeID_.Dict]: _cocos_serialization_deserialize__IDictData;
@@ -63782,18 +63787,24 @@
customEnv: any;
}
export interface _cocos_serialization_deserialize__DeserializeContext extends _cocos_serialization_deserialize__ICustomHandler {
_version?: number;
+ _attachedBinary?: Uint8Array;
+ _attachedBinaryDataViewCache?: DataView;
}
export type _cocos_serialization_deserialize__IRuntimeFileDataMap = Omit<_cocos_serialization_deserialize__IFileDataMap, deserialize.Internal.File_.Version> & {
[deserialize.Internal.File_.Context]: _cocos_serialization_deserialize__FileInfo & _cocos_serialization_deserialize__DeserializeContext;
+ /**
+ * The binary storage attached to this document.
+ */
+ [deserialize.Internal.File_.BinaryStorage_runtime]: Uint8Array | undefined;
};
/**
* At runtime, we intruded the original file data and injected some helpers.
*/
export type _cocos_serialization_deserialize__IRuntimeFileData = _cocos_serialization_deserialize_type_utilities__MapEnum<{
[x in keyof _cocos_serialization_deserialize__IRuntimeFileDataMap as `${x}`]: _cocos_serialization_deserialize__IRuntimeFileDataMap[x];
- }, 11>;
+ }, 12>;
export type _cocos_serialization_deserialize__IDeserializeInput = _cocos_serialization_deserialize__IFileData | _cocos_serialization_deserialize__IRuntimeFileData;
export type _cocos_serialization_deserialize__ClassFinder = deserialize.ClassFinder;
export interface _cocos_serialization_deserialize__IOptions extends Partial<_cocos_serialization_deserialize__ICustomHandler> {
classFinder?: _cocos_serialization_deserialize__ClassFinder;
@@ -63826,9 +63837,13 @@
export type _cocos_serialization_deserialize_type_utilities__SkipFirst<T extends readonly any[], N extends number> = _cocos_serialization_deserialize_type_utilities__TupleSplit<T, N>[1];
export type _cocos_serialization_deserialize_type_utilities__TupleSlice<T extends readonly any[], S extends number, E extends number = T["length"]> = _cocos_serialization_deserialize_type_utilities__SkipFirst<_cocos_serialization_deserialize_type_utilities__TakeFirst<T, E>, S>;
export type _cocos_serialization_deserialize__ISharedData = _cocos_serialization_deserialize_type_utilities__TupleSlice<_cocos_serialization_deserialize__IFileData, 1, 5>;
export type _cocos_serialization_deserialize__IPackedFileSection = [
- ...document: _cocos_serialization_deserialize_type_utilities__TupleSlice<_cocos_serialization_deserialize__IFileData, 5>
+ ...document: _cocos_serialization_deserialize_type_utilities__TupleSlice<_cocos_serialization_deserialize__IFileData, 5>,
+ binaryStorage: [
+ byteOffset: number,
+ byteLength: number
+ ] | undefined
];
export type _cocos_serialization_deserialize__IPackedFileData = [
version: number,
...shared: _cocos_serialization_deserialize__ISharedData,
@@ -64748,9 +64763,9 @@
* packManager.unpackJson(['a', 'b'], file, null, (err, data) => log(err));
* });
*
*/
- unpackJson(pack: string[], json: any, options: Record<string, any>, onComplete: ((err: Error | null, data?: Record<string, any> | null) => void)): void;
+ unpackJson(pack: readonly string[], json: any, options: Record<string, any>, onComplete: ((err: Error | null, data?: Record<string, any> | null) => void)): void;
init(): void;
/**
* @en
* Register custom handler if you want to change default behavior or extend packManager to unpack other format pack
@@ -70023,9 +70038,9 @@
}
import { exoticAnimationTag, ExoticAnimation, additiveSettingsTag, AnimationClipAdditiveSettings } from "cc/editor/exotic-animation";
import { EmbeddedPlayer, embeddedPlayerCountTag, getEmbeddedPlayersTag, addEmbeddedPlayerTag, removeEmbeddedPlayerTag, clearEmbeddedPlayersTag } from "cc/editor/embedded-player";
import { AnimationMask, __private as ___private } from "cc/editor/new-gen-anim";
- import { CCON } from "cc/editor/serialization";
+ import { CCON, TypedArrayData } from "cc/editor/serialization";
export { Canvas as CanvasComponent, UIRenderer as RenderComponent, UIRenderer as UIRenderable, UIRenderer as Renderable2D, UITransform as UITransformComponent, Mask as MaskComponent, RichText as RichTextComponent, Sprite as SpriteComponent, UIMeshRenderer as UIModelComponent, LabelOutline as LabelOutlineComponent, Graphics as GraphicsComponent, UIStaticBatch as UIStaticBatchComponent, UIOpacity as UIOpacityComponent, Label as LabelComponent, MeshRenderer as ModelComponent, DirectionalLight as DirectionalLightComponent, Light as LightComponent, SphereLight as SphereLightComponent, SpotLight as SpotLightComponent, SkinnedMeshRenderer as SkinningModelComponent, SkinnedMeshBatchRenderer as BatchedSkinningModelComponent, SkinnedMeshUnit as SkinningModelUnit, Animation as AnimationComponent, AudioSource as AudioSourceComponent, Node as BaseNode, Camera as CameraComponent, ModelRenderer as RenderableComponent, Billboard as BillboardComponent, Line as LineComponent, ParticleSystem as ParticleSystemComponent, SkeletalAnimation as SkeletalAnimationComponent, Button as ButtonComponent, EditBox as EditBoxComponent, Layout as LayoutComponent, ProgressBar as ProgressBarComponent, ScrollBar as ScrollBarComponent, ScrollView as ScrollViewComponent, Slider as SliderComponent, Toggle as ToggleComponent, ToggleContainer as ToggleContainerComponent, Widget as WidgetComponent, PageView as PageViewComponent, PageViewIndicator as PageViewIndicatorComponent, SafeArea as SafeAreaComponent, UICoordinateTracker as UICoordinateTrackerComponent, BlockInputEvents as BlockInputEventsComponent } from "cc";
import { Details as _Details } from "cc";
export {};
}
|
shrinktofit
force-pushed
the
CCONPack
branch
3 times, most recently
from
September 7, 2023 09:43
3fe77f9
to
b251331
Compare
shrinktofit
force-pushed
the
CCONPack
branch
from
September 7, 2023 09:43
b251331
to
f196910
Compare
shrinktofit
force-pushed
the
CCONPack
branch
from
September 7, 2023 09:45
f196910
to
6b317b4
Compare
shrinktofit
changed the title
(DON'T MERGE)Support binary data in asset pack, support typed array in compiled serialization
Support binary data in asset pack, support typed array in compiled serialization
Sep 7, 2023
SantyWang
approved these changes
Sep 7, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Re: #
Changelog
Support serializing typed array in compiled serialization.
The input(output) of compiled deserialization(serialization) might have a binary storage attached.
With 1, compiled serialization can now process typed array properties:
If there is no binary storage, the typed array is serialized in place, as plain JSON number array with type info.
Otherwise, the typed array is serialized into the binary storage.
Support packing binary data in asset pack.
The pack content format has been updated reference binary data:
binary storage. Each section, together with its reference binary storage, can then be sent to deserialize.
Continuous Integration
This pull request:
Compatibility Check
This pull request: