1
This commit is contained in:
15
index.html
15
index.html
@ -352,10 +352,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="category-content">
|
<div class="category-content">
|
||||||
<div class="option-group">
|
<div class="option-group">
|
||||||
<button class="option-btn" data-option="color-1">SPF111S1010C</button>
|
13
|
||||||
<button class="option-btn" data-option="color-2">SPF111S1010W</button>
|
<button class="option-btn" data-option="color-1">SPF111S1013W</button>
|
||||||
|
<button class="option-btn" data-option="color-2">SPF111S1013C</button>
|
||||||
|
<button class="option-btn" data-option="color-3">SPF111S1013TA</button>
|
||||||
|
10
|
||||||
|
<button class="option-btn" data-option="color-1">SPF111S1010W</button>
|
||||||
|
<button class="option-btn" data-option="color-2">SPF111S1010C</button>
|
||||||
<button class="option-btn" data-option="color-3">SPF111S1010TA</button>
|
<button class="option-btn" data-option="color-3">SPF111S1010TA</button>
|
||||||
<button class="option-btn" data-option="color-4">木色</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -749,9 +754,13 @@
|
|||||||
// 移除按钮事件
|
// 移除按钮事件
|
||||||
document.getElementById('remove-model-btn').addEventListener('click', () => {
|
document.getElementById('remove-model-btn').addEventListener('click', () => {
|
||||||
const pickedMesh = window.getCurrentPickedMesh();
|
const pickedMesh = window.getCurrentPickedMesh();
|
||||||
|
console.log(pickedMesh);
|
||||||
|
|
||||||
if (pickedMesh) {
|
if (pickedMesh) {
|
||||||
const meshName = pickedMesh.name;
|
const meshName = pickedMesh.name;
|
||||||
const modelName = kernel.model.findModelNameByMesh(pickedMesh);
|
const modelName = kernel.model.findModelNameByMesh(pickedMesh);
|
||||||
|
console.log(modelName);
|
||||||
|
|
||||||
const success = kernel.model.removeByName(modelName);
|
const success = kernel.model.removeByName(modelName);
|
||||||
if (success) {
|
if (success) {
|
||||||
console.log('模型已移除');
|
console.log('模型已移除');
|
||||||
|
|||||||
@ -436,11 +436,6 @@ export class AppModel extends Monobehiver {
|
|||||||
const keys = this.modelDic.Keys();
|
const keys = this.modelDic.Keys();
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
const meshes = this.modelDic.Get(key);
|
const meshes = this.modelDic.Get(key);
|
||||||
meshes.forEach(mesh => {
|
|
||||||
console.log(mesh.uniqueId);
|
|
||||||
console.log(mesh.name);
|
|
||||||
|
|
||||||
});
|
|
||||||
if (meshes?.some(m => m === mesh || m.uniqueId === mesh.uniqueId)) {
|
if (meshes?.some(m => m === mesh || m.uniqueId === mesh.uniqueId)) {
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
@ -501,18 +496,18 @@ export class AppModel extends Monobehiver {
|
|||||||
* 销毁指定模型
|
* 销毁指定模型
|
||||||
* @param modelName 模型名称
|
* @param modelName 模型名称
|
||||||
*/
|
*/
|
||||||
removeByName(modelName: string): void {
|
removeByName(modelName: string): boolean {
|
||||||
const meshes = this.modelDic.Get(modelName);
|
const meshes = this.modelDic.Get(modelName);
|
||||||
if (!meshes?.length) {
|
if (!meshes?.length) {
|
||||||
console.warn(`Model not found: ${modelName}`);
|
console.warn(`Model not found: ${modelName}`);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getModelTransformTargets(meshes).forEach(mesh => mesh.dispose(false, true));
|
this.getModelTransformTargets(meshes).forEach(mesh => mesh.dispose(false, true));
|
||||||
this.modelDic.Remove(modelName);
|
this.modelDic.Remove(modelName);
|
||||||
this.modelMetadataDic.Remove(modelName);
|
this.modelMetadataDic.Remove(modelName);
|
||||||
this.mainApp.gameManager?.updateDictionaries();
|
this.mainApp.gameManager?.updateDictionaries();
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,8 +34,8 @@ export class KernelAdapter {
|
|||||||
* 销毁指定模型
|
* 销毁指定模型
|
||||||
* @param modelName 模型名称
|
* @param modelName 模型名称
|
||||||
*/
|
*/
|
||||||
removeByName: (modelName: string): void => {
|
removeByName: (modelName: string): boolean => {
|
||||||
this.mainApp.appModel.removeByName(modelName);
|
return this.mainApp.appModel.removeByName(modelName);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 根据网格移除所属的整个模型
|
* 根据网格移除所属的整个模型
|
||||||
|
|||||||
Reference in New Issue
Block a user