vis-core 0.28.15 → 0.28.16
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/editor/command/AddMaterial.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.module.js +61 -19
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -88,7 +88,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
|
|
|
88
88
|
).toString(CryptoJS.enc.Utf8), Ne = JSON.parse(Pe), Ae = Date.now();
|
|
89
89
|
return !Ne.s || Ne.s > Ae ? (this.token = void 0, "") : Ne.e && Ne.e < Ae ? (this.token = void 0, "") : (Ne.isValid = O, Ne);
|
|
90
90
|
}
|
|
91
|
-
}, version = "0.28.
|
|
91
|
+
}, version = "0.28.16";
|
|
92
92
|
/**
|
|
93
93
|
* @license
|
|
94
94
|
* Copyright 2010-2025 Three.js Authors
|
|
@@ -58425,6 +58425,13 @@ class SetMaterialColor extends Command {
|
|
|
58425
58425
|
this.materialSlot
|
|
58426
58426
|
), this.attributeName = t.attributeName, this.oldValue = t.oldValue, this.newValue = t.newValue;
|
|
58427
58427
|
}
|
|
58428
|
+
fixJSON() {
|
|
58429
|
+
const t = this.json;
|
|
58430
|
+
if (this.material) {
|
|
58431
|
+
const r = this.editor.pencil.mList.getKey(this.material);
|
|
58432
|
+
r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58433
|
+
}
|
|
58434
|
+
}
|
|
58428
58435
|
}
|
|
58429
58436
|
class SetMaterial extends Command {
|
|
58430
58437
|
constructor(t, r, m, v) {
|
|
@@ -58459,7 +58466,7 @@ class SetMaterial extends Command {
|
|
|
58459
58466
|
const t = this.json;
|
|
58460
58467
|
if (t && t.oldMaterial && delete t.oldMaterial, this.oldMaterial) {
|
|
58461
58468
|
const r = this.editor.pencil.mList.getKey(this.oldMaterial);
|
|
58462
|
-
r && r !== t.objectUuid && (console.warn("SetMaterial:fix:", t.objectUuid, r), t.objectUuid = r);
|
|
58469
|
+
r && r !== t.objectUuid && (console.warn("SetMaterial:fix:", t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58463
58470
|
}
|
|
58464
58471
|
}
|
|
58465
58472
|
}
|
|
@@ -58521,7 +58528,10 @@ class SetMaterialMap extends Command {
|
|
|
58521
58528
|
}
|
|
58522
58529
|
fixJSON() {
|
|
58523
58530
|
const t = this.json;
|
|
58524
|
-
t && t.oldMap && delete t.oldMap
|
|
58531
|
+
if (t && t.oldMap && delete t.oldMap, this.material) {
|
|
58532
|
+
const r = this.editor.pencil.mList.getKey(this.material);
|
|
58533
|
+
r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58534
|
+
}
|
|
58525
58535
|
}
|
|
58526
58536
|
}
|
|
58527
58537
|
function parseTexture(g) {
|
|
@@ -58591,9 +58601,7 @@ class SetMaterialValue extends Command {
|
|
|
58591
58601
|
super(t), this.type = "SetMaterialValue", this.name = `Set Material.${m}`, this.updatable = !0, this.object = r, this.materialSlot = C, this.material = this.editor.getObjectMaterial(r, C), this.oldValue = this.material !== void 0 ? this.material[m] : void 0, this.newValue = v, this.attributeName = m;
|
|
58592
58602
|
}
|
|
58593
58603
|
execute() {
|
|
58594
|
-
this.material !== void 0 && (this.material[this.attributeName] = this.newValue, needsUpdateAttributeName.includes(this.attributeName) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material),
|
|
58595
|
-
this.attributeName === "name" && this.editor.emit("mListChange");
|
|
58596
|
-
}));
|
|
58604
|
+
this.material !== void 0 && (this.material[this.attributeName] = this.newValue, needsUpdateAttributeName.includes(this.attributeName) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material), this.attributeName === "name" && this.editor.emit("mListChange"));
|
|
58597
58605
|
}
|
|
58598
58606
|
undo() {
|
|
58599
58607
|
this.material[this.attributeName] = this.oldValue, needsUpdateAttributeName.includes(this.attributeName) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material), setTimeout(() => {
|
|
@@ -58613,6 +58621,13 @@ class SetMaterialValue extends Command {
|
|
|
58613
58621
|
this.materialSlot
|
|
58614
58622
|
);
|
|
58615
58623
|
}
|
|
58624
|
+
fixJSON() {
|
|
58625
|
+
const t = this.json;
|
|
58626
|
+
if (this.material) {
|
|
58627
|
+
const r = this.editor.pencil.mList.getKey(this.material);
|
|
58628
|
+
r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58629
|
+
}
|
|
58630
|
+
}
|
|
58616
58631
|
}
|
|
58617
58632
|
class SetMaterialVector extends Command {
|
|
58618
58633
|
constructor(t, r, m, v, C) {
|
|
@@ -58637,6 +58652,13 @@ class SetMaterialVector extends Command {
|
|
|
58637
58652
|
this.materialSlot
|
|
58638
58653
|
), this.attributeName = t.attributeName, this.oldValue = t.oldValue, this.newValue = t.newValue;
|
|
58639
58654
|
}
|
|
58655
|
+
fixJSON() {
|
|
58656
|
+
const t = this.json;
|
|
58657
|
+
if (this.material) {
|
|
58658
|
+
const r = this.editor.pencil.mList.getKey(this.material);
|
|
58659
|
+
r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58660
|
+
}
|
|
58661
|
+
}
|
|
58640
58662
|
}
|
|
58641
58663
|
class SetMaterialMapVector extends Command {
|
|
58642
58664
|
constructor(t, r, m, v, C, _ = "repeat") {
|
|
@@ -58672,6 +58694,13 @@ class SetMaterialMapVector extends Command {
|
|
|
58672
58694
|
this.materialSlot
|
|
58673
58695
|
), this.attributeName = t.attributeName, t.attributeName2 && (this.attributeName2 = t.attributeName2), this.oldValue = t.oldValue, this.newValue = t.newValue, this.attributeName === "repeat" && (this.attributeName = "map");
|
|
58674
58696
|
}
|
|
58697
|
+
fixJSON() {
|
|
58698
|
+
const t = this.json;
|
|
58699
|
+
if (this.material) {
|
|
58700
|
+
const r = this.editor.pencil.mList.getKey(this.material);
|
|
58701
|
+
r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58702
|
+
}
|
|
58703
|
+
}
|
|
58675
58704
|
}
|
|
58676
58705
|
class SetPosition extends Command {
|
|
58677
58706
|
constructor(t, r, m, v, C) {
|
|
@@ -58760,11 +58789,13 @@ class SetValue extends Command {
|
|
|
58760
58789
|
}
|
|
58761
58790
|
fixObj() {
|
|
58762
58791
|
const t = this.properties ? this.object[this.properties] : this.object;
|
|
58763
|
-
t.isCamera && ["fov", "left", "right", "top", "bottom", "near", "far"].includes(
|
|
58792
|
+
if (t.isCamera && ["fov", "left", "right", "top", "bottom", "near", "far"].includes(
|
|
58764
58793
|
this.attributeName
|
|
58765
|
-
) && t.updateProjectionMatrix(),
|
|
58766
|
-
|
|
58767
|
-
|
|
58794
|
+
) && t.updateProjectionMatrix(), this.attributeName === "visible") {
|
|
58795
|
+
const r = this.editor.pencil.lead.objMap.get(this.object);
|
|
58796
|
+
r && r[t[this.attributeName] ? "show" : "hide"]();
|
|
58797
|
+
}
|
|
58798
|
+
(this.attributeName === "name" || this.attributeName === "prefab" || this.attributeName === "visible" || this.attributeName === "keepCamera") && this.editor.emit("baseObjectListChange");
|
|
58768
58799
|
}
|
|
58769
58800
|
undo() {
|
|
58770
58801
|
const t = this.properties ? this.object[this.properties] : this.object;
|
|
@@ -58927,26 +58958,37 @@ class AddMaterial extends Command {
|
|
|
58927
58958
|
constructor(r, m) {
|
|
58928
58959
|
super(r);
|
|
58929
58960
|
L0(this, "materialType");
|
|
58961
|
+
L0(this, "flag", !1);
|
|
58930
58962
|
L0(this, "addObjectUuid");
|
|
58931
58963
|
this.type = "AddMaterial", this.name = "Add Material", this.materialType = m;
|
|
58932
58964
|
}
|
|
58933
58965
|
execute() {
|
|
58934
58966
|
return H0(this, null, function* () {
|
|
58935
58967
|
this.addObjectUuid = `material_${this.id}`;
|
|
58936
|
-
const r = this.editor.pencil.mList
|
|
58968
|
+
const r = this.editor.pencil.mList;
|
|
58969
|
+
let m;
|
|
58970
|
+
if (this.materialType.startsWith("k:")) {
|
|
58971
|
+
const v = this.materialType.match(/k:([^|]+)\|s:([^|]+)/);
|
|
58972
|
+
if (v) {
|
|
58973
|
+
const C = v[1], _ = v[2], w = this.editor.pencil.lead.getObject(C);
|
|
58974
|
+
if (w) {
|
|
58975
|
+
const E = w.object3d;
|
|
58976
|
+
m = Array.isArray(E.material) ? E.material[+_] : E.material, this.flag = !0;
|
|
58977
|
+
} else
|
|
58978
|
+
console.warn(`Base object with key ${C} not found.`), m = new MeshBasicMaterial();
|
|
58979
|
+
} else
|
|
58980
|
+
console.warn(`Material type ${this.materialType} is not valid.`), m = new MeshBasicMaterial();
|
|
58981
|
+
} else this.materialType === "MeshLineMaterial" ? m = new Te$1({
|
|
58937
58982
|
color: new Color$1(16777215),
|
|
58938
58983
|
lineWidth: 1,
|
|
58939
58984
|
sizeAttenuation: 0
|
|
58940
|
-
}) : (
|
|
58941
|
-
|
|
58942
|
-
new THREE[this.materialType]()
|
|
58943
|
-
);
|
|
58944
|
-
m.name = `材质_${this.id}`, r.add(this.addObjectUuid, m);
|
|
58985
|
+
}) : m = new THREE[this.materialType]();
|
|
58986
|
+
m.name = `材质_${this.id}`, r.add(this.addObjectUuid, m), this.flag && this.editor.emit("materialChanged");
|
|
58945
58987
|
});
|
|
58946
58988
|
}
|
|
58947
58989
|
undo() {
|
|
58948
58990
|
return H0(this, null, function* () {
|
|
58949
|
-
this.editor.pencil.mList.remove(this.addObjectUuid);
|
|
58991
|
+
this.editor.pencil.mList.remove(this.addObjectUuid), this.flag && this.editor.emit("materialChanged");
|
|
58950
58992
|
});
|
|
58951
58993
|
}
|
|
58952
58994
|
toJSON() {
|
|
@@ -59330,7 +59372,7 @@ class History {
|
|
|
59330
59372
|
const Ne = parseInt(Pe.url.replace("$rp-", ""));
|
|
59331
59373
|
Pe._url ? (Pe.url = Bi(Q0({}, Pe._url), {
|
|
59332
59374
|
data: decodeUrlSafeBase64ToArrayBuffer(m[Ne])
|
|
59333
|
-
}), delete Pe._url) : Pe.url = m[Ne]
|
|
59375
|
+
}), delete Pe._url) : Pe.url = m[Ne];
|
|
59334
59376
|
}
|
|
59335
59377
|
});
|
|
59336
59378
|
}
|
|
@@ -59372,7 +59414,7 @@ class History {
|
|
|
59372
59414
|
return H0(this, null, function* () {
|
|
59373
59415
|
t.fromJSON(t.json);
|
|
59374
59416
|
try {
|
|
59375
|
-
!["AddObject", "CopyMaterial", "RemoveMaterial"].includes(t.json.type) && t.json.objectUuid && !t.object || (yield t.execute(), t.fixJSON());
|
|
59417
|
+
!["AddObject", "CopyMaterial", "RemoveMaterial"].includes(t.json.type) && t.json.objectUuid && !t.object || (yield t.execute(), this.editor.playing || t.fixJSON());
|
|
59376
59418
|
} catch (r) {
|
|
59377
59419
|
console.error(r, t);
|
|
59378
59420
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.28.
|
|
1
|
+
declare const _default: "0.28.16";
|
|
2
2
|
export default _default;
|