endset_three_editor 0.10.10 → 0.10.12

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.
@@ -5298,18 +5298,18 @@ function el(r) {
5298
5298
  -((r.clientY - e.top) / e.height) * 2 + 1
5299
5299
  ), n = new O.Raycaster();
5300
5300
  n.setFromCamera(t, C.camera);
5301
- const s = [];
5302
- C.scene.traverse((o) => {
5303
- (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;
5301
+ const s = [], i = (a) => {
5302
+ a.isTransformControlsRoot || ((a.userData.isMovable || a.userData.type === "lightHelper") && s.push(a), a.children.forEach(i));
5303
+ };
5304
+ i(C.scene);
5305
+ const o = n.intersectObjects(s);
5306
+ if (o.length === 0) return null;
5307
+ for (const a of o) {
5308
+ const l = Pn(a.object);
5309
+ if (l !== C.selectedObject)
5310
+ return l;
5311
5311
  }
5312
- return Pn(i[0].object);
5312
+ return Pn(o[0].object);
5313
5313
  }
5314
5314
  function Pn(r) {
5315
5315
  var t;
@@ -5837,27 +5837,30 @@ async function wl(r, e = "edit", t, n, s, i, o) {
5837
5837
  const a = Cl(r);
5838
5838
  if (a) {
5839
5839
  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"))
5840
+ if (C.scene = A, !A.children.some((f) => f.type === "AmbientLight"))
5841
5841
  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);
5842
+ const f = new O.AmbientLight(i.color, i.intensity);
5843
+ f.name = i.name || "环境光", f.visible = i.visible ?? !0, i.position && f.position.fromArray(i.position), A.add(f);
5844
5844
  } else
5845
5845
  hi(A);
5846
5846
  if (I)
5847
5847
  C.scene.environment = I, C.scene.environmentIntensity = 1;
5848
5848
  else if (C.renderer) {
5849
- const w = Jt(C.renderer);
5850
- w && (C.scene.environment = w, C.scene.environmentIntensity = 1);
5849
+ const f = Jt(C.renderer);
5850
+ f && (C.scene.environment = f, C.scene.environmentIntensity = 1);
5851
5851
  }
5852
5852
  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
- w.type !== "AmbientLight" && w.userData.type !== "lightHelper" && w.userData.type !== "initFloor" && (w.userData.isMovable = !0);
5858
- const f = w.material;
5859
- w.userData.isWater && f && !f.uniforms && !w.userData.waterSpeed && (w.userData.waterSpeed = { x: 5e-4, y: 5e-4 });
5860
- });
5853
+ const f = Jt(C.renderer);
5854
+ f ? (C.scene.environment = f, C.scene.environmentIntensity = 1, console.warn("[导入] 原环境贴图不可用,已重新生成")) : console.error("[导入] 环境贴图生成失败,场景将没有 IBL 间接光照,模型会偏暗");
5855
+ }
5856
+ bi(A);
5857
+ const w = (f) => {
5858
+ if (f.isTransformControlsRoot) return;
5859
+ f.type !== "AmbientLight" && f.userData.type !== "lightHelper" && f.userData.type !== "initFloor" && (f.userData.isMovable = !0);
5860
+ const h = f.material;
5861
+ f.userData.isWater && h && !h.uniforms && !f.userData.waterSpeed && (f.userData.waterSpeed = { x: 5e-4, y: 5e-4 }), f.children.forEach(w);
5862
+ };
5863
+ w(A);
5861
5864
  } else {
5862
5865
  const m = typeof r == "string" ? JSON.parse(r) : r, I = new O.ObjectLoader().parse(m);
5863
5866
  if (I.type === "Scene") {