From 2c2087e2018c269aa6b37d237d03cae85fa886eb Mon Sep 17 00:00:00 2001 From: ChenX Date: Wed, 24 Nov 2021 11:17:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD:=E5=91=BD=E4=BB=A4GXL,?= =?UTF-8?q?=E5=B0=86=E6=97=A7=E7=9A=84=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=88=90=E6=96=B0=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Add-on/testEntity/CMD_UpdateLight.ts | 22 ++++++++++++++++++++++ src/Editor/CommandRegister.ts | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 src/Add-on/testEntity/CMD_UpdateLight.ts diff --git a/src/Add-on/testEntity/CMD_UpdateLight.ts b/src/Add-on/testEntity/CMD_UpdateLight.ts new file mode 100644 index 000000000..5b26508f8 --- /dev/null +++ b/src/Add-on/testEntity/CMD_UpdateLight.ts @@ -0,0 +1,22 @@ +import { app } from "../../ApplicationServices/Application"; +import { arrayRemoveIf } from "../../Common/ArrayExt"; +import { Light } from "../../DatabaseServices/Lights/Light"; +import { Command } from "../../Editor/CommandMachine"; + + +export class Command_UpdateLight implements Command +{ + async exec() + { + arrayRemoveIf(app.Database.ModelSpace.EntityCol.Objects, ent => + { + if (ent instanceof Light) + { + app.Database.Lights.EntityCol.Objects.push(ent); + ent.Owner = app.Database.Lights.Id; + return true; + } + return false; + }); + } +} diff --git a/src/Editor/CommandRegister.ts b/src/Editor/CommandRegister.ts index b72e55cdd..2d30b4926 100644 --- a/src/Editor/CommandRegister.ts +++ b/src/Editor/CommandRegister.ts @@ -193,6 +193,7 @@ import { Command_TemplateSearch } from "../Add-on/TemplateSearch"; // import { RevTarget, SaveTarget } from '../Add-on/RenderTarget'; import { TestIntersect } from "../Add-on/test/testIntersect"; import { Command_TestTape } from "../Add-on/test/TestTape"; +import { Command_UpdateLight } from "../Add-on/testEntity/CMD_UpdateLight"; import { Command_DebugTemplateAssocCount } from "../Add-on/testEntity/DebugShowTemplateAssocEntityCount"; import { Test } from "../Add-on/testEntity/test"; import { Command_TestBoundaryBox } from "../Add-on/testEntity/TestBoundaryBox"; @@ -269,6 +270,7 @@ export function registerCommand() commandMachine.RegisterCommand("testload", new Command_TestLoadFbx()); commandMachine.RegisterCommand("tt", new Test()); + commandMachine.RegisterCommand("gxl", new Command_UpdateLight()); commandMachine.RegisterCommand("999", new Command_999()); commandMachine.RegisterCommand("testVPath", new Command_TestVPath());