refactor: change loadModel parameter from string to string array
- Update loadModel signature: url: string -> urls: string[] - Update validation logic for array parameter - Update all demo files to pass array instead of single string
This commit is contained in:
@@ -7,8 +7,8 @@ import type { MeasureUnit, MeasurePrecision } from '../measure-panel/types';
|
||||
import type { SectionBoxRange } from '../section-box-panel/types';
|
||||
import { ManagerRegistry } from '../../core/manager-registry';
|
||||
// 导入第三方 SDK 的 createEngine 函数(从 npm 包引入)
|
||||
// import { createEngine as createEngineSDK } from 'iflow-engine-base';
|
||||
import { createEngine as createEngineSDK } from '../../../../bim_engine_base/dist/bim-engine-sdk.es';
|
||||
import { createEngine as createEngineSDK } from 'iflow-engine-base';
|
||||
//import { createEngine as createEngineSDK } from '../../../../bim_engine_base/dist/bim-engine-sdk.es';
|
||||
import "../../../../bim_engine_base/dist/iflow-engine-base.css"
|
||||
|
||||
export type { EngineOptions, ModelLoadOptions, EngineInfo };
|
||||
@@ -175,19 +175,19 @@ export class Engine implements IBimComponent {
|
||||
|
||||
/**
|
||||
* 加载 3D 模型
|
||||
* @param url 模型文件 URL
|
||||
* @param urls 模型文件 URL 数组
|
||||
* @param options 加载选项(位置、旋转、缩放)
|
||||
*/
|
||||
public loadModel(url: string, options?: ModelLoadOptions): void {
|
||||
public loadModel(urls: string[], options?: ModelLoadOptions): void {
|
||||
if (!this._isInitialized || !this.engine) {
|
||||
console.error('[Engine] Engine not initialized. Please call init() first.');
|
||||
return;
|
||||
}
|
||||
if (!url) {
|
||||
console.error('[Engine] Model URL is required.');
|
||||
if (!urls || urls.length === 0) {
|
||||
console.error('[Engine] Model URLs are required.');
|
||||
return;
|
||||
}
|
||||
this.engine.loaderModule.loadModels([url], options);
|
||||
this.engine.loaderModule.loadModels(urls, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -234,15 +234,15 @@ export class EngineManager extends BaseManager {
|
||||
|
||||
/**
|
||||
* 加载模型
|
||||
* @param url 模型 URL
|
||||
* @param urls 模型 URL 数组
|
||||
* @param options 加载选项
|
||||
*/
|
||||
public loadModel(url: string, options?: ModelLoadOptions): void {
|
||||
public loadModel(urls: string[], options?: ModelLoadOptions): void {
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
return;
|
||||
}
|
||||
this.engineInstance.loadModel(url, options);
|
||||
this.engineInstance.loadModel(urls, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user