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.
package/dist/three-editor.es.js
CHANGED
|
@@ -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
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
const
|
|
5306
|
-
if (
|
|
5307
|
-
for (const
|
|
5308
|
-
const
|
|
5309
|
-
if (
|
|
5310
|
-
return
|
|
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(
|
|
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((
|
|
5845
|
+
if (C.scene = A, !A.children.some((f) => f.type === "AmbientLight"))
|
|
5841
5846
|
if (i) {
|
|
5842
|
-
const
|
|
5843
|
-
|
|
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
|
|
5850
|
-
|
|
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
|
|
5854
|
-
|
|
5855
|
-
}
|
|
5856
|
-
bi(A)
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
const
|
|
5861
|
-
|
|
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") {
|