同步最新的源代码

This commit is contained in:
ChenX
2023-02-17 09:40:24 +08:00
parent 6c7fce6930
commit 8f005232a8
229 changed files with 1036 additions and 436 deletions

View File

@@ -198,6 +198,7 @@ class IHostApplicationServices {
this.ShowHistoryLog = true;
this.Physical2EdgeColor = 7; //真实视图带线框的线框颜色 默认白色
this.ConceptualEdgeColor = 7; //概念线框的颜色
this.ConceptualOpacity = 1; //概念透明的透明度
this.DrawWallBottomFace = false; //绘制底面
//#region _RenderType 渲染类型
this._renderType = exports.RenderType.Wireframe;
@@ -263,6 +264,9 @@ __decorate([
__decorate([
ProxyValue
], IHostApplicationServices.prototype, "ConceptualEdgeColor", void 0);
__decorate([
ProxyValue
], IHostApplicationServices.prototype, "ConceptualOpacity", void 0);
__decorate([
ProxyValue
], IHostApplicationServices.prototype, "_renderType", void 0);
@@ -696,12 +700,18 @@ class CADFiler {
this._datas.push(data);
return this;
}
WriteBool(v) {
this.Write(v ? 1 : 0);
}
WriteVec3(v3) {
this._datas.push(v3.x, v3.y, v3.z);
}
Read() {
return this._datas[this.readIndex++];
}
ReadBool(v) {
return Boolean(this.Read());
}
ReadArray(count) {
let arr = this._datas.slice(this.readIndex, this.readIndex + count);
this.readIndex += count;
@@ -1163,7 +1173,7 @@ exports.PhysicalMaterialRecord = class PhysicalMaterialRecord extends exports.Ma
this.material.needsUpdate = true;
});
this.material.needsUpdate = true;
if (this.useMap && this.map && !this.map.IsErase) {
if (this.useMap && this.map?.Object && !this.map.IsErase) {
let map = this.map.Object;
let texture = map.GetThreeTexture();
await map.WaitUpdate();
@@ -1182,7 +1192,7 @@ exports.PhysicalMaterialRecord = class PhysicalMaterialRecord extends exports.Ma
this.material.emissive.setRGB(0, 0, 0);
this.material.emissiveMap = undefined;
}
if (this.useMap && this.useBumpMap && this.bumpMap && !this.bumpMap.IsErase) {
if (this.useMap && this.useBumpMap && this.bumpMap?.Object && !this.bumpMap.IsErase) {
let map = this.bumpMap.Object;
let texture = map.GetThreeTexture();
await map.WaitUpdate();
@@ -1191,7 +1201,7 @@ exports.PhysicalMaterialRecord = class PhysicalMaterialRecord extends exports.Ma
}
else
this.material.bumpMap = undefined;
if (this.useMap && this.roughnessMap && this.roughnessMap && !this.roughnessMap.IsErase) {
if (this.useMap && this.roughnessMap?.Object && !this.roughnessMap.IsErase) {
let map = this.roughnessMap.Object;
let texture = map.GetThreeTexture();
await map.WaitUpdate();
@@ -1498,6 +1508,7 @@ exports.Entity = Entity_1 = class Entity extends CADObject {
//模块空间的标系
this._SpaceOCS = new three.Matrix4();
this._Visible = true;
this._Freeze = false; //冻结(无法被选中)
//加工组
this.ProcessingGroupList = [];
/**
@@ -1522,6 +1533,13 @@ exports.Entity = Entity_1 = class Entity extends CADObject {
get SpaceOCSInv() {
return new three.Matrix4().getInverse(this._SpaceOCS);
}
get Freeze() { return this._Freeze; }
set Freeze(f) {
if (f === this._Freeze)
return;
this.WriteAllObjectRecord();
this._Freeze = f;
}
set Material(materialId) {
if (materialId === this._MaterialId)
return;
@@ -1943,11 +1961,12 @@ exports.Entity = Entity_1 = class Entity extends CADObject {
}
IntersectWith(curve, intType) { return; }
//#region -------------------------File-------------------------
Clone() {
Clone(cloneDraw = true) {
let ent = super.Clone();
ent._CurRenderType = this._CurRenderType;
ent.Template = undefined;
ent.CloneDrawObject(this);
if (cloneDraw)
ent.CloneDrawObject(this);
return ent;
}
CloneDrawObject(from) {
@@ -2002,10 +2021,14 @@ exports.Entity = Entity_1 = class Entity extends CADObject {
this.ProcessingGroupList.push(id);
}
}
if (ver > 8)
this._Freeze = file.Read();
else
this._Freeze = false;
}
//对象将自身数据写入到文件.
WriteFile(file) {
file.Write(8);
file.Write(9);
super.WriteFile(file);
file.Write(this._Color);
file.WriteHardObjectId(this._MaterialId);
@@ -2017,6 +2040,7 @@ exports.Entity = Entity_1 = class Entity extends CADObject {
file.Write(this.ProcessingGroupList.length);
for (let id of this.ProcessingGroupList)
file.WriteHardObjectId(id);
file.WriteBool(this._Freeze);
}
//局部撤销
ApplyPartialUndo(undoData) {
@@ -2187,6 +2211,9 @@ function GetEntity(obj) {
function IsEntity(obj) {
return GetEntity(obj) instanceof exports.Entity;
}
function IsFreeze(obj) {
return obj["freeze"];
}
const IdentityMtx4 = new three.Matrix4();
const ZeroVec = new three.Vector3();
@@ -2846,10 +2873,11 @@ function CreatePolylinePath(pts, buls) {
return shape;
}
function GetGoodShaderSimple(color = new three.Vector3, side = three.FrontSide, logBuf = false) {
function GetGoodShaderSimple(color = new three.Vector3, side = three.FrontSide, logBuf = false, opacity = 1) {
return {
uniforms: {
"SurfaceColor": { value: color }
"SurfaceColor": { value: color },
"opacity": { value: opacity },
},
side,
polygonOffset: true,
@@ -3158,12 +3186,20 @@ class ColorMaterial {
this._BasicDoubleSideMaterialMap.set(color, mtl);
return mtl;
}
static GetConceptualMaterial(color, side = three.FrontSide) {
let key = `${color}${side}`;
static GetConceptualMaterial(color, side = three.FrontSide, enableTransparent = false) {
let key = `${color},${side},${enableTransparent ? 1 : 0}`;
if (this._ConceptualMaterial.has(key))
return this._ConceptualMaterial.get(key);
let shaderParams = GetGoodShaderSimple(new three.Vector3().fromArray(this.GetColor(color).toArray()), side, ColorMaterial.UseLogBuf);
let mtl = new three.ShaderMaterial(shaderParams);
if (enableTransparent) {
Object.defineProperty(mtl, "transparent", {
get: () => mtl.uniforms.opacity.value !== 1
});
Object.defineProperty(mtl.uniforms.opacity, "value", {
get: () => HostApplicationServices.ConceptualOpacity
});
}
this._ConceptualMaterial.set(key, mtl);
return mtl;
}
@@ -11268,6 +11304,25 @@ var BrRelativePos;
BrRelativePos["Right"] = "right";
BrRelativePos["Div"] = "div";
})(BrRelativePos || (BrRelativePos = {}));
var ViewDirection;
(function (ViewDirection) {
ViewDirection[ViewDirection["Left"] = 1] = "Left";
ViewDirection[ViewDirection["Right"] = 2] = "Right";
ViewDirection[ViewDirection["Up"] = 3] = "Up";
ViewDirection[ViewDirection["Front"] = 4] = "Front";
ViewDirection[ViewDirection["Bottom"] = 5] = "Bottom";
ViewDirection[ViewDirection["Back"] = 6] = "Back";
ViewDirection[ViewDirection["Southwest"] = 7] = "Southwest";
})(ViewDirection || (ViewDirection = {}));
var ViewportPosition;
(function (ViewportPosition) {
ViewportPosition["Vertical"] = "vertical";
ViewportPosition["Horizontal"] = "horizontal";
ViewportPosition["Left"] = "left";
ViewportPosition["Right"] = "right";
ViewportPosition["Bottom"] = "bottom";
ViewportPosition["Top"] = "top";
})(ViewportPosition || (ViewportPosition = {}));
var StripType;
(function (StripType) {
StripType["H"] = "h";
@@ -11704,6 +11759,7 @@ var EFindType;
EFindType[EFindType["ModifyHardware"] = 8] = "ModifyHardware";
EFindType[EFindType["FindMinSize"] = 9] = "FindMinSize";
EFindType[EFindType["GetHardWareOption"] = 10] = "GetHardWareOption";
EFindType[EFindType["RemoveSplitSize"] = 11] = "RemoveSplitSize";
})(EFindType || (EFindType = {}));
var ECompareType;
(function (ECompareType) {
@@ -11923,26 +11979,26 @@ const DefaultSideBoardOption = {
};
Object.freeze(DefaultSideBoardOption);
const DefaultViewportConfigOption = {
view: 3,
wireFrame: "打印模式",
view: ViewDirection.Up,
renderType: exports.RenderType.Print,
};
Object.freeze(DefaultViewportConfigOption);
const DefaultViewport2ConfigOption = {
align: "垂直",
wireFrame: ["打印模式", "打印模式"],
view1: 1,
view2: 3,
viewportPosition: ViewportPosition.Vertical,
renderType: [exports.RenderType.Print, exports.RenderType.Print],
view1: ViewDirection.Left,
view2: ViewDirection.Up,
};
Object.freeze(DefaultViewport2ConfigOption);
const DefaultViewport3ConfigOption = {
align: "V",
wireFrame: ["打印模式", "打印模式", "打印模式"],
view: [4, 3, 7],
viewportPosition: ViewportPosition.Vertical,
renderType: [exports.RenderType.Print, exports.RenderType.Print, exports.RenderType.Print],
view: [ViewDirection.Front, ViewDirection.Up, ViewDirection.Southwest],
};
Object.freeze(DefaultViewport3ConfigOption);
const DefaultViewport4ConfigOption = {
view: [4, 1, 3, 7],
wireFrame: ["打印模式", "打印模式", "打印模式", "打印模式"],
view: [ViewDirection.Front, ViewDirection.Left, ViewDirection.Up, ViewDirection.Southwest],
renderType: [exports.RenderType.Print, exports.RenderType.Print, exports.RenderType.Print, exports.RenderType.Print],
};
Object.freeze(DefaultViewport4ConfigOption);
const DefaultModifyTextsOption = {
@@ -12475,7 +12531,7 @@ const DefaultKuGanOption = {
};
Object.freeze(DefaultKuGanOption);
const DefaultParseBoardNameOPtion = {
version: 1,
version: 2,
verticalBrShrink: 0,
layerBrShrink: 0,
topBrShrink: 0,
@@ -12495,6 +12551,7 @@ const DefaultParseBoardNameOPtion = {
isbottomMostBackBrName: true,
isstripeBrName: true,
iscabinetName: false,
isModifyRoomName: true,
isMultiBackBr: false,
isBack: true,
backName: "背板",
@@ -12502,7 +12559,7 @@ const DefaultParseBoardNameOPtion = {
};
Object.freeze(DefaultParseBoardNameOPtion);
const DefaultR2bOption = {
version: 5,
version: 6,
cabinetDeep: 400,
cabinetBrThick: 18,
cabinetCurtail: 0,
@@ -16469,7 +16526,7 @@ exports.ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends exports.Entit
return new three.LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(this.ColorIndex));
}
else if (renderType === exports.RenderType.Conceptual) {
return new three.Object3D().add(new three.Mesh(this.MeshGeometry, ColorMaterial.GetConceptualMaterial(this.ColorIndex)), new three.LineSegments(this.EdgeGeometry, ColorMaterial.GetConceptualEdgeMaterial()));
return new three.Object3D().add(new three.Mesh(this.MeshGeometry, ColorMaterial.GetConceptualMaterial(this.ColorIndex, three.FrontSide, true)), new three.LineSegments(this.EdgeGeometry, ColorMaterial.GetConceptualEdgeMaterial()));
}
else if (renderType === exports.RenderType.Physical) {
let mesh = new three.Mesh(this.MeshGeometry, this.MeshMaterial);
@@ -16764,7 +16821,7 @@ exports.ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends exports.Entit
l.material = ColorMaterial.GetLineMaterial(this.ColorIndex);
}
else if (renderType === exports.RenderType.Conceptual) {
return obj.add(new three.Mesh(this.MeshGeometry, ColorMaterial.GetConceptualMaterial(this.ColorIndex)), new three.LineSegments(this.EdgeGeometry, ColorMaterial.GetConceptualEdgeMaterial()));
return obj.add(new three.Mesh(this.MeshGeometry, ColorMaterial.GetConceptualMaterial(this.ColorIndex, three.FrontSide, true)), new three.LineSegments(this.EdgeGeometry, ColorMaterial.GetConceptualEdgeMaterial()));
}
else if (renderType === exports.RenderType.Physical) {
let mesh = obj;
@@ -16795,7 +16852,7 @@ exports.ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends exports.Entit
}
else if (renderType === exports.RenderType.Conceptual) {
let mesh = obj.children[0];
mesh.material = ColorMaterial.GetConceptualMaterial(this.ColorIndex);
mesh.material = ColorMaterial.GetConceptualMaterial(this.ColorIndex, three.FrontSide, true);
}
else if (renderType === exports.RenderType.Physical2) {
let mesh = obj.children[0];
@@ -22280,9 +22337,20 @@ exports.RoomWallLine = class RoomWallLine extends exports.RoomWallBase {
}
}
else if (renderType === exports.RenderType.Print) {
DisposeThreeObj(obj);
Object3DRemoveAll(obj);
return obj.add(...this.GetPrintObject3D());
//优化代码 保证在布局是打印模式时,在模型空间删除洞时候 布局空间能正常更新.
let mesh = obj.children[1];
if (mesh.geometry !== this.MeshGeometry) {
mesh.geometry.dispose();
mesh.geometry = this.MeshGeometry;
}
let line = obj.children[0];
let geometry = new LineGeometry.LineGeometry();
let lineSegments = new Float32Array(this.EdgeGeometry.attributes.position.array);
let instanceBuffer = new three.InstancedInterleavedBuffer(lineSegments, 6, 1);
geometry.setAttribute('instanceStart', new three.InterleavedBufferAttribute(instanceBuffer, 3, 0));
geometry.setAttribute('instanceEnd', new three.InterleavedBufferAttribute(instanceBuffer, 3, 3));
line.geometry.dispose();
line.geometry = geometry;
}
}
//#endregion
@@ -23215,11 +23283,8 @@ exports.RoomFlatBase = class RoomFlatBase extends exports.RoomBase {
l.material = ColorMaterial.GetLineMaterial(this.ColorIndex);
}
else if (renderType === exports.RenderType.Conceptual) ;
else if (renderType === exports.RenderType.Physical2) {
let mesh = obj.children[0];
mesh.material = this.MeshMaterial;
}
else {
else if (renderType === exports.RenderType.Physical2) ;
else if (renderType === exports.RenderType.Physical) {
let mesh = obj;
mesh.material = this.MeshMaterial;
}
@@ -23231,7 +23296,7 @@ exports.RoomFlatBase = class RoomFlatBase extends exports.RoomBase {
return new three.Line(BufferGeometryUtils.CreateFromPts([AsVector3(this.ContourData.pts[0]), AsVector3(this.ContourData.pts[0])]), ColorMaterial.GetLineMaterial(this.ColorIndex));
}
else if (renderType === exports.RenderType.Conceptual) {
return new three.Object3D().add(new three.Mesh(this.MeshGeometry, ColorMaterial.GetBasicMaterialTransparent2(this.ColorIndex, 0.1)), new three.Line(this.EdgeGeometry, ColorMaterial.GetLineMaterial(7)));
return new three.Object3D().add(new three.Mesh(this.MeshGeometry, ColorMaterial.GetBasicMaterialTransparent2(this.ColorIndex, 0.1)), new three.Line(this.EdgeGeometry, ColorMaterial.GetConceptualEdgeMaterial()));
}
else if (renderType === exports.RenderType.Physical) {
let mesh = new three.Mesh(this.MeshGeometry, this.MeshMaterial);
@@ -23243,6 +23308,9 @@ exports.RoomFlatBase = class RoomFlatBase extends exports.RoomBase {
});
return mesh;
}
else if (renderType === exports.RenderType.Print) {
return new three.Mesh(this.MeshGeometry, ColorMaterial.GetPrintConceptualMaterial());
}
else if (renderType === exports.RenderType.Jig) {
return new three.Object3D;
}
@@ -23266,7 +23334,7 @@ exports.RoomFlatBase = class RoomFlatBase extends exports.RoomBase {
line.geometry = this.EdgeGeometry;
}
}
else if (renderType === exports.RenderType.Physical) {
else if (renderType === exports.RenderType.Physical || renderType === exports.RenderType.Print) {
let mesh = obj;
if (mesh.geometry !== this.MeshGeometry) {
mesh.geometry.dispose();
@@ -23876,10 +23944,7 @@ class RoomRegionParse {
Do(walls) {
let curves = [];
let leftCurves = new Set();
let maxZ = -Infinity;
let minZ = walls[0].Z;
for (let wall of walls) {
maxZ = Math.max(wall.Z + wall.Height, maxZ);
if (!wall.LeftCurves) {
continue;
}
@@ -23945,7 +24010,14 @@ class RoomRegionParse {
let roofs = [];
//解析 天花板区域 内空区域
for (let con of cons) {
let maxZ = -Infinity;
let minZ = Infinity;
let routes = regPolyline2RoutesMap.get(con.contour.Curve);
for (let r of routes) {
let wall = r.curve[CURVE_WALL_TYPE_KEY];
minZ = Math.min(minZ, wall.Position.z);
maxZ = Math.max(maxZ, wall.Position.z + wall.Height);
}
if (con.contour.Curve.ColorIndex === 2) //天花板区域(或者柱子)
{
if (con.Depth !== 0 || con.area < 1e6) //柱子
@@ -24779,7 +24851,6 @@ function UpdateStartEndPoint(curve) {
curve.EndPoint = ep;
}
new exports.Line;
exports.RoomWallArc = class RoomWallArc extends exports.RoomWallBase {
constructor(_Center = new three.Vector3(), _Radius = 0.1, _StartAngle = 0.1, _EndAngle = 0.1,
/**
@@ -25355,9 +25426,20 @@ exports.RoomWallArc = class RoomWallArc extends exports.RoomWallBase {
}
}
else if (renderType === exports.RenderType.Print) {
DisposeThreeObj(obj);
Object3DRemoveAll(obj);
return obj.add(...this.GetPrintObject3D());
//优化代码 保证在布局是打印模式时,在模型空间删除洞时候 布局空间能正常更新.
let mesh = obj.children[1];
if (mesh.geometry !== this.MeshGeometry) {
mesh.geometry.dispose();
mesh.geometry = this.MeshGeometry;
}
let line = obj.children[0];
let geometry = new LineGeometry.LineGeometry();
let lineSegments = new Float32Array(this.EdgeGeometry.attributes.position.array);
let instanceBuffer = new three.InstancedInterleavedBuffer(lineSegments, 6, 1);
geometry.setAttribute('instanceStart', new three.InterleavedBufferAttribute(instanceBuffer, 3, 0));
geometry.setAttribute('instanceEnd', new three.InterleavedBufferAttribute(instanceBuffer, 3, 3));
line.geometry.dispose();
line.geometry = geometry;
}
}
//#endregion
@@ -26126,7 +26208,7 @@ function UpdateWallHolesDataAndUpdateDraw(wall) {
function UpdateHoleFakerWallsAndUpdateDraw(hole) {
if (hole.IsErase)
return;
let fakerWalls = hole.RelevancyWalls.map(w => w.Object.Clone());
let fakerWalls = hole.RelevancyWalls.map(w => w.Object.Clone(false));
let pts = hole.Points;
if (pts.length < 2 || fakerWalls.length !== pts.length - 1) {
hole.Erase();
@@ -28371,7 +28453,7 @@ exports.Database = class Database {
this.DefaultMaterial = this.GetObjectId(71)?.Object ?? this.DefaultMaterial;
this.DefaultMaterial.Update();
HostApplicationServices.DefaultMeshMaterial = this.DefaultMaterial.Material;
HostApplicationServices.CurrentDimStyle = this.DimStyleTable.Current.Object.Id;
HostApplicationServices.CurrentDimStyle = this.DimStyleTable.Current;
}
Destroy() {
this.idMap.clear();
@@ -28395,14 +28477,14 @@ exports.Database = class Database {
this.GroupTable.SetOwnerDatabase(this);
this.Lights.SetOwnerDatabase(this);
this.ProcessingGroupTable.SetOwnerDatabase(this);
this.DimStyleTable.SetOwnerDatabase(this);
this.hm.SetDefaultDb(this);
this.LayoutSpace.SetOwnerDatabase(this);
this.DimStyleTable.SetOwnerDatabase(this);
this.idIndex = 100;
}
//#region Serialize
FileWrite(file = new CADFiler) {
file.Write(9); //ver;
file.Write(10); //ver;
file.Write(this.idIndex);
this.ModelSpace.WriteFile(file);
this.TextureTable.WriteFile(file);
@@ -28470,6 +28552,10 @@ exports.Database = class Database {
this.InitDimStyle();
this.idIndex = indexBak;
}
if (ver === 9) {
for (let e of this.LayoutSpace.EntityCol.Objects)
e.Owner = this.LayoutSpace.objectId;
}
this.SettingDefaultStyleAndMaterial();
this.hm.doing = false;
exports.Entity.__ReadFileIng__ = false;
@@ -29427,6 +29513,8 @@ exports.TemplateAction = __decorate([
Factory
], exports.TemplateAction);
//当前仅在GetEntity 和Ssget上严格实现了 None 和 Other的情况
//其他的只有None 没有Other(其他的也不可能出现想选没选到的情况)
var PromptStatus;
(function (PromptStatus) {
PromptStatus[PromptStatus["None"] = 0] = "None";
@@ -33398,8 +33486,6 @@ exports.ViewportEntity = ViewportEntity_1 = class ViewportEntity extends exports
this.OnlyRenderType = true;
this.NeedUpdateTexture = true;
this.IsFirstVersion = false;
this.scene.background = new three.Color(0xffffff);
this.ViewportMaterial = new three.MeshBasicMaterial({ map: this._RenderTarget.texture, transparent: true, opacity: 1 });
}
get Left() {
return this.Position.x;
@@ -33445,6 +33531,19 @@ exports.ViewportEntity = ViewportEntity_1 = class ViewportEntity extends exports
get ShowObjects() {
return [...this._ShowObjectIds];
}
//#region 显示隐藏实体控制
//应显尽显
ShowAll() {
if (this._HideObjectIds.size === 0)
return;
this.WriteAllObjectRecord();
//这个实现建立在一切数据都是准确的情况下
for (let id of this._HideObjectIds)
this._ShowObjectIds.add(id); //这里应该直接绘制的
this._HideObjectIds.clear();
this.UpdateScene(); //优化 应该在上面直接绘制的
}
//添加显示实体
AppendShowObjects(ids) {
this.WriteAllObjectRecord();
if (!Array.isArray(ids))
@@ -33452,26 +33551,37 @@ exports.ViewportEntity = ViewportEntity_1 = class ViewportEntity extends exports
for (let id of ids) {
if (id?.Object)
this._ShowObjectIds.add(id);
this._HideObjectIds.delete(id);
}
}
//(未被使用)移除显示实体
RemoveShowObjects(ids) {
this.WriteAllObjectRecord();
if (!Array.isArray(ids))
ids = [ids];
ids.forEach(id => this._ShowObjectIds.delete(id));
}
//添加隐藏实体
AppendHideObjects(ids) {
this.WriteAllObjectRecord();
if (!Array.isArray(ids))
ids = [ids];
ids.forEach(id => this._HideObjectIds.add(id));
for (let id of ids) {
this._HideObjectIds.add(id);
this._ShowObjectIds.delete(id);
}
}
//(未被使用)移除隐藏实体
RemoveHideObjects(ids) {
this.WriteAllObjectRecord();
if (!Array.isArray(ids))
ids = [ids];
ids.forEach(id => this._HideObjectIds.delete(id));
for (let id of ids) {
this._HideObjectIds.delete(id);
this._ShowObjectIds.add(id);
}
}
//#endregion
GetObjectSnapPoints(snapMode, pickPoint, lastPoint, viewXform) {
switch (snapMode) {
case ObjectSnapMode.End:
@@ -33559,12 +33669,13 @@ exports.ViewportEntity = ViewportEntity_1 = class ViewportEntity extends exports
this._renderType = v;
for (let o of this.scene.children) {
if (o instanceof three.Group) {
DisposeThreeObj(o);
Object3DRemoveAll(o);
o.children.length = 0;
let e = o.userData.Entity;
let obj = e.GetDrawObjectFromRenderType(e.IsOnlyRender ? this._renderType + 100 : this._renderType);
if (obj)
o.children.push(obj);
else
console.warn(e, `视口:该实体渲染类型${this._renderType}类型不存在`);
}
}
}
@@ -33592,20 +33703,25 @@ exports.ViewportEntity = ViewportEntity_1 = class ViewportEntity extends exports
}
return false;
}
AppendEntity(en) {
DrawEntityToScene(en) {
if (!this.CanRennder(en))
return;
let cloneObject = new three.Group();
let renderType = en.IsOnlyRender ? this._renderType + 100 : this._renderType;
let o = en.GetDrawObjectFromRenderType(renderType);
if (!o) {
console.warn(`该实体渲染类型${renderType}类型不存在`);
console.warn(en, `视口:该实体渲染类型${renderType}类型不存在`);
return;
}
cloneObject.children.push(o);
cloneObject.name = en.Id.Index.toString();
cloneObject.userData = { Entity: en };
cloneObject.updateMatrixWorld();
//因为LayoutTool里面有更新实体的操作 所以这个代码暂时是多余的
// //实体被删除的时候 这里自然的隐藏
// Object.defineProperty(cloneObject, "visible", {
// get: () => !en.IsErase
// });
this.scene.add(cloneObject);
this.NeedUpdateTexture = true;
}
@@ -33627,10 +33743,13 @@ exports.ViewportEntity = ViewportEntity_1 = class ViewportEntity extends exports
}
else {
o.visible = true;
showIndexs.delete(o.name);
showIndexs.delete(o.name); //已经画好了
}
}
this._ShowObjectIds.forEach(i => showIndexs.has(i.Index.toString()) && this.AppendEntity(i.Object));
//将场景内还没绘制的画进去
for (let id of this._ShowObjectIds)
if (showIndexs.has(id.Index.toString()))
this.DrawEntityToScene(id.Object);
this.NeedUpdateTexture = true;
}
CloneDrawObject(from) {
@@ -33650,6 +33769,7 @@ exports.ViewportEntity = ViewportEntity_1 = class ViewportEntity extends exports
});
return isInt;
}
//TODO:有个bug,在实体列表更新的时候 这个box没有更新,会导致一些错误.
IsContainText(text) {
if (!(text instanceof exports.Text))
return false;
@@ -33660,10 +33780,7 @@ exports.ViewportEntity = ViewportEntity_1 = class ViewportEntity extends exports
this._EntitysBoundingBox.union(en.BoundingBox);
}
}
if (this._EntitysBoundingBox.containsBox(text.BoundingBox))
return true;
else
return false;
return this._EntitysBoundingBox.containsBox(text.BoundingBox);
}
_ReadFile(file) {
super._ReadFile(file);
@@ -38004,11 +38121,14 @@ class GripScene extends three.Object3D {
}
function CheckFilter(obj, filter) {
if (!obj.visible || obj instanceof GripScene)
if (!obj.visible || obj instanceof GripScene || IsFreeze(obj))
return false;
let ent = GetEntity(obj);
// if (!ent) return false; (禁止这个代码(gizmo依赖这个)
if (ent?.Freeze && !filter?.selectFreeze)
return false;
if (!filter)
return true;
let ent = GetEntity(obj);
if (filter.filterErase && (!ent || ent.Id === undefined || ent.IsErase))
return false;
if (filter.filterFunction && !filter.filterFunction(obj, ent))