endset_three_editor 0.10.11 → 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.
package/dist/three-editor.es.js
CHANGED
|
@@ -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
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
const
|
|
5306
|
-
if (
|
|
5307
|
-
for (const
|
|
5308
|
-
const
|
|
5309
|
-
if (
|
|
5310
|
-
return
|
|
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(
|
|
5312
|
+
return Pn(o[0].object);
|
|
5313
5313
|
}
|
|
5314
5314
|
function Pn(r) {
|
|
5315
5315
|
var t;
|
|
@@ -5837,29 +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((
|
|
5840
|
+
if (C.scene = A, !A.children.some((f) => f.type === "AmbientLight"))
|
|
5841
5841
|
if (i) {
|
|
5842
|
-
const
|
|
5843
|
-
|
|
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
|
|
5850
|
-
|
|
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
|
|
5854
|
-
|
|
5855
|
-
}
|
|
5856
|
-
bi(A)
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
const
|
|
5861
|
-
|
|
5862
|
-
}
|
|
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);
|
|
5863
5864
|
} else {
|
|
5864
5865
|
const m = typeof r == "string" ? JSON.parse(r) : r, I = new O.ObjectLoader().parse(m);
|
|
5865
5866
|
if (I.type === "Scene") {
|