@galacean/effects-threejs 2.6.1 → 2.6.3

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/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.6.1
6
+ * Version: v2.6.3
7
7
  */
8
8
 
9
9
  'use strict';
@@ -817,6 +817,28 @@ function noop() {}
817
817
  */ function isObject(obj) {
818
818
  return Object.prototype.toString.call(obj) === "[object Object]";
819
819
  }
820
+ /**
821
+ * 判断对象是否是`Plain Object`类型
822
+ *
823
+ * @param obj - 要判断的对象
824
+ * @returns
825
+ */ function isPlainObject(obj) {
826
+ if (obj === null || typeof obj !== "object") {
827
+ return false;
828
+ }
829
+ // 先排除 Array/Date/Map/Set/RegExp 等
830
+ if (Object.prototype.toString.call(obj) !== "[object Object]") {
831
+ return false;
832
+ }
833
+ var proto = Object.getPrototypeOf(obj);
834
+ if (proto === null) {
835
+ return true;
836
+ } // Object.create(null)
837
+ var hasOwn = Object.prototype.hasOwnProperty;
838
+ var Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
839
+ // 构造器需要是 Object(跨 realm 用函数源码比对)
840
+ return typeof Ctor === "function" && Function.prototype.toString.call(Ctor) === Function.prototype.toString.call(Object);
841
+ }
820
842
  function isCanvas(canvas) {
821
843
  var _canvas_tagName;
822
844
  // 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
@@ -29450,7 +29472,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
29450
29472
  } else if (SerializationHelper.checkDataPath(property)) {
29451
29473
  var referenceObject = engine.findObject(property);
29452
29474
  return overrideDataPath ? referenceObject : property;
29453
- } else if (isObject(property) && property.constructor === Object) {
29475
+ } else if (isPlainObject(property)) {
29454
29476
  var res1;
29455
29477
  if (type) {
29456
29478
  res1 = new type();
@@ -31121,7 +31143,7 @@ function getStandardSpriteContent(sprite, transform) {
31121
31143
  return ret;
31122
31144
  }
31123
31145
 
31124
- var version$2 = "2.6.1";
31146
+ var version$2 = "2.6.3";
31125
31147
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
31126
31148
  var standardVersion = /^(\d+)\.(\d+)$/;
31127
31149
  var reverseParticle = false;
@@ -31709,6 +31731,10 @@ var seed$1 = 1;
31709
31731
  ];
31710
31732
  case 1:
31711
31733
  rawJSON = _state.sent();
31734
+ // 小程序环境下,如果产物是相对路径,adapter 返回的是字符串,需要兼容
31735
+ if (isString(rawJSON)) {
31736
+ rawJSON = JSON.parse(rawJSON);
31737
+ }
31712
31738
  return [
31713
31739
  3,
31714
31740
  3
@@ -34031,7 +34057,7 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
34031
34057
  * @ignore
34032
34058
  */ _proto.findObject = function findObject(guid) {
34033
34059
  // 编辑器可能传 Class 对象,这边判断处理一下直接返回原对象。
34034
- if (!(isObject(guid) && guid.constructor === Object)) {
34060
+ if (!isPlainObject(guid)) {
34035
34061
  return guid;
34036
34062
  }
34037
34063
  if (this.objectInstance[guid.id]) {
@@ -34371,7 +34397,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
34371
34397
  registerPlugin("particle", ParticleLoader, exports.VFXItem);
34372
34398
  registerPlugin("cal", CalculateLoader, exports.VFXItem);
34373
34399
  registerPlugin("interact", InteractLoader, exports.VFXItem);
34374
- var version$1 = "2.6.1";
34400
+ var version$1 = "2.6.3";
34375
34401
  logger.info("Core version: " + version$1 + ".");
34376
34402
 
34377
34403
  var _obj;
@@ -35976,7 +36002,7 @@ setMaxSpriteMeshItemCount(8);
35976
36002
  */ Mesh.create = function(engine, props) {
35977
36003
  return new ThreeMesh(engine, props);
35978
36004
  };
35979
- var version = "2.6.1";
36005
+ var version = "2.6.3";
35980
36006
  logger.info("THREEJS plugin version: " + version + ".");
35981
36007
 
35982
36008
  exports.AbstractPlugin = AbstractPlugin;
@@ -36214,6 +36240,7 @@ exports.isIOSByUA = isIOSByUA;
36214
36240
  exports.isMiniProgram = isMiniProgram;
36215
36241
  exports.isObject = isObject;
36216
36242
  exports.isOpenHarmony = isOpenHarmony;
36243
+ exports.isPlainObject = isPlainObject;
36217
36244
  exports.isSimulatorCellPhone = isSimulatorCellPhone;
36218
36245
  exports.isString = isString;
36219
36246
  exports.isUniformStruct = isUniformStruct;