@galacean/engine-loader 1.1.0-alpha.3 → 1.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js
CHANGED
|
@@ -680,6 +680,8 @@ exports.InterpolableValueType = void 0;
|
|
|
680
680
|
InterpolableValueType[InterpolableValueType["Color"] = 6] = "Color";
|
|
681
681
|
InterpolableValueType[InterpolableValueType["Array"] = 7] = "Array";
|
|
682
682
|
InterpolableValueType[InterpolableValueType["Boolean"] = 8] = "Boolean";
|
|
683
|
+
InterpolableValueType[InterpolableValueType["Rect"] = 9] = "Rect";
|
|
684
|
+
InterpolableValueType[InterpolableValueType["ReferResource"] = 10] = "ReferResource";
|
|
683
685
|
})(exports.InterpolableValueType || (exports.InterpolableValueType = {}));
|
|
684
686
|
exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
685
687
|
function AnimationClipDecoder() {}
|
|
@@ -708,7 +710,7 @@ exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
|
708
710
|
switch(curveType){
|
|
709
711
|
case "AnimationFloatCurve":
|
|
710
712
|
{
|
|
711
|
-
curve =
|
|
713
|
+
curve = new engineCore.AnimationFloatCurve();
|
|
712
714
|
curve.interpolation = interpolation;
|
|
713
715
|
for(var j = 0; j < keysLen; ++j){
|
|
714
716
|
var keyframe = new engineCore.Keyframe();
|
|
@@ -722,7 +724,7 @@ exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
|
722
724
|
}
|
|
723
725
|
case "AnimationArrayCurve":
|
|
724
726
|
{
|
|
725
|
-
curve =
|
|
727
|
+
curve = new engineCore.AnimationArrayCurve();
|
|
726
728
|
curve.interpolation = interpolation;
|
|
727
729
|
for(var j1 = 0; j1 < keysLen; ++j1){
|
|
728
730
|
var keyframe1 = new engineCore.Keyframe();
|
|
@@ -737,7 +739,7 @@ exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
|
737
739
|
}
|
|
738
740
|
case "AnimationFloatArrayCurve":
|
|
739
741
|
{
|
|
740
|
-
curve =
|
|
742
|
+
curve = new engineCore.AnimationFloatArrayCurve();
|
|
741
743
|
curve.interpolation = interpolation;
|
|
742
744
|
for(var j2 = 0; j2 < keysLen; ++j2){
|
|
743
745
|
var keyframe2 = new engineCore.Keyframe();
|
|
@@ -752,7 +754,7 @@ exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
|
752
754
|
}
|
|
753
755
|
case "AnimationVector2Curve":
|
|
754
756
|
{
|
|
755
|
-
curve =
|
|
757
|
+
curve = new engineCore.AnimationVector2Curve();
|
|
756
758
|
curve.interpolation = interpolation;
|
|
757
759
|
for(var j3 = 0; j3 < keysLen; ++j3){
|
|
758
760
|
var keyframe3 = new engineCore.Keyframe();
|
|
@@ -766,7 +768,7 @@ exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
|
766
768
|
}
|
|
767
769
|
case "AnimationVector3Curve":
|
|
768
770
|
{
|
|
769
|
-
curve =
|
|
771
|
+
curve = new engineCore.AnimationVector3Curve();
|
|
770
772
|
curve.interpolation = interpolation;
|
|
771
773
|
for(var j4 = 0; j4 < keysLen; ++j4){
|
|
772
774
|
var keyframe4 = new engineCore.Keyframe();
|
|
@@ -780,7 +782,7 @@ exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
|
780
782
|
}
|
|
781
783
|
case "AnimationVector4Curve":
|
|
782
784
|
{
|
|
783
|
-
curve =
|
|
785
|
+
curve = new engineCore.AnimationVector4Curve();
|
|
784
786
|
curve.interpolation = interpolation;
|
|
785
787
|
var keyframe5 = new engineCore.Keyframe();
|
|
786
788
|
keyframe5.time = bufferReader.nextFloat32();
|
|
@@ -792,7 +794,7 @@ exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
|
792
794
|
}
|
|
793
795
|
case "AnimationColorCurve":
|
|
794
796
|
{
|
|
795
|
-
curve =
|
|
797
|
+
curve = new engineCore.AnimationColorCurve();
|
|
796
798
|
curve.interpolation = interpolation;
|
|
797
799
|
for(var j5 = 0; j5 < keysLen; ++j5){
|
|
798
800
|
var keyframe6 = new engineCore.Keyframe();
|
|
@@ -806,7 +808,7 @@ exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
|
806
808
|
}
|
|
807
809
|
case "AnimationQuaternionCurve":
|
|
808
810
|
{
|
|
809
|
-
curve =
|
|
811
|
+
curve = new engineCore.AnimationQuaternionCurve();
|
|
810
812
|
curve.interpolation = interpolation;
|
|
811
813
|
for(var j6 = 0; j6 < keysLen; ++j6){
|
|
812
814
|
var keyframe7 = new engineCore.Keyframe();
|
|
@@ -818,6 +820,18 @@ exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
|
818
820
|
}
|
|
819
821
|
break;
|
|
820
822
|
}
|
|
823
|
+
case "AnimationRefCurve":
|
|
824
|
+
{
|
|
825
|
+
curve = new engineCore.AnimationRefCurve();
|
|
826
|
+
curve.interpolation = interpolation;
|
|
827
|
+
for(var j7 = 0; j7 < keysLen; ++j7){
|
|
828
|
+
var keyframe8 = new engineCore.Keyframe();
|
|
829
|
+
keyframe8.time = bufferReader.nextFloat32();
|
|
830
|
+
keyframe8.value = JSON.parse(bufferReader.nextStr());
|
|
831
|
+
curve.addKey(keyframe8);
|
|
832
|
+
}
|
|
833
|
+
break;
|
|
834
|
+
}
|
|
821
835
|
}
|
|
822
836
|
clip.addCurveBinding(relativePath, componentType, property, curve);
|
|
823
837
|
}
|
|
@@ -1065,7 +1079,27 @@ var AnimationClipLoader = /*#__PURE__*/ function(Loader) {
|
|
|
1065
1079
|
_this.request(item.url, _extends({}, item, {
|
|
1066
1080
|
type: "arraybuffer"
|
|
1067
1081
|
})).then(function(data) {
|
|
1068
|
-
return decode(data, resourceManager.engine).then(
|
|
1082
|
+
return decode(data, resourceManager.engine).then(function(clip) {
|
|
1083
|
+
var curveBindingPromises = clip.curveBindings.map(function(curveBinding) {
|
|
1084
|
+
var curve = curveBinding.curve;
|
|
1085
|
+
var promises = curve.keys.map(function(key) {
|
|
1086
|
+
var value = key.value;
|
|
1087
|
+
if (typeof value === "object" && value.refId) {
|
|
1088
|
+
return new Promise(function(resolve) {
|
|
1089
|
+
resourceManager// @ts-ignore
|
|
1090
|
+
.getResourceByRef(value).then(function(asset) {
|
|
1091
|
+
key.value = asset;
|
|
1092
|
+
resolve(key);
|
|
1093
|
+
}).catch(reject);
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
return Promise.all(promises);
|
|
1098
|
+
});
|
|
1099
|
+
return Promise.all(curveBindingPromises).then(function() {
|
|
1100
|
+
resolve(clip);
|
|
1101
|
+
});
|
|
1102
|
+
});
|
|
1069
1103
|
}).catch(reject);
|
|
1070
1104
|
});
|
|
1071
1105
|
};
|