endset_three_editor 0.10.11 → 0.10.13

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.
@@ -5237,6 +5237,11 @@ function Ja() {
5237
5237
  r === 0 || e === 0 || (C.camera.aspect = r / e, C.camera.updateProjectionMatrix(), C.renderer.setSize(r, e), Ye && Ye.setSize(r, e), Tr(r, e));
5238
5238
  }
5239
5239
  function ds(r) {
5240
+ let e = r;
5241
+ for (; e; ) {
5242
+ if (e.isTransformControlsRoot) return;
5243
+ e = e.parent;
5244
+ }
5240
5245
  C.selectedObject !== r && (C.selectedObject && C.transformControls.detach(), C.selectedObject = r, C.transformControls.attach(r), C.transformControls.setMode(C.transformControlsMode), C.transformControls.showX = !0, C.transformControls.showY = !0, C.transformControls.showZ = !0, mi(r), ot == null || ot(r));
5241
5246
  }
5242
5247
  let xe = null;
@@ -5298,18 +5303,18 @@ function el(r) {
5298
5303
  -((r.clientY - e.top) / e.height) * 2 + 1
5299
5304
  ), n = new O.Raycaster();
5300
5305
  n.setFromCamera(t, C.camera);
5301
- const s = [];
5302
- C.scene.traverse((o) => {
5303
- o.isTransformControlsRoot || o.isTransformControlsGizmo || o.isTransformControlsPlane || (o.userData.isMovable || o.userData.type === "lightHelper") && s.push(o);
5304
- });
5305
- const i = n.intersectObjects(s);
5306
- if (i.length === 0) return null;
5307
- for (const o of i) {
5308
- const a = Pn(o.object);
5309
- if (a !== C.selectedObject)
5310
- return a;
5306
+ const s = [], i = (a) => {
5307
+ a.isTransformControlsRoot || ((a.userData.isMovable || a.userData.type === "lightHelper") && s.push(a), a.children.forEach(i));
5308
+ };
5309
+ i(C.scene);
5310
+ const o = n.intersectObjects(s);
5311
+ if (o.length === 0) return null;
5312
+ for (const a of o) {
5313
+ const l = Pn(a.object);
5314
+ if (l !== C.selectedObject)
5315
+ return l;
5311
5316
  }
5312
- return Pn(i[0].object);
5317
+ return Pn(o[0].object);
5313
5318
  }
5314
5319
  function Pn(r) {
5315
5320
  var t;
@@ -5837,29 +5842,30 @@ async function wl(r, e = "edit", t, n, s, i, o) {
5837
5842
  const a = Cl(r);
5838
5843
  if (a) {
5839
5844
  const m = await new ai().parseAsync(a, ""), A = m.scene || ((l = m.scenes) == null ? void 0 : l[0]), I = (c = C.scene) == null ? void 0 : c.environment;
5840
- if (C.scene = A, !A.children.some((w) => w.type === "AmbientLight"))
5845
+ if (C.scene = A, !A.children.some((f) => f.type === "AmbientLight"))
5841
5846
  if (i) {
5842
- const w = new O.AmbientLight(i.color, i.intensity);
5843
- w.name = i.name || "环境光", w.visible = i.visible ?? !0, i.position && w.position.fromArray(i.position), A.add(w);
5847
+ const f = new O.AmbientLight(i.color, i.intensity);
5848
+ f.name = i.name || "环境光", f.visible = i.visible ?? !0, i.position && f.position.fromArray(i.position), A.add(f);
5844
5849
  } else
5845
5850
  hi(A);
5846
5851
  if (I)
5847
5852
  C.scene.environment = I, C.scene.environmentIntensity = 1;
5848
5853
  else if (C.renderer) {
5849
- const w = Jt(C.renderer);
5850
- w && (C.scene.environment = w, C.scene.environmentIntensity = 1);
5854
+ const f = Jt(C.renderer);
5855
+ f && (C.scene.environment = f, C.scene.environmentIntensity = 1);
5851
5856
  }
5852
5857
  if (!C.scene.environment && C.renderer) {
5853
- const w = Jt(C.renderer);
5854
- w ? (C.scene.environment = w, C.scene.environmentIntensity = 1, console.warn("[导入] 原环境贴图不可用,已重新生成")) : console.error("[导入] 环境贴图生成失败,场景将没有 IBL 间接光照,模型会偏暗");
5855
- }
5856
- bi(A), A.traverse((w) => {
5857
- if (w.isTransformControlsRoot || w.isTransformControlsGizmo || w.isTransformControlsPlane)
5858
- return;
5859
- w.type !== "AmbientLight" && w.userData.type !== "lightHelper" && w.userData.type !== "initFloor" && (w.userData.isMovable = !0);
5860
- const f = w.material;
5861
- w.userData.isWater && f && !f.uniforms && !w.userData.waterSpeed && (w.userData.waterSpeed = { x: 5e-4, y: 5e-4 });
5862
- });
5858
+ const f = Jt(C.renderer);
5859
+ f ? (C.scene.environment = f, C.scene.environmentIntensity = 1, console.warn("[导入] 原环境贴图不可用,已重新生成")) : console.error("[导入] 环境贴图生成失败,场景将没有 IBL 间接光照,模型会偏暗");
5860
+ }
5861
+ bi(A);
5862
+ const w = (f) => {
5863
+ if (f.isTransformControlsRoot) return;
5864
+ f.type !== "AmbientLight" && f.userData.type !== "lightHelper" && f.userData.type !== "initFloor" && (f.userData.isMovable = !0);
5865
+ const h = f.material;
5866
+ f.userData.isWater && h && !h.uniforms && !f.userData.waterSpeed && (f.userData.waterSpeed = { x: 5e-4, y: 5e-4 }), f.children.forEach(w);
5867
+ };
5868
+ w(A);
5863
5869
  } else {
5864
5870
  const m = typeof r == "string" ? JSON.parse(r) : r, I = new O.ObjectLoader().parse(m);
5865
5871
  if (I.type === "Scene") {