endset_three_editor 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.vue.d.ts +3 -0
- package/dist/components/BottomBar.vue.d.ts +3 -0
- package/dist/components/DrawingBoard.vue.d.ts +3 -0
- package/dist/components/PropertyPanel.vue.d.ts +36 -0
- package/dist/components/TopBar.vue.d.ts +9 -0
- package/dist/components/TreeItem.vue.d.ts +18 -0
- package/dist/composables/useTreeExpand.d.ts +10 -0
- package/dist/index.d.ts +8 -1
- package/dist/main.d.ts +0 -0
- package/dist/three/addHandle.d.ts +21 -0
- package/dist/three/index.d.ts +57 -0
- package/dist/three/types.d.ts +7 -0
- package/dist/views/Home.vue.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Object3D } from 'three';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 变换数据对象,包含 position, rotation, scale */
|
|
4
|
+
transform: {
|
|
5
|
+
position: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
z: number;
|
|
9
|
+
};
|
|
10
|
+
rotation: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
z: number;
|
|
14
|
+
};
|
|
15
|
+
scale: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
z: number;
|
|
19
|
+
};
|
|
20
|
+
} | null;
|
|
21
|
+
/** 顶层物体列表 */
|
|
22
|
+
treeData: Object3D[];
|
|
23
|
+
/** 当前选中的物体 */
|
|
24
|
+
selectedObject: Object3D | null;
|
|
25
|
+
};
|
|
26
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
27
|
+
propertyChange: () => any;
|
|
28
|
+
treeSelect: (obj: Object3D<import('three').Object3DEventMap>) => any;
|
|
29
|
+
treeDelete: (obj: Object3D<import('three').Object3DEventMap>) => any;
|
|
30
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
31
|
+
onPropertyChange?: (() => any) | undefined;
|
|
32
|
+
onTreeSelect?: ((obj: Object3D<import('three').Object3DEventMap>) => any) | undefined;
|
|
33
|
+
onTreeDelete?: ((obj: Object3D<import('three').Object3DEventMap>) => any) | undefined;
|
|
34
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
35
|
+
declare const _default: typeof __VLS_export;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
2
|
+
addModel: (type: string) => any;
|
|
3
|
+
importModel: (file: File) => any;
|
|
4
|
+
}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{
|
|
5
|
+
onAddModel?: ((type: string) => any) | undefined;
|
|
6
|
+
onImportModel?: ((file: File) => any) | undefined;
|
|
7
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Object3D } from 'three';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 当前节点对应的 Three.js 物体 */
|
|
4
|
+
node: Object3D;
|
|
5
|
+
/** 当前选中的物体(外部传入) */
|
|
6
|
+
selectedObject: Object3D | null;
|
|
7
|
+
/** 版本号,用于强制重新计算子节点列表 */
|
|
8
|
+
version: number;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
11
|
+
select: (obj: Object3D<import('three').Object3DEventMap>) => any;
|
|
12
|
+
delete: (obj: Object3D<import('three').Object3DEventMap>) => any;
|
|
13
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
|
+
onSelect?: ((obj: Object3D<import('three').Object3DEventMap>) => any) | undefined;
|
|
15
|
+
onDelete?: ((obj: Object3D<import('three').Object3DEventMap>) => any) | undefined;
|
|
16
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { Object3D } from 'three';
|
|
3
|
+
/**
|
|
4
|
+
* @param selectedObject - 响应式的当前选中物体(Ref)
|
|
5
|
+
* @returns 包含展开集合和切换方法的对象
|
|
6
|
+
*/
|
|
7
|
+
export declare function useTreeExpand(selectedObject: Ref<Object3D | null>): {
|
|
8
|
+
expandedSet: Ref<Set<string> & Omit<Set<string>, keyof Set<any>>, Set<string> | (Set<string> & Omit<Set<string>, keyof Set<any>>)>;
|
|
9
|
+
toggleExpand: (uuid: string) => void;
|
|
10
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export { default as DrawingBoard } from './components/DrawingBoard.vue';
|
|
2
|
+
export { default as PropertyPanel } from './components/PropertyPanel.vue';
|
|
3
|
+
export { default as TopBar } from './components/TopBar.vue';
|
|
4
|
+
export { default as BottomBar } from './components/BottomBar.vue';
|
|
5
|
+
export { default as TreeItem } from './components/TreeItem.vue';
|
|
6
|
+
export * from './three';
|
|
7
|
+
export * from './three/addHandle';
|
|
8
|
+
export { useTreeExpand } from './composables/useTreeExpand';
|
package/dist/main.d.ts
ADDED
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 提供添加基础几何体(正方体、球体)以及导入外部模型文件的功能
|
|
3
|
+
* 所有模型均自动标记为可移动(isMovable = true)
|
|
4
|
+
*/
|
|
5
|
+
import * as THREE from "three";
|
|
6
|
+
/** 添加一个蓝色的正方体,位置在地面上方 0.5 单位 */
|
|
7
|
+
export declare function addBox(): THREE.Mesh<THREE.BoxGeometry, THREE.MeshStandardMaterial, THREE.Object3DEventMap>;
|
|
8
|
+
/** 添加一个橙色的球体,位置在地面上方 0.6 单位 */
|
|
9
|
+
export declare function addSphere(): THREE.Mesh<THREE.SphereGeometry, THREE.MeshStandardMaterial, THREE.Object3DEventMap>;
|
|
10
|
+
/**
|
|
11
|
+
* 从 File 对象导入 3D 模型(支持 .obj, .gltf, .glb)
|
|
12
|
+
* 导入后自动标记所有节点为可移动,并居中放置
|
|
13
|
+
* @param file - 模型文件
|
|
14
|
+
* @returns Promise 解析为模型根对象
|
|
15
|
+
*/
|
|
16
|
+
export declare function importModelFromFile(file: File): Promise<THREE.Object3D>;
|
|
17
|
+
/**
|
|
18
|
+
* 根据类型字符串添加对应的基础模型
|
|
19
|
+
* @param type - 'box' 或 'sphere'
|
|
20
|
+
*/
|
|
21
|
+
export declare function addModelByType(type: string): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Object3D } from 'three';
|
|
2
|
+
import { SelectedChangeCallback, TransformChangeCallback, SceneObjectsChangeCallback } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 3D 模型编辑器核心模块
|
|
5
|
+
* 提供场景管理、物体增删、选中/变换控制、树形数据同步等功能
|
|
6
|
+
* 采用单例模式管理所有 Three.js 相关状态
|
|
7
|
+
*/
|
|
8
|
+
import * as THREE from "three";
|
|
9
|
+
/**
|
|
10
|
+
* 初始化编辑器,挂载到指定 DOM 容器
|
|
11
|
+
* @param container - 编辑器挂载的 DOM 元素
|
|
12
|
+
*/
|
|
13
|
+
export declare function initEditor(container: HTMLElement): void;
|
|
14
|
+
/**
|
|
15
|
+
* 选中场景中的一个物体,将其附着到变换控制器并显示平移轴
|
|
16
|
+
* @param obj - 要选中的物体
|
|
17
|
+
*/
|
|
18
|
+
export declare function selectObject(obj: Object3D): void;
|
|
19
|
+
/**
|
|
20
|
+
* 向场景添加一个模型(Object3D 及其子节点)
|
|
21
|
+
* @param model - 要添加的模型对象
|
|
22
|
+
* @param selected - 是否添加后立即选中
|
|
23
|
+
*/
|
|
24
|
+
export declare function addModel(model: Object3D, selected?: boolean): void;
|
|
25
|
+
/**
|
|
26
|
+
* 从场景中移除一个模型及其子节点
|
|
27
|
+
* @param model - 要移除的模型对象
|
|
28
|
+
*/
|
|
29
|
+
export declare function removeModel(model: Object3D): void;
|
|
30
|
+
/**
|
|
31
|
+
* 根据 UUID 删除场景中的物体
|
|
32
|
+
* @param uuid - 物体的唯一标识符
|
|
33
|
+
*/
|
|
34
|
+
export declare function removeModelById(uuid: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* 注册选中物体变化的回调
|
|
37
|
+
* @param cb - 回调函数,参数为当前选中的物体或 null
|
|
38
|
+
*/
|
|
39
|
+
export declare function setSelectedObjectCallback(cb: SelectedChangeCallback): void;
|
|
40
|
+
/**
|
|
41
|
+
* 注册变换过程中(拖拽)的回调
|
|
42
|
+
* @param cb - 回调函数,参数为正在变换的物体
|
|
43
|
+
*/
|
|
44
|
+
export declare function setTransformChangeCallback(cb: TransformChangeCallback): void;
|
|
45
|
+
/**
|
|
46
|
+
* 注册场景物体列表变化的回调
|
|
47
|
+
* @param cb - 回调函数,参数为当前顶层物体列表
|
|
48
|
+
*/
|
|
49
|
+
export declare function onSceneObjectsChangeCallback(cb: SceneObjectsChangeCallback): void;
|
|
50
|
+
/**
|
|
51
|
+
* 获取当前顶层物体列表
|
|
52
|
+
* @returns 顶层物体数组
|
|
53
|
+
*/
|
|
54
|
+
export declare function getSceneObjects(): THREE.Object3D<THREE.Object3DEventMap>[];
|
|
55
|
+
export declare function getScene(): THREE.Scene<THREE.Object3DEventMap> | null;
|
|
56
|
+
export declare function getCamera(): THREE.PerspectiveCamera | null;
|
|
57
|
+
export declare function getRenderer(): THREE.WebGLRenderer | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Object3D } from 'three';
|
|
2
|
+
/** 选中对象变化时的回调函数类型 */
|
|
3
|
+
export type SelectedChangeCallback = (obj: Object3D | null) => void;
|
|
4
|
+
/** 变换过程中(拖拽时)的回调函数类型 */
|
|
5
|
+
export type TransformChangeCallback = (obj: Object3D) => void;
|
|
6
|
+
/** 场景物体列表变化时的回调函数类型 */
|
|
7
|
+
export type SceneObjectsChangeCallback = (objects: Object3D[]) => void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|