diff --git a/src/Add-on/SwitchCamera.ts b/src/Add-on/SwitchCamera.ts index 805c4f88f..1f255f3fc 100644 --- a/src/Add-on/SwitchCamera.ts +++ b/src/Add-on/SwitchCamera.ts @@ -1,14 +1,10 @@ -import { Command } from '../Editor/CommandMachine'; -import { Viewer } from '../GraphicsSystem/Viewer'; import { app } from '../ApplicationServices/Application'; -import * as THREE from 'three'; +import { Command } from '../Editor/CommandMachine'; export class Command_SwitchCamera implements Command { async exec() { app.m_Viewer.m_CameraCtrl.SwitchCamera(); - app.m_Viewer.m_RenderPass.camera = app.m_Viewer.Camera; - app.m_Viewer.m_OutlinePass.renderCamera = app.m_Viewer.Camera; } } diff --git a/src/Add-on/SwitchVisualStyles.ts b/src/Add-on/SwitchVisualStyles.ts new file mode 100644 index 000000000..c889ecd31 --- /dev/null +++ b/src/Add-on/SwitchVisualStyles.ts @@ -0,0 +1,19 @@ +import { Command } from "../Editor/CommandMachine"; +import { userConfig } from "../Editor/UserConfig"; +import { RenderType } from "../GraphicsSystem/RenderType"; + +export class CMD_Wireframe implements Command +{ + exec() + { + userConfig.RenderType = RenderType.Wireframe; + } +} + +export class CMD_Conceptual implements Command +{ + exec() + { + userConfig.RenderType = RenderType.Conceptual; + } +} diff --git a/src/Common/ColorPalette.ts b/src/Common/ColorPalette.ts index 326089ec5..397a3eeb3 100644 --- a/src/Common/ColorPalette.ts +++ b/src/Common/ColorPalette.ts @@ -1,4 +1,5 @@ -import { Color, DoubleSide, LineBasicMaterial, LineDashedMaterial, MeshBasicMaterial, Mesh } from 'three'; +import { Color, DoubleSide, LineBasicMaterial, LineDashedMaterial, MeshBasicMaterial, ShaderMaterial, Vector3 } from 'three'; +import { GetGoodShaderSimple } from '../GLSL/GoochShader'; const ColorPalette = [ [255, 0, 0, 255], //----- 0 - lets make it red for an example @@ -272,32 +273,47 @@ export class ColorMaterial private constructor() { } private static m_LineMaterialMap = new Map(); private static m_BasicMaterialMap = new Map(); - static GetLineMaterial(index): LineBasicMaterial + static GetLineMaterial(color: number): LineBasicMaterial { - if (this.m_LineMaterialMap.has(index)) - return this.m_LineMaterialMap.get(index); - let mat = new LineBasicMaterial({ color: this.GetColor(index) }); - this.m_LineMaterialMap.set(index, mat); + if (this.m_LineMaterialMap.has(color)) + return this.m_LineMaterialMap.get(color); + let mat = new LineBasicMaterial({ color: this.GetColor(color) }); + this.m_LineMaterialMap.set(color, mat); return mat; } - static GetBasicMaterial(index: number): MeshBasicMaterial + static GetBasicMaterial(color: number): MeshBasicMaterial { - if (this.m_BasicMaterialMap.has(index)) - return this.m_BasicMaterialMap.get(index); - let mat = new MeshBasicMaterial({ color: this.GetColor(index), side: DoubleSide }); - this.m_BasicMaterialMap.set(index, mat); - return mat; + if (this.m_BasicMaterialMap.has(color)) + return this.m_BasicMaterialMap.get(color); + let mtl = new MeshBasicMaterial({ color: this.GetColor(color), side: DoubleSide }); + this.m_BasicMaterialMap.set(color, mtl); + return mtl; + } + + private static _ConceptualMaterial: Map = new Map(); + static GetConceptualMaterial(color: number) + { + if (this._ConceptualMaterial.has(color)) + return this._ConceptualMaterial.get(color); + + let shaderParams = GetGoodShaderSimple( + new Vector3().fromArray(this.GetColor(color).toArray()) + ); + let mtl = new ShaderMaterial(shaderParams); + this._ConceptualMaterial.set(color, mtl); + return mtl; } + static SolidJigMaterial() { return new MeshBasicMaterial({ transparent: true, opacity: 0.1 }); } - static GetColor(index: number) + static GetColor(color: number) { - let rgb = ColorPalette[index]; + let rgb = ColorPalette[color]; if (rgb) return new Color(rgb[0] / 255, rgb[1] / 255, rgb[2] / 255); } diff --git a/src/DatabaseServices/Board.ts b/src/DatabaseServices/Board.ts index e32f0c6b2..50ccc48b0 100644 --- a/src/DatabaseServices/Board.ts +++ b/src/DatabaseServices/Board.ts @@ -108,7 +108,7 @@ export class Board extends ExtureSolid board.InitBoard(length, width, thickness, boardType); board.ApplyMatrix(board.RotateMat); board.m_SpecOCS.identity(); - // board.ColorIndex = boardType + 1; + board.ColorIndex = boardType + 1; return board; } get DrillList() diff --git a/src/DatabaseServices/Extrude.ts b/src/DatabaseServices/Extrude.ts index 2f93fee08..47dc4e4e7 100644 --- a/src/DatabaseServices/Extrude.ts +++ b/src/DatabaseServices/Extrude.ts @@ -962,22 +962,36 @@ export class ExtureSolid extends Entity return HostApplicationServices.DefaultMeshMaterial; } - private GetObject3DByRenderType(renderType: RenderType) + private GetObject3DByRenderType(object: Object3D, renderType: RenderType) { if (renderType === RenderType.Wireframe) - return new LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(this.ColorIndex)) + { + object.add( + new LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(this.ColorIndex)) + ); + } + else if (renderType === RenderType.Conceptual) + { + object.add( + new Mesh(this.MeshGeometry, ColorMaterial.GetConceptualMaterial(this.ColorIndex)), + new LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(7)) + ); + } else { let mesh = new Mesh(this.MeshGeometry, this.MeshMaterial); mesh.castShadow = true; mesh.receiveShadow = HostApplicationServices.UseShadow; - return mesh; + + object.add(mesh); } } InitDrawObject(renderType: RenderType = RenderType.Wireframe) { - return new Object3D().add(this.GetObject3DByRenderType(renderType)).add(this.GetObject3DByRenderType(RenderType.Wireframe)); + let obj = new Object3D(); + this.GetObject3DByRenderType(obj, renderType); + return obj; } get UCGenerator() { @@ -1044,12 +1058,13 @@ export class ExtureSolid extends Entity } } - UpdateDrawObject(type: RenderType, obj: Object3D) + UpdateDrawObject(renderType: RenderType, obj: Object3D) { DisposeThreeObj(obj); this._EdgeGeometry = undefined; this._MeshGeometry = undefined; - obj.add(this.GetObject3DByRenderType(type)); + + this.GetObject3DByRenderType(obj, renderType); } UpdateJigMaterial(color = 8) diff --git a/src/Editor/CommandRegister.ts b/src/Editor/CommandRegister.ts index 8860f6435..88ede8914 100644 --- a/src/Editor/CommandRegister.ts +++ b/src/Editor/CommandRegister.ts @@ -1,14 +1,17 @@ import { Vector3 } from 'three'; import { DrawAxis } from '../Add-on/AddAxis'; +import { AddPtOnBoard, DeletePtOnBoard } from '../Add-on/AddPtOnBoard'; import { Command_Array } from '../Add-on/Array'; import { LinearCutting } from '../Add-on/BoardCutting/LinearCutting'; import { NonAssociativeCutting } from '../Add-on/BoardCutting/NonAssociativeCutting'; +import { ReferenceCutting } from '../Add-on/BoardCutting/ReferenceCutting'; import { IntersectionOperation, SubsractOperation, UnionOperation } from '../Add-on/BoolOperation'; import { Command_Break } from '../Add-on/Break'; import { ChangeColor } from '../Add-on/ChangeColor'; import { Command_ClosePt } from '../Add-on/closetest'; import { FeedingCommand } from '../Add-on/CommandFeeding'; import { Command_CommandPanel } from '../Add-on/Command_CommandPanel'; +import { Command_Options } from '../Add-on/Command_Option'; import { Command_Copy } from '../Add-on/Copy'; import { CopyClip } from '../Add-on/CopyClip'; import { Command_CopyPoint } from '../Add-on/CopyPoint'; @@ -20,6 +23,7 @@ import { DrawBehindBoard } from '../Add-on/DrawBoard/DrawBehindBoard'; import { Command_DrawBoard } from '../Add-on/DrawBoard/DrawBoard'; import { DrawClosingStrip } from '../Add-on/DrawBoard/DrawClosingStrip'; import { DrawDoor } from '../Add-on/DrawBoard/DrawDoor'; +import { DrawDrawrer } from '../Add-on/DrawBoard/DrawDrawer'; import { DrawLayerBoard } from '../Add-on/DrawBoard/DrawLayerBoard'; import { DrawLeftRight } from '../Add-on/DrawBoard/DrawLeftRightBoard'; import { DrawSingleBoard } from '../Add-on/DrawBoard/DrawSingleBoard'; @@ -75,12 +79,14 @@ import { Pedit } from '../Add-on/Pedit'; import { Command_PLTest } from '../Add-on/polytest'; import { Command_RevPl } from '../Add-on/RevPl'; import { Command_Rotate } from '../Add-on/Rotate'; +import { RotateLayerBoard } from '../Add-on/RotateLayerBoard'; import { Save } from '../Add-on/Save'; import { Command_Scale } from '../Add-on/Scale'; import { Command_Ssget } from '../Add-on/ssget'; import { Stretch } from '../Add-on/Stretch'; import { Sweep } from '../Add-on/Sweep'; import { Command_SwitchCamera } from '../Add-on/SwitchCamera'; +import { CMD_Conceptual, CMD_Wireframe } from '../Add-on/SwitchVisualStyles'; import { DrawTangentLine } from '../Add-on/Tangent'; // import { DrawFloor } from '../Add-on/DrawFloor'; // import { RevTarget, SaveTarget } from '../Add-on/RenderTarget'; @@ -98,11 +104,6 @@ import { ZoomE } from "../Add-on/ZoomE"; import { CommandServer } from '../DatabaseServices/CommandServer'; import { ICommand } from '../UI/Components/CommandPanel/CommandList'; import { commandMachine } from './CommandMachine'; -import { DrawDrawrer } from '../Add-on/DrawBoard/DrawDrawer'; -import { ReferenceCutting } from '../Add-on/BoardCutting/ReferenceCutting'; -import { RotateLayerBoard } from '../Add-on/RotateLayerBoard'; -import { Command_Options } from '../Add-on/Command_Option'; -import { AddPtOnBoard, DeletePtOnBoard } from '../Add-on/AddPtOnBoard'; export function registerCommand() @@ -284,6 +285,10 @@ export function registerCommand() // commandMachine.RegisterCommand("st", new SaveTarget()) // commandMachine.RegisterCommand("rt", new RevTarget()) + //视觉样式 + commandMachine.RegisterCommand("Wireframe", new CMD_Wireframe()); + commandMachine.RegisterCommand("Conceptual", new CMD_Conceptual()); + RegistCustomCommand(); } diff --git a/src/Editor/UserConfig.ts b/src/Editor/UserConfig.ts index 1d6da0e66..d1388e73e 100644 --- a/src/Editor/UserConfig.ts +++ b/src/Editor/UserConfig.ts @@ -5,17 +5,34 @@ import { RenderType } from "../GraphicsSystem/RenderType"; */ class UserConfig { - renderType: RenderType = RenderType.Wireframe; + private _renderType: RenderType = RenderType.Wireframe; constructor() { this.InitConfig(); } + InitConfig() { let type = sessionStorage.getItem("renderType"); if (type) - this.renderType = parseFloat(type); + this._renderType = parseFloat(type); + } + + set RenderType(t: RenderType) + { + if (t !== this._renderType) + { + this._renderType = t; + this.SetRenderTypeEvent(); + + sessionStorage.setItem("renderType", t.toString()); + } } + + get RenderType() { return this._renderType; } + + SetRenderTypeEvent() { } + } export const userConfig = new UserConfig(); diff --git a/src/GLSL/GoochShader.ts b/src/GLSL/GoochShader.ts index 7846c47d1..e6702e7a2 100644 --- a/src/GLSL/GoochShader.ts +++ b/src/GLSL/GoochShader.ts @@ -1,4 +1,4 @@ -import { Vector3 } from "three"; +import { Vector3, ShaderMaterialParameters } from "three"; //https://github.com/arefin86/arefin86.github.io/blob/master/js/shaders/GoochShader.js export const GoochShader = { @@ -15,10 +15,17 @@ export const GoochShader = { fragmentShader: require("./Goodch2.fs") } -export const GoochShaderSimple = { - uniforms: { - "SurfaceColor": { type: "v3", value: new Vector3(1.0, 1.0, 1.0) } - }, - vertexShader: require("./GoodchSimple.vs"), - fragmentShader: require("./GoodchSimple.fs") +export function GetGoodShaderSimple(color: Vector3 = new Vector3): ShaderMaterialParameters +{ + return { + uniforms: { + "SurfaceColor": { type: "v3", value: color } + }, + vertexShader: require("./GoodchSimple.vs"), + fragmentShader: require("./GoodchSimple.fs"), + + polygonOffset: true, + polygonOffsetFactor: 1, + polygonOffsetUnits: 1 + }; } diff --git a/src/GraphicsSystem/Viewer.ts b/src/GraphicsSystem/Viewer.ts index 7e69ca7c7..e83051081 100644 --- a/src/GraphicsSystem/Viewer.ts +++ b/src/GraphicsSystem/Viewer.ts @@ -1,8 +1,7 @@ import { EffectComposer, Matrix4, Object3D, OutlinePass, RenderPass, Scene, SMAAPass, Vector2, Vector3, WebGLRenderer } from 'three'; -import * as xaop from 'xaop'; -import { end } from 'xaop'; +import { begin, end } from 'xaop'; import { app } from '../ApplicationServices/Application'; -import { GetEntity } from '../Common/Utils'; +import { GetEntity, IsEntity } from '../Common/Utils'; import { Database } from '../DatabaseServices/Database'; import { Entity } from '../DatabaseServices/Entity'; import { GenerateRaycaster } from '../Editor/PointPick'; @@ -72,6 +71,13 @@ export class Viewer { self.needUpdateEnts.add(this) }); + + end(this.m_CameraCtrl, this.m_CameraCtrl.SwitchCamera, () => + { + this.m_RenderPass.camera = this.Camera; + this.m_OutlinePass.renderCamera = this.Camera; + this.UpdateRender(); + }); } get Scene() { @@ -308,29 +314,38 @@ export class Viewer { for (let en of db.ModelSpace.Entitys) { - let obj = en.Draw(userConfig.renderType); + let obj = en.Draw(userConfig.RenderType); en.UpdateVisible(); this.m_Scene.add(obj); } this.m_bNeedUpdate = true; } renderEntitys(); - xaop.begin(db.ModelSpace, db.ModelSpace.AppendEvent, (e) => + begin(db.ModelSpace, db.ModelSpace.AppendEvent, (e) => { - let obj = (e).Draw(userConfig.renderType); + let obj = (e).Draw(userConfig.RenderType); if (obj.parent != this.Scene) this.m_Scene.add(obj); - }) - xaop.begin(db.ModelSpace, db.ModelSpace.Destroy, () => + }); + begin(db.ModelSpace, db.ModelSpace.Destroy, () => { for (let en of db.ModelSpace.Entitys) { en.GoodBye(); } - }) - xaop.end(db, db.FileRead, () => + }); + begin(userConfig, userConfig.SetRenderTypeEvent, () => + { + app.m_Viewer.Scene.children.forEach(o => + { + if (IsEntity(o)) + GetEntity(o).ToggleRenderType(userConfig.RenderType); + }); + this.UpdateRender(); + }); + end(db, db.FileRead, () => { renderEntitys(); - }) + }); } } diff --git a/src/UI/Components/CameraControlButton/CameraControlBtn.tsx b/src/UI/Components/CameraControlButton/CameraControlBtn.tsx index 68e465725..f8d3c3cf6 100644 --- a/src/UI/Components/CameraControlButton/CameraControlBtn.tsx +++ b/src/UI/Components/CameraControlButton/CameraControlBtn.tsx @@ -1,12 +1,16 @@ -import { Button, Menu, MenuItem, Popover, MenuDivider } from "@blueprintjs/core"; +import { Button, Menu, MenuDivider, MenuItem, Popover } from "@blueprintjs/core"; import { observable } from "mobx"; import { observer } from "mobx-react"; import * as React from "react"; +import { OrthographicCamera } from "three"; +import { begin, end } from "xaop"; import { app } from "../../../ApplicationServices/Application"; import { KeyBoard } from "../../../Common/KeyEnum"; import { commandMachine } from "../../../Editor/CommandMachine"; -import { end, begin } from "xaop"; +import { userConfig } from "../../../Editor/UserConfig"; +import { RenderType } from "../../../GraphicsSystem/RenderType"; import { DownPanelStore } from "../../Store/DownPanelStore"; +import { VisualStyleData } from "./IVisualType"; enum MenuType { @@ -14,111 +18,87 @@ enum MenuType ViewMenu = 1, VisualStyleMenu = 2, } -export interface IViewData +interface IViewData { command: string; name: string; - enable: boolean; } -export let viewData: IViewData[] = observable([ +let viewData: IViewData[] = [ { command: "FS", name: "俯视", - enable: true }, { command: "YS", name: "右视", - enable: false }, { command: "ZS", name: "左视", - enable: false }, { command: "QS", name: "前视", - enable: false }, { command: "BOTTOMVIEW", name: "仰视", - enable: false }, { command: "SWISO", name: "西南等轴测", - enable: false }, -]) -export let visualStyleData: IViewData[] = observable([ - { - command: "", - name: "二维线框", - enable: true - }, - { - command: "", - name: "概念", - enable: false - }, - { - command: "", - name: "隐藏", - enable: false - }, - { - command: "", - name: "带边缘着色", - enable: false - }, - { - command: "", - name: "X射线", - enable: false - }, -]) -export let cameraStyle: IViewData[] = observable([ - { - command: "perspective", - name: "平行", - enable: true, - }, - { - command: "orthographic", - name: "正交", - enable: false, - }, -]) +]; + @observer export class CameraControlBtn extends React.Component<{}, {}> { @observable private m_isMenuShow: number = -1; @observable private m_ViewMenuTitle: string = "俯视"; @observable private m_VisualStyleMenuTitle: string = "二维线框"; - @observable private m_CameraStyle: string = "平行"; + @observable private m_CameraType: string = "平行"; + @observable private _RenderType: RenderType; - constructor(p) + constructor(p, s) { - super(p); + super(p, s); begin(commandMachine, commandMachine.CommandStart, (cmdName: string) => { if (cmdName) { - if (viewData.findIndex((i) => { return i.command === cmdName; }) !== -1) - this.m_ViewMenuTitle = this.SingleSelection(viewData, cmdName); + for (let d of viewData) + { + if (d.command === cmdName) + { + this.m_ViewMenuTitle = d.name; + return; + } + } } - }) + }); + + const updateRenderType = () => + { + this._RenderType = userConfig.RenderType; + this.m_VisualStyleMenuTitle = VisualStyleData.find(v => v.type === this._RenderType).title; + } + updateRenderType(); + begin(userConfig, userConfig.SetRenderTypeEvent, updateRenderType); + end(app.m_Viewer.m_CameraCtrl, app.m_Viewer.m_CameraCtrl.Rotate, () => { this.m_ViewMenuTitle = "自定义视图"; - this.SingleSelection(viewData, ""); }); - end(app.m_Viewer.m_CameraCtrl, app.m_Viewer.m_CameraCtrl.SwitchCamera, () => + + const updateCameraType = () => { - this.m_CameraStyle = this.SingleSelection(cameraStyle, this.m_CameraStyle === "平行" ? "正交" : "平行"); - }); + if (app.m_Viewer.m_CameraCtrl.Camera instanceof OrthographicCamera) + this.m_CameraType = "正交"; + else + this.m_CameraType = "透视"; + } + updateCameraType(); + end(app.m_Viewer.m_CameraCtrl, app.m_Viewer.m_CameraCtrl.SwitchCamera, updateCameraType); } render() { @@ -194,7 +174,7 @@ export class CameraControlBtn extends React.Component<{}, {}> /> - ) + ); } RenderControlsMenu = () => @@ -229,7 +209,7 @@ export class CameraControlBtn extends React.Component<{}, {}> /> } - ) + ); } RenderViewMenu = () => @@ -257,33 +237,37 @@ export class CameraControlBtn extends React.Component<{}, {}> (data) => { - data.enable = !data.enable; - this.m_ViewMenuTitle = this.SingleSelection(viewData, data.name); - commandMachine.ExecCommand(data.command); this.HideMenu(); + this.m_ViewMenuTitle = data.name; + commandMachine.ExecCommand(data.command); }} /> ) } - { - cameraStyle.map( - (data) => - - { - if (data.name !== this.m_CameraStyle) - app.m_Viewer.m_CameraCtrl.SwitchCamera(); - this.HideMenu(); - }} - /> - ) - } + + { + this.HideMenu(); + if (this.m_CameraType !== "正交") + app.m_Viewer.m_CameraCtrl.SwitchCamera(); + }} + /> + + { + this.HideMenu(); + if (this.m_CameraType !== "透视") + app.m_Viewer.m_CameraCtrl.SwitchCamera(); + }} + /> ) } @@ -309,15 +293,16 @@ export class CameraControlBtn extends React.Component<{}, {}> }} > { - visualStyleData.map( + VisualStyleData.map( (data) => { - this.m_VisualStyleMenuTitle = this.SingleSelection(visualStyleData, data.name); this.HideMenu(); + this.m_VisualStyleMenuTitle = data.title; + userConfig.RenderType = data.type; }} /> ) @@ -337,21 +322,4 @@ export class CameraControlBtn extends React.Component<{}, {}> this.m_isMenuShow = -1; app.m_Editor.m_MaskManage.Clear(); } - - //单选 并返回选中项的name - SingleSelection = (data: any[], checkedParam: string) => - { - let title: string = ""; - for (let i of data) - { - if (i.name === checkedParam || i.command === checkedParam) - { - i.enable = true; - title = i.name; - } - else if (i.enable === true) - i.enable = false; - } - return title; - } } diff --git a/src/UI/Components/CameraControlButton/IVisualType.ts b/src/UI/Components/CameraControlButton/IVisualType.ts new file mode 100644 index 000000000..37b5d69cf --- /dev/null +++ b/src/UI/Components/CameraControlButton/IVisualType.ts @@ -0,0 +1,31 @@ +import { RenderType } from "../../../GraphicsSystem/RenderType"; + +interface IVisualStyle +{ + title: string; + type: RenderType; +} + +export const VisualStyleData: IVisualStyle[] = [ + { + title: "二维线框", + type: RenderType.Wireframe + }, + { + title: "概念", + type: RenderType.Conceptual + }, + { + title: "真实", + type: RenderType.Physical + }, + // { + // title: "隐藏", + // }, + // { + // title: "带边缘着色", + // }, + // { + // title: "X射线", + // }, +]; diff --git a/src/UI/Components/CommandPanel/CommandList.ts b/src/UI/Components/CommandPanel/CommandList.ts index 01d77d470..213d349d1 100644 --- a/src/UI/Components/CommandPanel/CommandList.ts +++ b/src/UI/Components/CommandPanel/CommandList.ts @@ -11,14 +11,14 @@ export interface ICommand typeId: string,//i2d,i3d,hb,pz,util link?: string,//帮助链接 defaultCustom: string,//默认自定义,用于重置 - customizeed: string,//用于保存上一个,需要赋初值,否则undefinded出错 + customizeed?: string,//用于保存上一个,需要赋初值,否则undefinded出错 //------以上非搜索项-----// type: string,//命令类型 chName: string,//中文名称 common: string,//常命令 // enName: string,//英文名称,可能应用到中英切换功能 chDes: string,//中文描述 - customize: string,//自定义命令 + customize?: string,//自定义命令 time?: string,//使用时间(待定) } export const CommandList: ICommand[] = observable([ @@ -636,7 +636,32 @@ export const CommandList: ICommand[] = observable([ customize: "DCO", }, - //其他命令 + //#region 视觉样式 + { + typeId: "VisualStyle", + link: "#", + defaultCustom: "XK", + customizeed: "XK", + common: "WIREFRAME", + type: "视觉样式", + chName: "二维线框", + chDes: "切换视觉样式到二维线框", + customize: "XK", + }, + { + typeId: "VisualStyle", + link: "#", + defaultCustom: "GN", + customizeed: "GN", + common: "CONCEPTUAL", + type: "视觉样式", + chName: "概念", + chDes: "切换视觉样式到概念模式", + customize: "GN", + }, + //#endregion + + //#region 其他命令 { typeId: "util", link: "#", @@ -1057,4 +1082,6 @@ export const CommandList: ICommand[] = observable([ chDes: "最近点", customize: "CLOSE", }, + + //#endregion ]); diff --git a/src/UI/Components/CommandPanel/commandPanel.tsx b/src/UI/Components/CommandPanel/commandPanel.tsx index f742e74e9..233639fc9 100644 --- a/src/UI/Components/CommandPanel/commandPanel.tsx +++ b/src/UI/Components/CommandPanel/commandPanel.tsx @@ -36,6 +36,7 @@ export class CommandPanel extends React.Component<{}, CommandPanelState> ["视图", "view", 0], ["实体", "czst", 0], ["标注", "dim", 0], + ["视觉样式", "VisualStyle", 0], ["工具", "util", 0], ] }; diff --git a/src/UI/Components/Panel.tsx b/src/UI/Components/Panel.tsx index c50d72ba2..3510b8e02 100644 --- a/src/UI/Components/Panel.tsx +++ b/src/UI/Components/Panel.tsx @@ -1,17 +1,15 @@ -import { Alignment, Button, Classes, HTMLSelect, InputGroup, Navbar, Switch, Popover, Position, Intent } from '@blueprintjs/core'; +import { Alignment, Button, Classes, HTMLSelect, InputGroup, Navbar, Switch } from '@blueprintjs/core'; import { inject, observer } from 'mobx-react'; import * as React from 'react'; +import { app } from '../../ApplicationServices/Application'; +import { SignUrl } from '../../Common/HostUrl'; +import { request, RequestStatus } from '../../Common/Request'; +import { CommandState } from '../../Editor/CommandState'; +import { SnapMenuFixed } from '../../Editor/SnapMenuFixed'; import { DownPanelStore } from '../Store/DownPanelStore'; import { TopPanelStore } from '../Store/TopPanelStore'; import { SettingPanel } from './SettingPanel/SettingPanel'; import SoucePanel from './SourceManage/SoucePanel'; -import { SnapMenuFixed } from '../../Editor/SnapMenuFixed'; -import { app } from '../../ApplicationServices/Application'; -import { CommandState } from '../../Editor/CommandState'; -import { request, RequestStatus } from '../../Common/Request'; -import { SignUrl } from '../../Common/HostUrl'; -import { RenderType } from '../../GraphicsSystem/RenderType'; -import { userConfig } from '../../Editor/UserConfig'; interface TopPanelState { @@ -222,27 +220,6 @@ export class DownPanel extends React.Component<{ store?: DownPanelStore }, {}> style={switchStyle}> - - { - userConfig.renderType = - e.currentTarget.checked ? RenderType.Wireframe : RenderType.Physical; - sessionStorage.setItem('renderType', userConfig.renderType.toString()); - app.m_Viewer.Scene.traverse(o => - { - if (o.userData && o.userData.Entity) - { - o.userData.Entity.ToggleRenderType(userConfig.renderType); - } - }) - app.m_Editor.UpdateScreen(); - e.currentTarget.blur(); - }} - style={switchStyle} - alignIndicator={Alignment.RIGHT} - /> ) } }