|
@@ -12,8 +12,8 @@ export default {
|
|
gltfLayouts: [],
|
|
gltfLayouts: [],
|
|
instancedFurList:[],
|
|
instancedFurList:[],
|
|
|
|
|
|
- graderGltfLayouts: [],//花园地块的模型对象
|
|
|
|
- graderInstancedFurList:[],//花园地块的模型
|
|
|
|
|
|
+ // graderGltfLayouts: [],//花园地块的模型对象
|
|
|
|
+ // graderInstancedFurList:[],//花园地块的模型
|
|
|
|
|
|
arrFrunList:[],
|
|
arrFrunList:[],
|
|
promise_list:[],
|
|
promise_list:[],
|
|
@@ -22,7 +22,7 @@ export default {
|
|
tmpList:[],
|
|
tmpList:[],
|
|
realList:[],
|
|
realList:[],
|
|
nextString:'_simple',//精简模型后缀
|
|
nextString:'_simple',//精简模型后缀
|
|
- lastFrunList:[],
|
|
|
|
|
|
+ // lastFrunList:[],
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {},
|
|
watch: {},
|
|
@@ -439,11 +439,6 @@ export default {
|
|
},
|
|
},
|
|
// 删除对应空间家具模型
|
|
// 删除对应空间家具模型
|
|
deleteLayoutModel(spaceObj, layoutObj){
|
|
deleteLayoutModel(spaceObj, layoutObj){
|
|
- if(!layoutObj){//删除完家具模型后,修改空间的布局id为0,表示当前空间不存在布局了
|
|
|
|
- spaceObj.delateLayoutId = true;//当前空间已经删除了家具模型
|
|
|
|
- }else{
|
|
|
|
- spaceObj.delateLayoutId = false;
|
|
|
|
- }
|
|
|
|
const oldLayoutIndex = this.arrFrunList.findIndex((item)=>{
|
|
const oldLayoutIndex = this.arrFrunList.findIndex((item)=>{
|
|
return item.id == spaceObj.layoutId
|
|
return item.id == spaceObj.layoutId
|
|
})
|
|
})
|
|
@@ -452,8 +447,11 @@ export default {
|
|
this.arrFrunList[oldLayoutIndex] = layoutObj
|
|
this.arrFrunList[oldLayoutIndex] = layoutObj
|
|
// this.arrFrunList.splice(oldLayoutIndex,1)
|
|
// this.arrFrunList.splice(oldLayoutIndex,1)
|
|
}
|
|
}
|
|
-
|
|
|
|
- console.log("准备删除模型", spaceObj, this.gltfLayouts);
|
|
|
|
|
|
+ if(!layoutObj){//当前空间不存在布局了
|
|
|
|
+ this.arrFrunList.splice(oldLayoutIndex,1)
|
|
|
|
+ spaceObj.layoutId = null;//为了确保传递到下一页的空间里面也没有布局信息,确保布局一致
|
|
|
|
+ }
|
|
|
|
+ console.log("准备删除模型", spaceObj,oldLayoutIndex, this.gltfLayouts);
|
|
//寻找当前空间下的所有家具模型对象
|
|
//寻找当前空间下的所有家具模型对象
|
|
const gltfLayoutModels = this.gltfLayouts.filter(item => {
|
|
const gltfLayoutModels = this.gltfLayouts.filter(item => {
|
|
return spaceObj.layoutId == item.userData.layoutId && spaceObj.spaceId == item.userData.spaceId;
|
|
return spaceObj.layoutId == item.userData.layoutId && spaceObj.spaceId == item.userData.spaceId;
|
|
@@ -484,7 +482,7 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.scene.remove(...deleList);//释放家具的资源,this.instancedFurList
|
|
this.scene.remove(...deleList);//释放家具的资源,this.instancedFurList
|
|
- console.log("删除模型了", spaceObj, this.gltfLayouts,this.lastFrunList);
|
|
|
|
|
|
+ console.log("删除模型了", spaceObj, this.gltfLayouts);
|
|
},
|
|
},
|
|
// 计算家具的位置
|
|
// 计算家具的位置
|
|
calculateLayoutModelSize() {
|
|
calculateLayoutModelSize() {
|
|
@@ -1112,12 +1110,19 @@ export default {
|
|
this.loadlayoutByID(layoutObj.groupType, element, resolve);
|
|
this.loadlayoutByID(layoutObj.groupType, element, resolve);
|
|
})
|
|
})
|
|
)
|
|
)
|
|
|
|
+ }else{//空间不存在布局,需要请求布局信息
|
|
|
|
+ promise_list.push(
|
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
|
+ this.loadlayoutByID(element.groupType, element, resolve);
|
|
|
|
+ })
|
|
|
|
+ )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Promise.all(promise_list).then(()=>{
|
|
Promise.all(promise_list).then(()=>{
|
|
this.$nextTick(()=>{
|
|
this.$nextTick(()=>{
|
|
console.log("新布局替换完成",this.changeLayouts, changeSpaces,this.arrFrunList.map(it=>it.id));
|
|
console.log("新布局替换完成",this.changeLayouts, changeSpaces,this.arrFrunList.map(it=>it.id));
|
|
this.furnHandle(this.changeLayouts, changeSpaces);//先加载变化的空间的布局
|
|
this.furnHandle(this.changeLayouts, changeSpaces);//先加载变化的空间的布局
|
|
|
|
+ this.updataPageData();//更新数据
|
|
})
|
|
})
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -1160,8 +1165,9 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(layoutObj==null){
|
|
if(layoutObj==null){
|
|
- console.warn("没有合适的布局", layoutObj);
|
|
|
|
- // this.deleteLayoutModel(spaceObj, layoutObj);//删除当前的布局
|
|
|
|
|
|
+ console.warn("没有合适的布局", layoutObj,spaceObj.layoutId);
|
|
|
|
+ spaceObj.groupType = groupType;
|
|
|
|
+ this.deleteLayoutModel(spaceObj, layoutObj);//删除当前的布局
|
|
return resolve()
|
|
return resolve()
|
|
}
|
|
}
|
|
console.log("找出最合适的布局", layoutObj)
|
|
console.log("找出最合适的布局", layoutObj)
|