From f922d7f62f12e6e32c6040c14e2bdff2042b4d3c Mon Sep 17 00:00:00 2001 From: ChenX Date: Wed, 24 Nov 2021 10:35:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91:=E6=B8=85=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DatabaseServices/Lights/Light.ts | 2 +- src/UI/Components/Panel.tsx | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/DatabaseServices/Lights/Light.ts b/src/DatabaseServices/Lights/Light.ts index 59637c05f..bfeede300 100644 --- a/src/DatabaseServices/Lights/Light.ts +++ b/src/DatabaseServices/Lights/Light.ts @@ -114,7 +114,7 @@ export class Light extends Entity { en.intensity = this.WebIntensity; en.color = this._LightColor; - en.visible = this.OpenLight; + en.visible = this._OpenLight; } get Intensity() { diff --git a/src/UI/Components/Panel.tsx b/src/UI/Components/Panel.tsx index 1ca27bd6f..66121ee63 100644 --- a/src/UI/Components/Panel.tsx +++ b/src/UI/Components/Panel.tsx @@ -276,14 +276,13 @@ export class DownPanel extends React.Component<{ store?: DownPanelStore; }, {}> { userConfig.oneKeyOpenLight = !userConfig.oneKeyOpenLight; Light.DefaultOpenLight = userConfig.oneKeyOpenLight; - CommandWrap(() => + //这里没有操作数据对象 所以不需要命令包裹 + for (let light of app.Database.Lights.Entitys) { - for (let light of app.Database.Lights.Entitys) - { - if (light instanceof SpotLight || light instanceof RectAreaLight || light instanceof PointLight) - (light as Light).OpenLight = userConfig.oneKeyOpenLight; - } - }, userConfig.oneKeyOpenLight ? "一键开灯" : "一键关灯"); + if (light instanceof SpotLight || light instanceof RectAreaLight || light instanceof PointLight) + (light as Light).OpenLight = userConfig.oneKeyOpenLight; + } + app.Editor.UpdateScreen(); e.currentTarget.blur(); return; }