Commit 4af55f4d authored by 李苏's avatar 李苏 💬

操作模型对象 try 保护

parent d78fbec1
......@@ -2,7 +2,7 @@
* @Description:
* @Author: lisu lisu@gavelinfo.com
* @LastEditors: lisu lisu@gavelinfo.com
* @LastEditTime: 2024-10-08 16:51:55
* @LastEditTime: 2024-10-10 15:08:18
* @FilePath: /zghywpc-vue/src/views/yhlywsytst/yhlywsytst/index.vue
-->
<template>
......@@ -1504,63 +1504,55 @@
return
}
let model
/* 测试判定,实际根据模型实际特征来判定*/
// if (intersects[0].object.name == '') {
// model = intersects[1].object
// } else {
// model = intersects[0].object
// }
let modelIndex = intersects.findIndex(item=>item.object.name!==''&&item.object.visible==true)
if(modelIndex!=-1){
rconsole.log(`当前选中${modelIndex}`)
model=intersects[modelIndex].object
}else{
console.log('本次选中不存在name的节点')
}
/* 当模型隐藏 不继续触发*/
if (model.visible == false) {
rconsole.log('当前对象已屏蔽')
return
}
this.selectedModel = model
// model.visible=false
/* 执行并情况材料队列 */
this.reMaterialQue.forEach(item => {
item.revert()
})
this.reMaterialQue.splice(0, this.reMaterialQue.length)
/* 添加材质模型队列*/
let reMaterialQueItem = {
model,
material: model.material.clone(),
revert: function() {
this.model.material = this.material
}
try{
let model
let modelIndex = intersects.findIndex(item=>item.object.name!==''&&item.object.visible==true)
if(modelIndex!=-1){
rconsole.log(`当前选中${modelIndex}`)
model=intersects[modelIndex].object
}else{
console.log('本次选中不存在name的节点')
}
/* 当模型隐藏 不继续触发*/
if (model.visible == false) {
rconsole.log('当前对象已屏蔽')
return
}
this.selectedModel = model
// model.visible=false
/* 执行并情况材料队列 */
this.reMaterialQue.forEach(item => {
item.revert()
})
this.reMaterialQue.splice(0, this.reMaterialQue.length)
/* 添加材质模型队列*/
let reMaterialQueItem = {
model,
material: model.material.clone(),
revert: function() {
this.model.material = this.material
}
}
this.reMaterialQue.push(reMaterialQueItem)
model.material = new THREE.MeshPhongMaterial({
color: new THREE.Color('rgba(255, 255, 0, 0.8)'),
transparent: true,
opacity: 0.8,
wireframe: false,
})
}catch(e){
rconsole.log(e)
}
this.reMaterialQue.push(reMaterialQueItem)
model.material = new THREE.MeshPhongMaterial({
color: new THREE.Color('rgba(255, 255, 0, 0.8)'),
transparent: true,
opacity: 0.8,
wireframe: false,
})
/* */
// if (this.xzjj) {
// const object = model;
// if (object) {
// this.viewer.cameraControl.fitTo(object);
// }
// }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment