@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.
package/dist/index.mjs CHANGED
@@ -3,11 +3,11 @@
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
  import * as EFFECTS from '@galacean/effects';
10
- import { glContext, Texture, noop, math, Geometry, Transform, Mesh, Material, DestroyOptions, GLSLVersion, GLGeometry, serialize, effectsClass, RendererComponent, ParticleSystemRenderer, assertExist, TextureLoadAction, HitTestType, spec, RenderPassPriorityPostprocess, RenderPass, RenderPassPriorityPrepare, AbstractPlugin, registerPlugin, VFXItem, logger } from '@galacean/effects';
10
+ import { glContext, Texture, noop, math, Geometry, Transform, Mesh, Material, DestroyOptions, GLSLVersion, GLGeometry, serialize, effectsClass, PluginSystem, RendererComponent, ParticleSystemRenderer, assertExist, TextureLoadAction, HitTestType, spec, RenderPassPriorityPostprocess, RenderPass, RenderPassPriorityPrepare, AbstractPlugin, registerPlugin, logger } from '@galacean/effects';
11
11
 
12
12
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
13
13
  try {
@@ -2995,8 +2995,8 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
2995
2995
  return;
2996
2996
  }
2997
2997
  var composition = this.item.composition;
2998
- var _composition_pluginSystem_plugins;
2999
- 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;){
2998
+ var _PluginSystem_getPlugins;
2999
+ for(var _iterator1 = _create_for_of_iterator_helper_loose((_PluginSystem_getPlugins = PluginSystem.getPlugins()) != null ? _PluginSystem_getPlugins : []), _step1; !(_step1 = _iterator1()).done;){
3000
3000
  var plugin = _step1.value;
3001
3001
  if (plugin.name === "editor-gizmo") {
3002
3002
  this.gizmoPlugin = plugin;
@@ -3462,7 +3462,7 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3462
3462
  return renderPass.name === behindRenderPassName;
3463
3463
  });
3464
3464
  if (!rp) {
3465
- rp = new DrawGizmoBehindPass(pipeline.renderer, {});
3465
+ rp = new DrawGizmoBehindPass(pipeline.renderer);
3466
3466
  pipeline.addRenderPass(rp);
3467
3467
  }
3468
3468
  return rp;
@@ -3472,7 +3472,7 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3472
3472
  return renderPass.name === editorRenderPassName;
3473
3473
  });
3474
3474
  if (!rp) {
3475
- rp = new DrawGizmoEditorPass(pipeline.renderer, {});
3475
+ rp = new DrawGizmoEditorPass(pipeline.renderer);
3476
3476
  pipeline.addRenderPass(rp);
3477
3477
  }
3478
3478
  return rp;
@@ -3482,7 +3482,7 @@ var GizmoComponent = /*#__PURE__*/ function(RendererComponent1) {
3482
3482
  return renderPass.name === frontRenderPassName;
3483
3483
  });
3484
3484
  if (!rp) {
3485
- rp = new DrawGizmoFrontPass(pipeline.renderer, {});
3485
+ rp = new DrawGizmoFrontPass(pipeline.renderer);
3486
3486
  pipeline.addRenderPass(rp);
3487
3487
  }
3488
3488
  return rp;
@@ -3502,9 +3502,9 @@ var CoordinateSpace;
3502
3502
  })(CoordinateSpace || (CoordinateSpace = {}));
3503
3503
  var DrawGizmoBehindPass = /*#__PURE__*/ function(RenderPass) {
3504
3504
  _inherits(DrawGizmoBehindPass, RenderPass);
3505
- function DrawGizmoBehindPass(renderer, options) {
3505
+ function DrawGizmoBehindPass(renderer) {
3506
3506
  var _this;
3507
- _this = RenderPass.call(this, renderer, options) || this;
3507
+ _this = RenderPass.call(this, renderer) || this;
3508
3508
  _this.priority = RenderPassPriorityPostprocess + RenderPassPriorityPostprocess;
3509
3509
  _this.name = behindRenderPassName;
3510
3510
  return _this;
@@ -3516,13 +3516,16 @@ var DrawGizmoBehindPass = /*#__PURE__*/ function(RenderPass) {
3516
3516
  });
3517
3517
  renderer.renderMeshes(this.meshes);
3518
3518
  };
3519
+ _proto.configure = function configure(renderer) {
3520
+ renderer.setFramebuffer(this.framebuffer);
3521
+ };
3519
3522
  return DrawGizmoBehindPass;
3520
3523
  }(RenderPass);
3521
3524
  var DrawGizmoFrontPass = /*#__PURE__*/ function(RenderPass) {
3522
3525
  _inherits(DrawGizmoFrontPass, RenderPass);
3523
- function DrawGizmoFrontPass(renderer, options) {
3526
+ function DrawGizmoFrontPass(renderer) {
3524
3527
  var _this;
3525
- _this = RenderPass.call(this, renderer, options) || this;
3528
+ _this = RenderPass.call(this, renderer) || this;
3526
3529
  _this.priority = RenderPassPriorityPrepare + 2;
3527
3530
  _this.name = frontRenderPassName;
3528
3531
  return _this;
@@ -3531,13 +3534,16 @@ var DrawGizmoFrontPass = /*#__PURE__*/ function(RenderPass) {
3531
3534
  _proto.execute = function execute(renderer) {
3532
3535
  renderer.renderMeshes(this.meshes);
3533
3536
  };
3537
+ _proto.configure = function configure(renderer) {
3538
+ renderer.setFramebuffer(this.framebuffer);
3539
+ };
3534
3540
  return DrawGizmoFrontPass;
3535
3541
  }(RenderPass);
3536
3542
  var DrawGizmoEditorPass = /*#__PURE__*/ function(RenderPass) {
3537
3543
  _inherits(DrawGizmoEditorPass, RenderPass);
3538
- function DrawGizmoEditorPass(renderer, options) {
3544
+ function DrawGizmoEditorPass(renderer) {
3539
3545
  var _this;
3540
- _this = RenderPass.call(this, renderer, options) || this;
3546
+ _this = RenderPass.call(this, renderer) || this;
3541
3547
  _this.priority = RenderPassPriorityPostprocess + 2;
3542
3548
  _this.name = editorRenderPassName;
3543
3549
  return _this;
@@ -3546,6 +3552,9 @@ var DrawGizmoEditorPass = /*#__PURE__*/ function(RenderPass) {
3546
3552
  _proto.execute = function execute(renderer) {
3547
3553
  renderer.renderMeshes(this.meshes);
3548
3554
  };
3555
+ _proto.configure = function configure(renderer) {
3556
+ renderer.setFramebuffer(this.framebuffer);
3557
+ };
3549
3558
  return DrawGizmoEditorPass;
3550
3559
  }(RenderPass);
3551
3560
 
@@ -3561,35 +3570,13 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3561
3570
  }
3562
3571
  var _proto = EditorGizmoPlugin.prototype;
3563
3572
  _proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {
3564
- var engine = composition.renderer.engine;
3565
- iconTextures.clear();
3566
- iconImages.forEach(function(image, name) {
3567
- iconTextures.set(name, createTexture(engine, image));
3568
- });
3569
- iconImages.clear();
3570
- };
3571
- _proto.onCompositionReset = function onCompositionReset(composition) {
3572
- var items = composition.items;
3573
- var targetMap = {};
3574
- for(var i = 0; i < items.length; i++){
3575
- var item = items[i];
3576
- var gizmoComponent = item.getComponent(GizmoComponent);
3577
- if (gizmoComponent) {
3578
- if (!targetMap[gizmoComponent.target]) {
3579
- targetMap[gizmoComponent.target] = [];
3580
- }
3581
- targetMap[gizmoComponent.target].push(item);
3582
- }
3583
- }
3584
- composition.loaderData.gizmoTarget = targetMap;
3585
- composition.loaderData.gizmoItems = [];
3586
- };
3587
- EditorGizmoPlugin.prepareResource = function prepareResource(scene) {
3588
3573
  return _async_to_generator(function() {
3589
- var _iterator, _step, _step_value, name, data, _, _tmp;
3574
+ var engine, _iterator, _step, _step_value, name, data, _, _tmp, items, targetMap, i, item, gizmoComponent;
3590
3575
  return __generator(this, function(_state) {
3591
3576
  switch(_state.label){
3592
3577
  case 0:
3578
+ engine = composition.renderer.engine;
3579
+ iconTextures.clear();
3593
3580
  if (!(iconImages.size !== axisIconMap.size)) return [
3594
3581
  3,
3595
3582
  4
@@ -3621,9 +3608,26 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3621
3608
  1
3622
3609
  ];
3623
3610
  case 4:
3611
+ iconImages.forEach(function(image, name) {
3612
+ iconTextures.set(name, createTexture(engine, image));
3613
+ });
3614
+ iconImages.clear();
3615
+ items = composition.items;
3616
+ targetMap = {};
3617
+ for(i = 0; i < items.length; i++){
3618
+ item = items[i];
3619
+ gizmoComponent = item.getComponent(GizmoComponent);
3620
+ if (gizmoComponent) {
3621
+ if (!targetMap[gizmoComponent.target]) {
3622
+ targetMap[gizmoComponent.target] = [];
3623
+ }
3624
+ targetMap[gizmoComponent.target].push(item);
3625
+ }
3626
+ }
3627
+ composition.loaderData.gizmoTarget = targetMap;
3628
+ composition.loaderData.gizmoItems = [];
3624
3629
  return [
3625
- 2,
3626
- true
3630
+ 2
3627
3631
  ];
3628
3632
  }
3629
3633
  });
@@ -3632,10 +3636,10 @@ var EditorGizmoPlugin = /*#__PURE__*/ function(AbstractPlugin) {
3632
3636
  return EditorGizmoPlugin;
3633
3637
  }(AbstractPlugin);
3634
3638
 
3635
- registerPlugin("editor-gizmo", EditorGizmoPlugin, VFXItem);
3639
+ registerPlugin("editor-gizmo", EditorGizmoPlugin);
3636
3640
  /**
3637
3641
  * 插件版本号
3638
- */ var version = "2.8.0-alpha.1";
3642
+ */ var version = "2.8.0-alpha.2";
3639
3643
  logger.info("Plugin editor gizmo version: " + version + ".");
3640
3644
  if (version !== EFFECTS.version) {
3641
3645
  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!");