功能:左侧资源面板支持插入WebCAD模型

pull/2044/MERGE
ChenX 2 years ago
parent ed6622928e
commit a3a851d446

@ -22,7 +22,7 @@ import { equaln, equalv3, ZeroVec } from "../../../Geometry/GeUtils";
import { DownPanelStore } from "../../Store/DownPanelStore"; import { DownPanelStore } from "../../Store/DownPanelStore";
import { IGetRoomInfo } from "./GetRoomCabName"; import { IGetRoomInfo } from "./GetRoomCabName";
export async function InsertTemplateByBasePoint(template: TemplateRecord, roomInfo?: IGetRoomInfo) export async function InsertTemplateByBasePoint(template: TemplateRecord, roomInfo?: IGetRoomInfo, isOnce = false)
{ {
const down = DownPanelStore.GetInstance() as DownPanelStore; const down = DownPanelStore.GetInstance() as DownPanelStore;
@ -222,6 +222,8 @@ export async function InsertTemplateByBasePoint(template: TemplateRecord, roomIn
for (let e of ents) for (let e of ents)
e.ApplyMatrix(parse.PlaceEntity.OCSNoClone); e.ApplyMatrix(parse.PlaceEntity.OCSNoClone);
if (isOnce) break;
} }
else break; else break;
} }

@ -17,6 +17,13 @@ export enum ResType
Mtl = "2" Mtl = "2"
} }
//模型来源
export enum ModuleSource
{
UE = "1",
WebCAD = "2"
}
export interface ModuleDetail extends IResponseData export interface ModuleDetail extends IResponseData
{ {
sn: string; //模编号 sn: string; //模编号
@ -24,6 +31,7 @@ export interface ModuleDetail extends IResponseData
etag: string; //FBX在oss上对应的etag etag: string; //FBX在oss上对应的etag
size: string; //FBX文件对应的大小 size: string; //FBX文件对应的大小
type: ResType; type: ResType;
source: ModuleSource;
} }
export interface ResourceClass export interface ResourceClass
{ {
@ -47,6 +55,7 @@ export interface ResourceParams
param_name: string; param_name: string;
param_type: string; param_type: string;
} }
export interface ModuleData export interface ModuleData
{ {
class_id?: string; class_id?: string;
@ -65,6 +74,7 @@ export interface ModuleData
buy_url: Array<{ mall: string, price: string, url: string; }>; // 购买链接 buy_url: Array<{ mall: string, price: string, url: string; }>; // 购买链接
dimension: string; //模型尺寸 dimension: string; //模型尺寸
} }
export interface Folder export interface Folder
{ {
dir_id: string; dir_id: string;

@ -15,6 +15,7 @@ import { UpdateDraw } from "../../../../Common/Status";
import { GetEntity } from "../../../../Common/Utils"; import { GetEntity } from "../../../../Common/Utils";
import { EntityRef } from "../../../../DatabaseServices/Entity/EntityRef"; import { EntityRef } from "../../../../DatabaseServices/Entity/EntityRef";
import { PhysicalMaterialRecord } from "../../../../DatabaseServices/PhysicalMaterialRecord"; import { PhysicalMaterialRecord } from "../../../../DatabaseServices/PhysicalMaterialRecord";
import { GetOnlineTemplate } from "../../../../DatabaseServices/Template/TempateUtils";
import { TextureTableRecord } from "../../../../DatabaseServices/Texture"; import { TextureTableRecord } from "../../../../DatabaseServices/Texture";
import { CommandWrap } from "../../../../Editor/CommandMachine"; import { CommandWrap } from "../../../../Editor/CommandMachine";
import { JigUtils } from "../../../../Editor/JigUtils"; import { JigUtils } from "../../../../Editor/JigUtils";
@ -22,8 +23,9 @@ import { PointPick } from "../../../../Editor/PointPick";
import { PromptStatus } from "../../../../Editor/PromptResult"; import { PromptStatus } from "../../../../Editor/PromptResult";
import { ParsePlacePos } from "../../../../Editor/TranstrolControl/ParsePlacePos"; import { ParsePlacePos } from "../../../../Editor/TranstrolControl/ParsePlacePos";
import { userConfig } from "../../../../Editor/UserConfig"; import { userConfig } from "../../../../Editor/UserConfig";
import { InsertTemplateByBasePoint } from "../../Template/InsertTemplateByBasePoint";
import { AppToaster } from "../../Toaster"; import { AppToaster } from "../../Toaster";
import { Folder, ModuleData, ModuleDetail, ResourceBrands, ResourceClass, ResourceParams, ResType } from "./ResourceInterfaces"; import { Folder, ModuleData, ModuleDetail, ModuleSource, ResourceBrands, ResourceClass, ResourceParams, ResType } from "./ResourceInterfaces";
import { ResourcePanelType } from "./ResourcePanel"; import { ResourcePanelType } from "./ResourcePanel";
import { getClassList, getModuleDetail, getModuleList, GetUserCollectDir, GetUserCollection } from "./ResourcesData"; import { getClassList, getModuleDetail, getModuleList, GetUserCollectDir, GetUserCollection } from "./ResourcesData";
@ -104,6 +106,18 @@ export default class ResourceStore
return; return;
} }
if (module_detail.source === ModuleSource.WebCAD)
{
let template = await GetOnlineTemplate(module_detail.path);
if (!template)
return;
await template.UpdateTemplateTree();
await InsertTemplateByBasePoint(template, undefined, true);
return;
}
let e = new EntityRef(module_detail.path); let e = new EntityRef(module_detail.path);
JigUtils.Draw(e); JigUtils.Draw(e);

Loading…
Cancel
Save