@galacean/effects-plugin-editor-gizmo 2.8.0-alpha.1 → 2.8.0-alpha.2

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.
@@ -3,7 +3,5 @@ import { AbstractPlugin } from '@galacean/effects';
3
3
  export declare const iconTextures: Map<string, Texture>;
4
4
  export declare class EditorGizmoPlugin extends AbstractPlugin {
5
5
  order: number;
6
- static prepareResource(scene: Scene): Promise<any>;
7
- onCompositionConstructed(composition: Composition, scene: Scene): void;
8
- onCompositionReset(composition: Composition): void;
6
+ onCompositionConstructed(composition: Composition, scene: Scene): Promise<void>;
9
7
  }
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.8.0-alpha.1
6
+ * Version: v2.8.0-alpha.2
7
7
  */
8
8
 
9
9
  'use strict';
@@ -3018,8 +3018,8 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3018
3018
  return;
3019
3019
  }
3020
3020
  var composition = this.item.composition;
3021
- var _composition_pluginSystem_plugins;
3022
- for(var _iterator1 = _create_for_of_iterator_helper_loose((_composition_pluginSystem_plugins = composition == null ? void 0 : composition.pluginSystem.plugins) != null ? _composition_pluginSystem_plugins : []), _step1; !(_step1 = _iterator1()).done;){
3021
+ var _PluginSystem_getPlugins;
3022
+ for(var _iterator1 = _create_for_of_iterator_helper_loose((_PluginSystem_getPlugins = EFFECTS.PluginSystem.getPlugins()) != null ? _PluginSystem_getPlugins : []), _step1; !(_step1 = _iterator1()).done;){
3023
3023
  var plugin = _step1.value;
3024
3024
  if (plugin.name === "editor-gizmo") {
3025
3025
  this.gizmoPlugin = plugin;
@@ -3485,7 +3485,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3485
3485
  return renderPass.name === behindRenderPassName;
3486
3486
  });
3487
3487
  if (!rp) {
3488
- rp = new DrawGizmoBehindPass(pipeline.renderer, {});
3488
+ rp = new DrawGizmoBehindPass(pipeline.renderer);
3489
3489
  pipeline.addRenderPass(rp);
3490
3490
  }
3491
3491
  return rp;
@@ -3495,7 +3495,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3495
3495
  return renderPass.name === editorRenderPassName;
3496
3496
  });
3497
3497
  if (!rp) {
3498
- rp = new DrawGizmoEditorPass(pipeline.renderer, {});
3498
+ rp = new DrawGizmoEditorPass(pipeline.renderer);
3499
3499
  pipeline.addRenderPass(rp);
3500
3500
  }
3501
3501
  return rp;
@@ -3505,7 +3505,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3505
3505
  return renderPass.name === frontRenderPassName;
3506
3506
  });
3507
3507
  if (!rp) {
3508
- rp = new DrawGizmoFrontPass(pipeline.renderer, {});
3508
+ rp = new DrawGizmoFrontPass(pipeline.renderer);
3509
3509
  pipeline.addRenderPass(rp);
3510
3510
  }
3511
3511
  return rp;
@@ -3525,9 +3525,9 @@ exports.CoordinateSpace = void 0;
3525
3525
  })(exports.CoordinateSpace || (exports.CoordinateSpace = {}));
3526
3526
  var DrawGizmoBehindPass = /*#__PURE__*/ function(RenderPass) {
3527
3527
  _inherits(DrawGizmoBehindPass, RenderPass);
3528
- function DrawGizmoBehindPass(renderer, options) {
3528
+ function DrawGizmoBehindPass(renderer) {
3529
3529
  var _this;
3530
- _this = RenderPass.call(this, renderer, options) || this;
3530
+ _this = RenderPass.call(this, renderer) || this;
3531
3531
  _this.priority = EFFECTS.RenderPassPriorityPostprocess + EFFECTS.RenderPassPriorityPostprocess;
3532
3532
  _this.name = behindRenderPassName;
3533
3533
  return _this;
@@ -3539,13 +3539,16 @@ var DrawGizmoBehindPass = /*#__PURE__*/ function(RenderPass) {
3539
3539
  });
3540
3540
  renderer.renderMeshes(this.meshes);
3541
3541
  };
3542
+ _proto.configure = function configure(renderer) {
3543
+ renderer.setFramebuffer(this.framebuffer);
3544
+ };
3542
3545
  return DrawGizmoBehindPass;
3543
3546
  }(EFFECTS.RenderPass);
3544
3547
  var DrawGizmoFrontPass = /*#__PURE__*/ function(RenderPass) {
3545
3548
  _inherits(DrawGizmoFrontPass, RenderPass);
3546
- function DrawGizmoFrontPass(renderer, options) {
3549
+ function DrawGizmoFrontPass(renderer) {
3547
3550
  var _this;
3548
- _this = RenderPass.call(this, renderer, options) || this;
3551
+ _this = RenderPass.call(this, renderer) || this;
3549
3552
  _this.priority = EFFECTS.RenderPassPriorityPrepare + 2;
3550
3553
  _this.name = frontRenderPassName;
3551
3554
  return _this;
@@ -3554,13 +3557,16 @@ var DrawGizmoFrontPass = /*#__PURE__*/ function(RenderPass) {
3554
3557
  _proto.execute = function execute(renderer) {
3555
3558
  renderer.renderMeshes(this.meshes);
3556
3559
  };
3560
+ _proto.configure = function configure(renderer) {
3561
+ renderer.setFramebuffer(this.framebuffer);
3562
+ };
3557
3563
  return DrawGizmoFrontPass;
3558
3564
  }(EFFECTS.RenderPass);
3559
3565
  var DrawGizmoEditorPass = /*#__PURE__*/ function(RenderPass) {
3560
3566
  _inherits(DrawGizmoEditorPass, RenderPass);
3561
- function DrawGizmoEditorPass(renderer, options) {
3567
+ function DrawGizmoEditorPass(renderer) {
3562
3568
  var _this;
3563
- _this = RenderPass.call(this, renderer, options) || this;
3569
+ _this = RenderPass.call(this, renderer) || this;
3564
3570
  _this.priority = EFFECTS.RenderPassPriorityPostprocess + 2;
3565
3571
  _this.name = editorRenderPassName;
3566
3572
  return _this;
@@ -3569,6 +3575,9 @@ var DrawGizmoEditorPass = /*#__PURE__*/ function(RenderPass) {
3569
3575
  _proto.execute = function execute(renderer) {
3570
3576
  renderer.renderMeshes(this.meshes);
3571
3577
  };
3578
+ _proto.configure = function configure(renderer) {
3579
+ renderer.setFramebuffer(this.framebuffer);
3580
+ };
3572
3581
  return DrawGizmoEditorPass;
3573
3582
  }(EFFECTS.RenderPass);
3574
3583
 
@@ -3584,35 +3593,13 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3584
3593
  }
3585
3594
  var _proto = EditorGizmoPlugin.prototype;
3586
3595
  _proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {
3587
- var engine = composition.renderer.engine;
3588
- iconTextures.clear();
3589
- iconImages.forEach(function(image, name) {
3590
- iconTextures.set(name, createTexture(engine, image));
3591
- });
3592
- iconImages.clear();
3593
- };
3594
- _proto.onCompositionReset = function onCompositionReset(composition) {
3595
- var items = composition.items;
3596
- var targetMap = {};
3597
- for(var i = 0; i < items.length; i++){
3598
- var item = items[i];
3599
- var gizmoComponent = item.getComponent(exports.GizmoComponent);
3600
- if (gizmoComponent) {
3601
- if (!targetMap[gizmoComponent.target]) {
3602
- targetMap[gizmoComponent.target] = [];
3603
- }
3604
- targetMap[gizmoComponent.target].push(item);
3605
- }
3606
- }
3607
- composition.loaderData.gizmoTarget = targetMap;
3608
- composition.loaderData.gizmoItems = [];
3609
- };
3610
- EditorGizmoPlugin.prepareResource = function prepareResource(scene) {
3611
3596
  return _async_to_generator(function() {
3612
- var _iterator, _step, _step_value, name, data, _, _tmp;
3597
+ var engine, _iterator, _step, _step_value, name, data, _, _tmp, items, targetMap, i, item, gizmoComponent;
3613
3598
  return __generator(this, function(_state) {
3614
3599
  switch(_state.label){
3615
3600
  case 0:
3601
+ engine = composition.renderer.engine;
3602
+ iconTextures.clear();
3616
3603
  if (!(iconImages.size !== axisIconMap.size)) return [
3617
3604
  3,
3618
3605
  4
@@ -3644,9 +3631,26 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3644
3631
  1
3645
3632
  ];
3646
3633
  case 4:
3634
+ iconImages.forEach(function(image, name) {
3635
+ iconTextures.set(name, createTexture(engine, image));
3636
+ });
3637
+ iconImages.clear();
3638
+ items = composition.items;
3639
+ targetMap = {};
3640
+ for(i = 0; i < items.length; i++){
3641
+ item = items[i];
3642
+ gizmoComponent = item.getComponent(exports.GizmoComponent);
3643
+ if (gizmoComponent) {
3644
+ if (!targetMap[gizmoComponent.target]) {
3645
+ targetMap[gizmoComponent.target] = [];
3646
+ }
3647
+ targetMap[gizmoComponent.target].push(item);
3648
+ }
3649
+ }
3650
+ composition.loaderData.gizmoTarget = targetMap;
3651
+ composition.loaderData.gizmoItems = [];
3647
3652
  return [
3648
- 2,
3649
- true
3653
+ 2
3650
3654
  ];
3651
3655
  }
3652
3656
  });
@@ -3655,10 +3659,10 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3655
3659
  return EditorGizmoPlugin;
3656
3660
  }(EFFECTS.AbstractPlugin);
3657
3661
 
3658
- EFFECTS.registerPlugin("editor-gizmo", EditorGizmoPlugin, EFFECTS.VFXItem);
3662
+ EFFECTS.registerPlugin("editor-gizmo", EditorGizmoPlugin);
3659
3663
  /**
3660
3664
  * 插件版本号
3661
- */ var version = "2.8.0-alpha.1";
3665
+ */ var version = "2.8.0-alpha.2";
3662
3666
  EFFECTS.logger.info("Plugin editor gizmo version: " + version + ".");
3663
3667
  if (version !== EFFECTS__namespace.version) {
3664
3668
  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!");