!1618 优化:材质面板,材质编辑器开启时,开始命令,材质编辑器关闭时,结束命令

pull/1606/MERGE
黄诗津 3 years ago committed by ChenX
parent e0977d6a07
commit 8d4aee88af

@ -16,7 +16,7 @@ import { Curve } from '../../DatabaseServices/Entity/Curve';
import { PhysicalMaterialRecord } from '../../DatabaseServices/PhysicalMaterialRecord'; import { PhysicalMaterialRecord } from '../../DatabaseServices/PhysicalMaterialRecord';
import { Text } from '../../DatabaseServices/Text/Text'; import { Text } from '../../DatabaseServices/Text/Text';
import { TextureTableRecord } from '../../DatabaseServices/Texture'; import { TextureTableRecord } from '../../DatabaseServices/Texture';
import { CommandWrap } from '../../Editor/CommandMachine'; import { commandMachine, CommandWrap } from '../../Editor/CommandMachine';
import { VisualSpaceBox } from '../../Editor/VisualSpaceBox'; import { VisualSpaceBox } from '../../Editor/VisualSpaceBox';
import { MaterialRendererSingle } from '../Editor/Asset/MaterialRenderer'; import { MaterialRendererSingle } from '../Editor/Asset/MaterialRenderer';
import { appUi } from '../Layout/ApplicationLayout'; import { appUi } from '../Layout/ApplicationLayout';
@ -110,8 +110,19 @@ export class Asset extends React.Component<{ material: PhysicalMaterialRecord; }
this.Destroy(); this.Destroy();
this.assetEl.removeEventListener("dragstart", this.handleStart); this.assetEl.removeEventListener("dragstart", this.handleStart);
} }
handleDoubleClick = () => handleDoubleClick = async () =>
{ {
await app.Editor.ModalManage.EndExecingCmd();
if (!commandMachine.CommandStart("编辑材质"))
{
AppToaster.show({
message: "命令正在执行中,无法开始编辑材质!",
timeout: 5000,
intent: Intent.WARNING,
});
return;
}
this.UpdateRenderPreview(); this.UpdateRenderPreview();
appUi.showMaterialEditor({ material: this.props.material }); appUi.showMaterialEditor({ material: this.props.material });
}; };
@ -203,7 +214,7 @@ export class Asset extends React.Component<{ material: PhysicalMaterialRecord; }
e.stopPropagation(); e.stopPropagation();
const menu = React.createElement( const menu = React.createElement(
Menu, Menu,
{}, // empty props { }, // empty props
React.createElement(MenuItem, { onClick: this.handleApply, text: "应用到当前选择实体" }), React.createElement(MenuItem, { onClick: this.handleApply, text: "应用到当前选择实体" }),
React.createElement(MenuItem, { onClick: this.handleCollection, text: "收藏" }), React.createElement(MenuItem, { onClick: this.handleCollection, text: "收藏" }),
React.createElement(MenuItem, { onClick: this.handleDelete, text: "删除" }), React.createElement(MenuItem, { onClick: this.handleDelete, text: "删除" }),

@ -9,6 +9,8 @@ import { Post, PostJson, RequestStatus } from '../../Common/Request';
import { deflate, MaterialOut } from '../../Common/SerializeMaterial'; import { deflate, MaterialOut } from '../../Common/SerializeMaterial';
import { Database } from '../../DatabaseServices/Database'; import { Database } from '../../DatabaseServices/Database';
import { PhysicalMaterialRecord } from '../../DatabaseServices/PhysicalMaterialRecord'; import { PhysicalMaterialRecord } from '../../DatabaseServices/PhysicalMaterialRecord';
import { commandMachine } from '../../Editor/CommandMachine';
import { CommandState } from '../../Editor/CommandState';
import { MaterialRendererSingle } from '../Editor/Asset/MaterialRenderer'; import { MaterialRendererSingle } from '../Editor/Asset/MaterialRenderer';
import { MaterialEditorLayout } from '../Layout/MaterialEditorLayout'; import { MaterialEditorLayout } from '../Layout/MaterialEditorLayout';
import { GetCompoentObjectIdString } from './ComponentObjectId'; import { GetCompoentObjectIdString } from './ComponentObjectId';
@ -51,6 +53,16 @@ export class MaterialContainer extends React.Component<MaterialContainerProps, {
}; };
handleClose = () => handleClose = () =>
{ {
if (CommandState.CommandIng)
{
commandMachine.CommandEnd();
AppToaster.show({
message: "材质编辑完成!(现在材质编辑支持完整的撤销重做!)",
timeout: 5000,
intent: Intent.SUCCESS,
});
}
if (!this.props.isNew) if (!this.props.isNew)
app.Editor.ModalManage.Destory(); app.Editor.ModalManage.Destory();
if (this.props.isOpen) if (this.props.isOpen)

Loading…
Cancel
Save