@galacean/effects-plugin-editor-gizmo 2.7.0-alpha.1 → 2.7.0-beta.0

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.
@@ -26,6 +26,7 @@ export declare class GizmoComponent extends RendererComponent {
26
26
  depthTest?: boolean;
27
27
  mat: math.Matrix4;
28
28
  wireframeMeshes: Mesh[];
29
+ mesh: Mesh | null;
29
30
  onStart(): void;
30
31
  onUpdate(dt: number): void;
31
32
  render(renderer: Renderer): void;
@@ -6,7 +6,6 @@ export declare class EditorGizmoPlugin extends AbstractPlugin {
6
6
  meshToRemove: Mesh[];
7
7
  order: number;
8
8
  static prepareResource(scene: Scene): Promise<any>;
9
- static onPlayerDestroy(): void;
10
9
  onCompositionConstructed(composition: Composition, scene: Scene): void;
11
10
  onCompositionReset(composition: Composition): void;
12
11
  onCompositionItemRemoved(composition: Composition, item: VFXItem): void;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player editor gizmo plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 茂安,旻诺
6
- * Version: v2.7.0-alpha.1
6
+ * Version: v2.7.0-beta.0
7
7
  */
8
8
 
9
9
  'use strict';
@@ -2796,6 +2796,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
2796
2796
  _this.coordinateSpace = 0;
2797
2797
  _this.mat = Matrix4.fromIdentity();
2798
2798
  _this.wireframeMeshes = [];
2799
+ _this.mesh = null;
2799
2800
  /**
2800
2801
  * 射线检测算法
2801
2802
  * @returns 包含射线检测算法回调方法的参数
@@ -3089,9 +3090,9 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3089
3090
  var item = this.item;
3090
3091
  var gizmoSubType = this.subType;
3091
3092
  if (gizmoSubType === exports.GizmoSubType.particleEmitter) {
3092
- if (this.targetItem && item.content) {
3093
+ if (this.targetItem && this.mesh) {
3093
3094
  this.mat = this.targetItem.transform.getWorldMatrix();
3094
- item.content.material.setMatrix("u_model", this.mat);
3095
+ this.mesh.material.setMatrix("u_model", this.mat);
3095
3096
  }
3096
3097
  if (this.wireframeMesh && this.targetItem) {
3097
3098
  var particle = this.targetItem.getComponent(EFFECTS.ParticleSystemRenderer);
@@ -3190,7 +3191,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3190
3191
  }
3191
3192
  }
3192
3193
  }
3193
- if (item.content) {
3194
+ if (this.mesh) {
3194
3195
  var worldPos1 = new Vector3();
3195
3196
  var worldQuat1 = new Quaternion();
3196
3197
  var worldSca = new Vector3(1, 1, 1);
@@ -3209,7 +3210,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3209
3210
  targetTransform1.setPosition(newPos1.x, newPos1.y, newPos1.z);
3210
3211
  }
3211
3212
  this.mat = targetTransform1.getWorldMatrix();
3212
- item.content.material.setMatrix("u_model", targetTransform1.getWorldMatrix());
3213
+ this.mesh.material.setMatrix("u_model", targetTransform1.getWorldMatrix());
3213
3214
  }
3214
3215
  }
3215
3216
  }
@@ -3300,7 +3301,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3300
3301
  EFFECTS.assertExist(engine);
3301
3302
  this.targetItem = item;
3302
3303
  if (shape && shape.type) {
3303
- var mesh = this.item._content = createMeshFromShape(engine, shape, {
3304
+ var mesh = this.mesh = createMeshFromShape(engine, shape, {
3304
3305
  color: this.color
3305
3306
  });
3306
3307
  meshesToAdd.push(mesh);
@@ -3324,7 +3325,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3324
3325
  EFFECTS.assertExist(engine);
3325
3326
  this.targetItem = item;
3326
3327
  if (shape) {
3327
- var mesh = gizmoItem._content = createMeshFromShape(engine, shape, {
3328
+ var mesh = this.mesh = createMeshFromShape(engine, shape, {
3328
3329
  color: this.color,
3329
3330
  depthTest: this.depthTest
3330
3331
  });
@@ -3347,7 +3348,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3347
3348
  };
3348
3349
  var engine = (_gizmoItem_composition = gizmoItem.composition) == null ? void 0 : _gizmoItem_composition.renderer.engine;
3349
3350
  EFFECTS.assertExist(engine);
3350
- var mesh = gizmoItem._content = createMeshFromSubType(engine, subType, this.boundingMap, iconTextures, options);
3351
+ var mesh = this.mesh = createMeshFromSubType(engine, subType, this.boundingMap, iconTextures, options);
3351
3352
  this.targetItem = item;
3352
3353
  meshesToAdd.push(mesh);
3353
3354
  };
@@ -3429,6 +3430,7 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3429
3430
  var _proto = EditorGizmoPlugin.prototype;
3430
3431
  _proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {
3431
3432
  var engine = composition.renderer.engine;
3433
+ iconTextures.clear();
3432
3434
  iconImages.forEach(function(image, name) {
3433
3435
  iconTextures.set(name, createTexture(engine, image));
3434
3436
  });
@@ -3516,7 +3518,7 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3516
3518
  };
3517
3519
  _proto.removeGizmoItem = function removeGizmoItem(composition, gizmoVFXItem) {
3518
3520
  var _this = this;
3519
- var gizmoMesh = gizmoVFXItem.content;
3521
+ var gizmoMesh = gizmoVFXItem.getComponent(exports.GizmoComponent).mesh;
3520
3522
  if (gizmoMesh && !gizmoMesh.isDestroyed) {
3521
3523
  gizmoMesh.dispose();
3522
3524
  if (gizmoMesh.name === exports.GeometryType.FloorGrid.toString() || gizmoMesh.name === "Box") {
@@ -3671,16 +3673,13 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3671
3673
  });
3672
3674
  })();
3673
3675
  };
3674
- EditorGizmoPlugin.onPlayerDestroy = function onPlayerDestroy() {
3675
- iconTextures.clear();
3676
- };
3677
3676
  return EditorGizmoPlugin;
3678
3677
  }(EFFECTS.AbstractPlugin);
3679
3678
 
3680
3679
  EFFECTS.registerPlugin("editor-gizmo", EditorGizmoPlugin, EFFECTS.VFXItem);
3681
3680
  /**
3682
3681
  * 插件版本号
3683
- */ var version = "2.7.0-alpha.1";
3682
+ */ var version = "2.7.0-beta.0";
3684
3683
  EFFECTS.logger.info("Plugin editor gizmo version: " + version + ".");
3685
3684
  if (version !== EFFECTS__namespace.version) {
3686
3685
  console.error("注意:请统一 Editor Gizmo 插件与 Player 版本,不统一的版本混用会有不可预知的后果!", "\nAttention: Please ensure the Editor Gizmo plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");