!2960 优化:阵列克隆的实体做深拷贝和ID映射

pull/2958/MERGE
林三 2 months ago
parent fa90de42b8
commit 31892e354e

@ -3,12 +3,10 @@ import { Box3, MathUtils, Matrix4, Vector2, Vector3 } from 'three';
import { app } from '../ApplicationServices/Application';
import { CheckObjectType, CheckoutValid } from '../Common/CheckoutVaildValue';
import { DataAdapter } from '../Common/DataAdapter';
import { Draw } from '../Common/Draw';
import { LogType } from '../Common/Log';
import { Singleton } from '../Common/Singleton';
import { FixedNotZero } from '../Common/Utils';
import { Hole } from '../DatabaseServices/3DSolid/Hole';
import { Entity } from '../DatabaseServices/Entity/Entity';
import { Polyline } from '../DatabaseServices/Entity/Polyline';
import { Command } from '../Editor/CommandMachine';
import { JigUtils } from '../Editor/JigUtils';
@ -19,6 +17,7 @@ import { ArrayModal } from '../UI/Components/Modal/ArrayModal';
import { ModalPosition, ModalState } from '../UI/Components/Modal/ModalInterface';
import { AppToaster } from '../UI/Components/Toaster';
import { IBaseOption, IUiOption } from "../UI/Store/OptionInterface/IOptionInterface";
import { GetCopyEntsParam, HardCloneObject } from './Copy';
export enum ArrayType
{
@ -385,12 +384,9 @@ function recArray(ss: SelectSet, rowNum: number, colNum: number, rowOffset: numb
continue;
let moveVec = xVec.clone().multiplyScalar(col).add(yVec.clone().multiplyScalar(row));
let moveMat = MoveMatrix(moveVec);
for (let en of ss.SelectEntityList)
{
let e = en.Clone();
e.ApplyMatrix(moveMat);
Draw(e);
}
let { dbEnts, idMapRev, idMap, oldEntsSet } = GetCopyEntsParam(ss.SelectEntityList);
HardCloneObject(dbEnts, moveMat, idMapRev, idMap, oldEntsSet);
}
}
}
@ -410,13 +406,9 @@ function CirArray(ss: SelectSet, ptRes: Vector3, itemTotal: number, betweenAngle
let roMat = new Matrix4();
roMat.makeRotationAxis(new Vector3(0, 0, 1).applyMatrix4(mat), (-betweenAngle) * (i + 1));
for (let selectEnt of ss.SelectEntityList)
{
let newEnt = selectEnt.Clone() as Entity;
newEnt.ApplyMatrix(moveMatInv);
newEnt.ApplyMatrix(roMat);
newEnt.ApplyMatrix(moveMat);
Draw(newEnt);
}
const mtx = moveMat.clone().multiply(roMat).multiply(moveMatInv);
let { dbEnts, idMapRev, idMap, oldEntsSet } = GetCopyEntsParam(ss.SelectEntityList);
HardCloneObject(dbEnts, mtx, idMapRev, idMap, oldEntsSet);
}
}

Loading…
Cancel
Save