@galacean/effects-plugin-editor-gizmo 2.8.0-alpha.0 → 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.0
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,13 +3485,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3485
3485
  return renderPass.name === behindRenderPassName;
3486
3486
  });
3487
3487
  if (!rp) {
3488
- rp = new EFFECTS.RenderPass(pipeline.renderer, {
3489
- name: behindRenderPassName,
3490
- priority: EFFECTS.RenderPassPriorityPostprocess + EFFECTS.RenderPassPriorityPostprocess,
3491
- clearAction: {
3492
- depthAction: EFFECTS.TextureLoadAction.clear
3493
- }
3494
- });
3488
+ rp = new DrawGizmoBehindPass(pipeline.renderer);
3495
3489
  pipeline.addRenderPass(rp);
3496
3490
  }
3497
3491
  return rp;
@@ -3501,10 +3495,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3501
3495
  return renderPass.name === editorRenderPassName;
3502
3496
  });
3503
3497
  if (!rp) {
3504
- rp = new EFFECTS.RenderPass(pipeline.renderer, {
3505
- name: editorRenderPassName,
3506
- priority: EFFECTS.RenderPassPriorityPostprocess + 2
3507
- });
3498
+ rp = new DrawGizmoEditorPass(pipeline.renderer);
3508
3499
  pipeline.addRenderPass(rp);
3509
3500
  }
3510
3501
  return rp;
@@ -3514,10 +3505,7 @@ exports.GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3514
3505
  return renderPass.name === frontRenderPassName;
3515
3506
  });
3516
3507
  if (!rp) {
3517
- rp = new EFFECTS.RenderPass(pipeline.renderer, {
3518
- name: frontRenderPassName,
3519
- priority: EFFECTS.RenderPassPriorityPrepare + 2
3520
- });
3508
+ rp = new DrawGizmoFrontPass(pipeline.renderer);
3521
3509
  pipeline.addRenderPass(rp);
3522
3510
  }
3523
3511
  return rp;
@@ -3535,6 +3523,63 @@ exports.CoordinateSpace = void 0;
3535
3523
  CoordinateSpace[CoordinateSpace["Local"] = 0] = "Local";
3536
3524
  CoordinateSpace[CoordinateSpace["World"] = 1] = "World";
3537
3525
  })(exports.CoordinateSpace || (exports.CoordinateSpace = {}));
3526
+ var DrawGizmoBehindPass = /*#__PURE__*/ function(RenderPass) {
3527
+ _inherits(DrawGizmoBehindPass, RenderPass);
3528
+ function DrawGizmoBehindPass(renderer) {
3529
+ var _this;
3530
+ _this = RenderPass.call(this, renderer) || this;
3531
+ _this.priority = EFFECTS.RenderPassPriorityPostprocess + EFFECTS.RenderPassPriorityPostprocess;
3532
+ _this.name = behindRenderPassName;
3533
+ return _this;
3534
+ }
3535
+ var _proto = DrawGizmoBehindPass.prototype;
3536
+ _proto.execute = function execute(renderer) {
3537
+ renderer.clear({
3538
+ depthAction: EFFECTS.TextureLoadAction.clear
3539
+ });
3540
+ renderer.renderMeshes(this.meshes);
3541
+ };
3542
+ _proto.configure = function configure(renderer) {
3543
+ renderer.setFramebuffer(this.framebuffer);
3544
+ };
3545
+ return DrawGizmoBehindPass;
3546
+ }(EFFECTS.RenderPass);
3547
+ var DrawGizmoFrontPass = /*#__PURE__*/ function(RenderPass) {
3548
+ _inherits(DrawGizmoFrontPass, RenderPass);
3549
+ function DrawGizmoFrontPass(renderer) {
3550
+ var _this;
3551
+ _this = RenderPass.call(this, renderer) || this;
3552
+ _this.priority = EFFECTS.RenderPassPriorityPrepare + 2;
3553
+ _this.name = frontRenderPassName;
3554
+ return _this;
3555
+ }
3556
+ var _proto = DrawGizmoFrontPass.prototype;
3557
+ _proto.execute = function execute(renderer) {
3558
+ renderer.renderMeshes(this.meshes);
3559
+ };
3560
+ _proto.configure = function configure(renderer) {
3561
+ renderer.setFramebuffer(this.framebuffer);
3562
+ };
3563
+ return DrawGizmoFrontPass;
3564
+ }(EFFECTS.RenderPass);
3565
+ var DrawGizmoEditorPass = /*#__PURE__*/ function(RenderPass) {
3566
+ _inherits(DrawGizmoEditorPass, RenderPass);
3567
+ function DrawGizmoEditorPass(renderer) {
3568
+ var _this;
3569
+ _this = RenderPass.call(this, renderer) || this;
3570
+ _this.priority = EFFECTS.RenderPassPriorityPostprocess + 2;
3571
+ _this.name = editorRenderPassName;
3572
+ return _this;
3573
+ }
3574
+ var _proto = DrawGizmoEditorPass.prototype;
3575
+ _proto.execute = function execute(renderer) {
3576
+ renderer.renderMeshes(this.meshes);
3577
+ };
3578
+ _proto.configure = function configure(renderer) {
3579
+ renderer.setFramebuffer(this.framebuffer);
3580
+ };
3581
+ return DrawGizmoEditorPass;
3582
+ }(EFFECTS.RenderPass);
3538
3583
 
3539
3584
  var iconImages = new Map();
3540
3585
  var iconTextures = new Map();
@@ -3548,35 +3593,13 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3548
3593
  }
3549
3594
  var _proto = EditorGizmoPlugin.prototype;
3550
3595
  _proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {
3551
- var engine = composition.renderer.engine;
3552
- iconTextures.clear();
3553
- iconImages.forEach(function(image, name) {
3554
- iconTextures.set(name, createTexture(engine, image));
3555
- });
3556
- iconImages.clear();
3557
- };
3558
- _proto.onCompositionReset = function onCompositionReset(composition) {
3559
- var items = composition.items;
3560
- var targetMap = {};
3561
- for(var i = 0; i < items.length; i++){
3562
- var item = items[i];
3563
- var gizmoComponent = item.getComponent(exports.GizmoComponent);
3564
- if (gizmoComponent) {
3565
- if (!targetMap[gizmoComponent.target]) {
3566
- targetMap[gizmoComponent.target] = [];
3567
- }
3568
- targetMap[gizmoComponent.target].push(item);
3569
- }
3570
- }
3571
- composition.loaderData.gizmoTarget = targetMap;
3572
- composition.loaderData.gizmoItems = [];
3573
- };
3574
- EditorGizmoPlugin.prepareResource = function prepareResource(scene) {
3575
3596
  return _async_to_generator(function() {
3576
- var _iterator, _step, _step_value, name, data, _, _tmp;
3597
+ var engine, _iterator, _step, _step_value, name, data, _, _tmp, items, targetMap, i, item, gizmoComponent;
3577
3598
  return __generator(this, function(_state) {
3578
3599
  switch(_state.label){
3579
3600
  case 0:
3601
+ engine = composition.renderer.engine;
3602
+ iconTextures.clear();
3580
3603
  if (!(iconImages.size !== axisIconMap.size)) return [
3581
3604
  3,
3582
3605
  4
@@ -3608,9 +3631,26 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3608
3631
  1
3609
3632
  ];
3610
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 = [];
3611
3652
  return [
3612
- 2,
3613
- true
3653
+ 2
3614
3654
  ];
3615
3655
  }
3616
3656
  });
@@ -3619,10 +3659,10 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3619
3659
  return EditorGizmoPlugin;
3620
3660
  }(EFFECTS.AbstractPlugin);
3621
3661
 
3622
- EFFECTS.registerPlugin("editor-gizmo", EditorGizmoPlugin, EFFECTS.VFXItem);
3662
+ EFFECTS.registerPlugin("editor-gizmo", EditorGizmoPlugin);
3623
3663
  /**
3624
3664
  * 插件版本号
3625
- */ var version = "2.8.0-alpha.0";
3665
+ */ var version = "2.8.0-alpha.2";
3626
3666
  EFFECTS.logger.info("Plugin editor gizmo version: " + version + ".");
3627
3667
  if (version !== EFFECTS__namespace.version) {
3628
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!");