@gcode-viewer/plugins 0.3.0

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.
Files changed (140) hide show
  1. package/README.md +26 -0
  2. package/dist/index.esm.js +288 -0
  3. package/dist/types/axis-gizmo/AxisGizmoPlugin.d.ts +25 -0
  4. package/dist/types/axis-gizmo/CoordinateAxes.d.ts +1 -0
  5. package/dist/types/axis-gizmo/index.d.ts +2 -0
  6. package/dist/types/bottom-bar/BottomBarPlugin.d.ts +36 -0
  7. package/dist/types/bottom-bar/index.d.ts +2 -0
  8. package/dist/types/context-menu/Constants.d.ts +34 -0
  9. package/dist/types/context-menu/ContextMenu.config.d.ts +2 -0
  10. package/dist/types/context-menu/ContextMenuPlugin.d.ts +23 -0
  11. package/dist/types/context-menu/Locale.d.ts +51 -0
  12. package/dist/types/context-menu/index.d.ts +4 -0
  13. package/dist/types/dat-gui/Viewer3dDatGui.d.ts +69 -0
  14. package/dist/types/dat-gui/index.d.ts +1 -0
  15. package/dist/types/explode/ExplodePlugin.d.ts +46 -0
  16. package/dist/types/explode/ObjectExploder.d.ts +48 -0
  17. package/dist/types/explode/index.d.ts +1 -0
  18. package/dist/types/export/ExportPlugin.d.ts +57 -0
  19. package/dist/types/export/Locale.d.ts +41 -0
  20. package/dist/types/export/gltf/GltfExporter.d.ts +32 -0
  21. package/dist/types/export/gltf/index.d.ts +1 -0
  22. package/dist/types/export/index.d.ts +2 -0
  23. package/dist/types/export/obj/ObjZipExporter.d.ts +14 -0
  24. package/dist/types/export/obj/index.d.ts +3 -0
  25. package/dist/types/export/obj/mtl.d.ts +9 -0
  26. package/dist/types/export/obj/textures.d.ts +15 -0
  27. package/dist/types/gcode-layer-bar/GCodeLayerBarPlugin.d.ts +66 -0
  28. package/dist/types/gcode-layer-bar/Locale.d.ts +13 -0
  29. package/dist/types/gcode-layer-bar/index.d.ts +2 -0
  30. package/dist/types/gcode-legend/GCodeLegendPlugin.d.ts +58 -0
  31. package/dist/types/gcode-legend/Locale.d.ts +83 -0
  32. package/dist/types/gcode-legend/NephogramLegend.d.ts +8 -0
  33. package/dist/types/gcode-legend/index.d.ts +2 -0
  34. package/dist/types/gcode-steps-bar/GCodeStepsBarPlugin.d.ts +46 -0
  35. package/dist/types/gcode-steps-bar/Locale.d.ts +11 -0
  36. package/dist/types/gcode-steps-bar/index.d.ts +2 -0
  37. package/dist/types/gcode-text-panel/GCodeTextPanelPlugin.d.ts +54 -0
  38. package/dist/types/gcode-text-panel/Locale.d.ts +11 -0
  39. package/dist/types/gcode-text-panel/index.d.ts +2 -0
  40. package/dist/types/ground-grid/GroundGridPlugin.d.ts +38 -0
  41. package/dist/types/ground-grid/index.d.ts +1 -0
  42. package/dist/types/ground-shaow/GroundShadowPlugin.d.ts +58 -0
  43. package/dist/types/ground-shaow/index.d.ts +1 -0
  44. package/dist/types/hotpoint/HotpointPlugin.d.ts +92 -0
  45. package/dist/types/hotpoint/index.d.ts +1 -0
  46. package/dist/types/index.d.ts +29 -0
  47. package/dist/types/local-model-uploader/IUploader.d.ts +55 -0
  48. package/dist/types/local-model-uploader/LocalModelUploader.d.ts +19 -0
  49. package/dist/types/local-model-uploader/index.d.ts +2 -0
  50. package/dist/types/measurements/AngleMeasureDrawable.d.ts +12 -0
  51. package/dist/types/measurements/AngleMeasurement.d.ts +13 -0
  52. package/dist/types/measurements/AreaMeasureDrawable.d.ts +14 -0
  53. package/dist/types/measurements/AreaMeasurement.d.ts +24 -0
  54. package/dist/types/measurements/BaseMeasureDrawable.d.ts +28 -0
  55. package/dist/types/measurements/BaseMeasurement.d.ts +123 -0
  56. package/dist/types/measurements/CoordinateMeasureDrawable.d.ts +10 -0
  57. package/dist/types/measurements/CoordinateMeasurement.d.ts +12 -0
  58. package/dist/types/measurements/DistanceMeasureDrawable.d.ts +13 -0
  59. package/dist/types/measurements/DistanceMeasurement.d.ts +21 -0
  60. package/dist/types/measurements/Locale.d.ts +13 -0
  61. package/dist/types/measurements/MeasurementPlugin.d.ts +102 -0
  62. package/dist/types/measurements/index.d.ts +3 -0
  63. package/dist/types/measurements/undo/AddMeasurementCommand.d.ts +10 -0
  64. package/dist/types/measurements/undo/RemoveMeasurementCommand.d.ts +10 -0
  65. package/dist/types/plate/PlatePlugin.d.ts +85 -0
  66. package/dist/types/plate/index.d.ts +1 -0
  67. package/dist/types/property/AnimationPanel.d.ts +3 -0
  68. package/dist/types/property/CameraEditor.d.ts +3 -0
  69. package/dist/types/property/EnvironmentPanel.d.ts +3 -0
  70. package/dist/types/property/LightEditor.d.ts +3 -0
  71. package/dist/types/property/Locale.d.ts +83 -0
  72. package/dist/types/property/MaterialEditor.d.ts +9 -0
  73. package/dist/types/property/PropertyPanelUi.d.ts +34 -0
  74. package/dist/types/property/PropertyPlugin.d.ts +95 -0
  75. package/dist/types/property/Utils.d.ts +19 -0
  76. package/dist/types/property/Vec3Field.d.ts +25 -0
  77. package/dist/types/property/index.d.ts +2 -0
  78. package/dist/types/rhino-3dm-loader/Rhino3dmLoaderPlugin.d.ts +17 -0
  79. package/dist/types/rhino-3dm-loader/Rhino3dmModelLoader.d.ts +25 -0
  80. package/dist/types/rhino-3dm-loader/index.d.ts +1 -0
  81. package/dist/types/scene-edit/SceneEditActions.d.ts +24 -0
  82. package/dist/types/scene-edit/SceneEditPlugin.d.ts +26 -0
  83. package/dist/types/scene-edit/SceneEditRecording.d.ts +11 -0
  84. package/dist/types/scene-edit/SceneMeshSnapshot.d.ts +23 -0
  85. package/dist/types/scene-edit/SceneMeshSnapshotUtils.d.ts +11 -0
  86. package/dist/types/scene-edit/SceneNodeSnapshot.d.ts +7 -0
  87. package/dist/types/scene-edit/SceneNodeSnapshotUtils.d.ts +11 -0
  88. package/dist/types/scene-edit/commands/GeometryEditCommand.d.ts +10 -0
  89. package/dist/types/scene-edit/commands/InsertSceneNodeCommand.d.ts +10 -0
  90. package/dist/types/scene-edit/commands/MaterialEditCommand.d.ts +10 -0
  91. package/dist/types/scene-edit/commands/MoveSceneNodeCommand.d.ts +10 -0
  92. package/dist/types/scene-edit/commands/RemoveSceneObjectCommand.d.ts +9 -0
  93. package/dist/types/scene-edit/commands/TransformSceneObjectCommand.d.ts +17 -0
  94. package/dist/types/scene-edit/index.d.ts +13 -0
  95. package/dist/types/screenshot/ScreenshotPlugin.d.ts +134 -0
  96. package/dist/types/screenshot/index.d.ts +1 -0
  97. package/dist/types/sections/AxisPlaneSection.d.ts +65 -0
  98. package/dist/types/sections/AxisSectionPopPanel.d.ts +18 -0
  99. package/dist/types/sections/BaseSection.d.ts +64 -0
  100. package/dist/types/sections/Locale.d.ts +21 -0
  101. package/dist/types/sections/ObjectsBoxSection.d.ts +29 -0
  102. package/dist/types/sections/PickPlaneSection.d.ts +48 -0
  103. package/dist/types/sections/PickSectionPopPanel.d.ts +18 -0
  104. package/dist/types/sections/Section.constants.d.ts +13 -0
  105. package/dist/types/sections/SectionGizmo.d.ts +22 -0
  106. package/dist/types/sections/SectionPlaneMesh.d.ts +23 -0
  107. package/dist/types/sections/SectionPlugin.d.ts +147 -0
  108. package/dist/types/sections/index.d.ts +6 -0
  109. package/dist/types/settings-3d/Locale.d.ts +61 -0
  110. package/dist/types/settings-3d/Settings3dPlugin.d.ts +46 -0
  111. package/dist/types/settings-3d/index.d.ts +2 -0
  112. package/dist/types/skybox/GradientColorSkybox.d.ts +9 -0
  113. package/dist/types/skybox/SkyboxPlugin.d.ts +48 -0
  114. package/dist/types/skybox/index.d.ts +1 -0
  115. package/dist/types/stats/StatsPlugin.d.ts +18 -0
  116. package/dist/types/stats/index.d.ts +2 -0
  117. package/dist/types/step-loader/OcctImportScriptLoader.d.ts +22 -0
  118. package/dist/types/step-loader/StepLoaderPlugin.d.ts +22 -0
  119. package/dist/types/step-loader/StepModelLoader.d.ts +39 -0
  120. package/dist/types/step-loader/index.d.ts +3 -0
  121. package/dist/types/step-loader/occtMeshBuilder.d.ts +35 -0
  122. package/dist/types/toolbars/Locale.d.ts +57 -0
  123. package/dist/types/toolbars/Toolbar.config.d.ts +5 -0
  124. package/dist/types/toolbars/Toolbar.constants.d.ts +71 -0
  125. package/dist/types/toolbars/Toolbar.d.ts +112 -0
  126. package/dist/types/toolbars/Viewer3dToolbarPlugin.d.ts +37 -0
  127. package/dist/types/toolbars/index.d.ts +5 -0
  128. package/dist/types/transform/Locale.d.ts +21 -0
  129. package/dist/types/transform/TransformPlugin.d.ts +38 -0
  130. package/dist/types/transform/index.d.ts +1 -0
  131. package/dist/types/tree-view/Locale.d.ts +29 -0
  132. package/dist/types/tree-view/TreeNodeTypeIcons.d.ts +15 -0
  133. package/dist/types/tree-view/TreeViewDragDrop.d.ts +17 -0
  134. package/dist/types/tree-view/TreeViewPlugin.d.ts +66 -0
  135. package/dist/types/tree-view/index.d.ts +2 -0
  136. package/dist/types/view-cube/Locale.d.ts +21 -0
  137. package/dist/types/view-cube/ViewCube.d.ts +86 -0
  138. package/dist/types/view-cube/ViewCubePlugin.d.ts +20 -0
  139. package/dist/types/view-cube/index.d.ts +2 -0
  140. package/package.json +73 -0
@@ -0,0 +1,25 @@
1
+ import { BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ /**
3
+ * AxisGizmo plugin config.
4
+ */
5
+ export interface AxisGizmoPluginConfig extends Partial<PluginConfig> {
6
+ /**
7
+ * UI element id to contain the plugin.
8
+ */
9
+ containerId?: string;
10
+ /**
11
+ * Ignores z-axis. It is useful for Viewer2d.
12
+ */
13
+ ignoreZAxis?: boolean;
14
+ }
15
+ /**
16
+ * This renderer monitors the host renderer's camera, and keeps a coordinate axes
17
+ * the same direction as host renderer's
18
+ */
19
+ export declare class AxisGizmoPlugin extends Plugin {
20
+ static readonly DEFAULT_ID = "AxisGizmoPlugin";
21
+ constructor(viewer: BaseViewer, cfg?: AxisGizmoPluginConfig);
22
+ setVisible(visible: boolean): void;
23
+ isVisible(): boolean;
24
+ destroy(): void;
25
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import "./axisgizmo.scss";
2
+ export * from "./AxisGizmoPlugin";
@@ -0,0 +1,36 @@
1
+ import { IconClass, BaseViewer, Plugin } from "@gcode-viewer/core";
2
+ import { Tooltip } from "@gcode-viewer/ui";
3
+ declare enum BottomBarItemId {
4
+ statistics = "gcode-viewer-threejs-statistics",
5
+ cameraCfg = "gcode-viewer-threejs-cameraCfg",
6
+ tips = "gcode-viewer-threejs-tips"
7
+ }
8
+ interface BottomBarItemConfig {
9
+ icon: IconClass;
10
+ mutexIds?: BottomBarItemId[];
11
+ onActive?: (item: BottomBarItem) => void;
12
+ onDeactive?: (item: BottomBarItem) => void;
13
+ onClick?: (item: BottomBarItem) => void;
14
+ onUpdate?: (item: BottomBarItem) => void;
15
+ }
16
+ /**
17
+ * Bottom bar plugin is a debug tool for developers.
18
+ */
19
+ export declare class BottomBarPlugin extends Plugin {
20
+ itemList: Map<string, BottomBarItem>;
21
+ constructor(viewer: BaseViewer);
22
+ update(): void;
23
+ }
24
+ declare class BottomBarItem {
25
+ readonly viewer: BaseViewer;
26
+ private readonly bottomBar;
27
+ protected readonly menuId: string;
28
+ protected cfg: BottomBarItemConfig;
29
+ tooltip: Tooltip;
30
+ element: HTMLElement;
31
+ active: boolean;
32
+ constructor(viewer: BaseViewer, bottomBar: BottomBarPlugin, menuId: string, cfg: BottomBarItemConfig);
33
+ setActive(active: boolean): void;
34
+ update(): void;
35
+ }
36
+ export {};
@@ -0,0 +1,2 @@
1
+ import "./bottombar.scss";
2
+ export * from "./BottomBarPlugin";
@@ -0,0 +1,34 @@
1
+ import type { BaseViewer } from "@gcode-viewer/core";
2
+ import type { AxisPlaneSection, ObjectsBoxSection, PickPlaneSection } from "../sections";
3
+ import type { Toolbar } from "../toolbars";
4
+ /**
5
+ * Context for ContextMenu
6
+ * @hidden
7
+ */
8
+ export interface Context {
9
+ viewer: BaseViewer;
10
+ hit?: any;
11
+ instanceId?: number;
12
+ batchId?: number;
13
+ /**
14
+ * For Viewer3d
15
+ * @hidden
16
+ */
17
+ section?: ObjectsBoxSection | PickPlaneSection | AxisPlaneSection;
18
+ toolbar?: Toolbar;
19
+ }
20
+ /**
21
+ * @hidden
22
+ */
23
+ /**
24
+ * @hidden
25
+ */
26
+ export interface ContextMenuItem {
27
+ title?: string;
28
+ enabled?: boolean;
29
+ shown?: boolean;
30
+ getTitle?: (context: Context) => string;
31
+ getEnabled?: (context: Context) => boolean;
32
+ getShown?: (context: Context) => boolean;
33
+ doAction?: (context: Context) => void;
34
+ }
@@ -0,0 +1,2 @@
1
+ import { ContextMenuItem } from "./Constants";
2
+ export declare const ContextMenuItems: ContextMenuItem[][];
@@ -0,0 +1,23 @@
1
+ import { type BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ import { Context, ContextMenuItem } from "./Constants";
3
+ /**
4
+ * Context menu plugin config.
5
+ */
6
+ export type ContextMenuPluginConfig = Partial<PluginConfig>;
7
+ /**
8
+ * Context menu plugin.
9
+ * Can be used by Viewer3d.
10
+ */
11
+ export declare class ContextMenuPlugin extends Plugin {
12
+ static readonly DEFAULT_ID = "ContextMenuPlugin";
13
+ protected cfg: ContextMenuPluginConfig;
14
+ protected container: HTMLElement;
15
+ protected element: HTMLDivElement;
16
+ protected context: Context;
17
+ protected itemList: [ContextMenuItem, HTMLElement][];
18
+ constructor(viewer: BaseViewer, cfg?: ContextMenuPluginConfig);
19
+ protected handleClick: () => void;
20
+ show(pageX: number, pageY: number): void;
21
+ hide(): void;
22
+ destroy(): void;
23
+ }
@@ -0,0 +1,51 @@
1
+ import { i18n } from "@gcode-viewer/core";
2
+ export declare const en: {
3
+ viewFitAll: string;
4
+ hideAll: string;
5
+ showAll: string;
6
+ xRayAll: string;
7
+ xRayNone: string;
8
+ selectNone: string;
9
+ resetView: string;
10
+ viewFitEntity: string;
11
+ hideEntity: string;
12
+ hideOthers: string;
13
+ xRayEntity: string;
14
+ xRayOthers: string;
15
+ select: string;
16
+ deselect: string;
17
+ showSectionPlane: string;
18
+ showSectionBox: string;
19
+ showAxisSection: string;
20
+ hideSectionPlane: string;
21
+ hideSectionBox: string;
22
+ hideAxisSection: string;
23
+ undoSection: string;
24
+ };
25
+ export declare const zh: {
26
+ viewFitAll: string;
27
+ hideAll: string;
28
+ showAll: string;
29
+ xRayAll: string;
30
+ xRayNone: string;
31
+ selectNone: string;
32
+ resetView: string;
33
+ viewFitEntity: string;
34
+ hideEntity: string;
35
+ hideOthers: string;
36
+ xRayEntity: string;
37
+ xRayOthers: string;
38
+ select: string;
39
+ deselect: string;
40
+ showSectionPlane: string;
41
+ showSectionBox: string;
42
+ showAxisSection: string;
43
+ hideSectionPlane: string;
44
+ hideSectionBox: string;
45
+ hideAxisSection: string;
46
+ undoSection: string;
47
+ };
48
+ export declare const CONTEXT_MENU_I18N_NAMESPACE: "contextMenu";
49
+ export { i18n };
50
+ export type ContextMenuTranslationKey = keyof typeof en;
51
+ export declare function t(translateKey: ContextMenuTranslationKey | string): string;
@@ -0,0 +1,4 @@
1
+ import "./contextmenu.scss";
2
+ export * from "./Constants";
3
+ export * from "./ContextMenuPlugin";
4
+ export * from "./ContextMenu.config";
@@ -0,0 +1,69 @@
1
+ import { Plugin, Viewer3d } from "@gcode-viewer/core";
2
+ import * as dat from "dat.gui";
3
+ /**
4
+ * Can be used by Viewer3d.
5
+ * @hidden
6
+ */
7
+ export declare class Viewer3dDatGuiPlugin extends Plugin {
8
+ protected viewer: Viewer3d;
9
+ gui?: dat.GUI;
10
+ /**
11
+ *
12
+ * @param viewer pass in the Viewer3D, so we can reference its data members
13
+ */
14
+ constructor(viewer: Viewer3d);
15
+ /**
16
+ * Defined all controls here, which will be displyed in dat.GUI
17
+ * Color should follow these formats:
18
+ * '#ffffff', [0, 0, 0], [0, 0, 0, 0.5], \{ h: 100, s: 0.9, v: 0.3 \}
19
+ */
20
+ readonly controls: {
21
+ showGroundGrid: boolean;
22
+ environments: string[];
23
+ homeView: () => void;
24
+ views: string[];
25
+ OrthographicCamera: boolean;
26
+ viewpoints: boolean;
27
+ annotations: boolean;
28
+ takeSnapshot: () => void;
29
+ takeSnapshotForViewerBBox: () => void;
30
+ fullScreen: () => void;
31
+ webcam: boolean;
32
+ uploadFile: () => void;
33
+ showTreeView: boolean;
34
+ showPropertyPanel: boolean;
35
+ transparentMode: boolean;
36
+ enableOutline: boolean;
37
+ doubleSidedMaterial: boolean;
38
+ showVertexNormals: boolean;
39
+ explode: number;
40
+ sectionMode: string[];
41
+ alVisible: boolean;
42
+ alColor: string;
43
+ alIntensity: number;
44
+ dlColor: string;
45
+ showDlHelper: boolean;
46
+ hlVisible: boolean;
47
+ hlIntensity: number;
48
+ hlColor: number[];
49
+ hlGroundColor: number[];
50
+ fogEnabled: boolean;
51
+ fogColor: number;
52
+ fogNearDistance: number;
53
+ fogFarDistance: number;
54
+ distanceCullingFactor: number;
55
+ errorTarget: number;
56
+ ssao_output: string;
57
+ ssao_kernelRadius: number;
58
+ ssao_minDistance: number;
59
+ ssao_maxDistance: number;
60
+ ssao_enable: boolean;
61
+ };
62
+ /**
63
+ * Init dat.GUI
64
+ */
65
+ init(): void;
66
+ open(): void;
67
+ close(): void;
68
+ destroy(): void;
69
+ }
@@ -0,0 +1 @@
1
+ export * from "./Viewer3dDatGui";
@@ -0,0 +1,46 @@
1
+ import { THREE, BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ import { ObjectExploder } from "./ObjectExploder";
3
+ export interface ExplodePluginConfig extends Partial<PluginConfig> {
4
+ /**
5
+ * Explode center.
6
+ * If specified, each object explode based on this position. Otherwise,
7
+ * each object explode based on its own center.
8
+ */
9
+ explodeCenter?: THREE.Vector3;
10
+ /**
11
+ * By default, it explodes to every direction. In some scenarios, user may want to
12
+ * explode only in up/down direction.
13
+ */
14
+ explodeUp?: boolean;
15
+ }
16
+ /**
17
+ * Exploder class is used to explode objects in a viewer.
18
+ * Can be used by Viewer3d.
19
+ * @hidden
20
+ */
21
+ export declare class ExplodePlugin extends Plugin {
22
+ static readonly DEFAULT_ID = "ExplodePlugin";
23
+ protected cfg: ExplodePluginConfig;
24
+ protected exploders: ObjectExploder[];
25
+ constructor(viewer: BaseViewer, cfg?: ExplodePluginConfig);
26
+ get scene(): THREE.Scene;
27
+ /**
28
+ * Initialize the
29
+ */
30
+ init(): void;
31
+ /**
32
+ * Explode objects
33
+ * @param scale 1 means do not explode at all, recommended value between 1-5.
34
+ */
35
+ explode(scale: number): void;
36
+ /**
37
+ * Unexplode objects
38
+ */
39
+ unexplode(): void;
40
+ protected onModelLoaded: () => void;
41
+ /**
42
+ * Checks if exploder already exists for a model/object.
43
+ */
44
+ protected hasExploderForModel(modelObjectId: number): boolean;
45
+ destroy(): void;
46
+ }
@@ -0,0 +1,48 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ /**
3
+ * ObjectExploder class is used to explode an object
4
+ * @hidden
5
+ */
6
+ export declare class ObjectExploder {
7
+ private scene;
8
+ objectId: number;
9
+ explodeCenter: THREE.Vector3;
10
+ private scale;
11
+ private explodeUp;
12
+ /**
13
+ * Constructor of Explode
14
+ * @param objectId target object id, that is going to be exploded
15
+ * @param explodeCenter if undefined, will explode object by its center
16
+ * @param scale scale factor, 1 means 1 time farer away from exploder's position
17
+ */
18
+ constructor(scene: THREE.Scene, objectId: number, explodeCenter?: THREE.Vector3 | undefined);
19
+ /**
20
+ * Explodes the object
21
+ */
22
+ explode(scale: number): void;
23
+ /**
24
+ * Explodes a parent or leaf object.
25
+ * If an object has both geometry and children, we'll move itself
26
+ * and we shouldn't move its children again.
27
+ */
28
+ private explodeObject;
29
+ /**
30
+ * Explodes a leaf object (that has geometry, and ususally no children).
31
+ * It doesn't support THREE.InstancedMesh.
32
+ */
33
+ private explodeLeafObject;
34
+ /**
35
+ * Unexplodes the object
36
+ */
37
+ unexplode(): void;
38
+ /**
39
+ * Unexplodes a parent or leaf object
40
+ */
41
+ private unexplodeObject;
42
+ /**
43
+ * Unexplodes a leaf object
44
+ */
45
+ private unexplodeLeafObject;
46
+ setExplodeUp(explodeUp: boolean): void;
47
+ private getObjectCenter;
48
+ }
@@ -0,0 +1 @@
1
+ export * from "./ExplodePlugin";
@@ -0,0 +1,57 @@
1
+ import { THREE, BaseViewer, Plugin, PluginConfig, Viewer3d, THREEAddons } from "@gcode-viewer/core";
2
+ import { BasePanel } from "@gcode-viewer/ui";
3
+ export declare enum ExportFormats {
4
+ Glb = "glb",
5
+ Gltf = "gltf",
6
+ Obj = "obj",
7
+ Stl = "stl",
8
+ Ply = "ply"
9
+ }
10
+ /**
11
+ * Export plugin config.
12
+ */
13
+ export type ExportPluginConfig = Partial<PluginConfig>;
14
+ /**
15
+ * Export plugin is used to export scene to a 3d model.
16
+ * @description
17
+ */
18
+ export declare class ExportPlugin extends Plugin {
19
+ static readonly DEFAULT_ID = "ExportPlugin";
20
+ protected cfg: ExportPluginConfig;
21
+ protected basePanel?: BasePanel;
22
+ protected viewer3d: Viewer3d;
23
+ constructor(viewer: BaseViewer, cfg?: ExportPluginConfig);
24
+ private readonly onLanguageChange;
25
+ private applyLocalizedChrome;
26
+ /**
27
+ * Exports to gltf or glb format.
28
+ * @param filename pure filename without extension.
29
+ * @param options GLTFExporter options.
30
+ * @param targetObject optional specific object to export; defaults to all loaded models.
31
+ * @param quantize when true, geometry attributes are quantized via KHR_mesh_quantization
32
+ * (POSITION→Int16, NORMAL→Int8, UV→Uint16) to reduce file size by ~30–50 %.
33
+ * Forces `trs: false` (matrix mode) so per-mesh decode matrices are written correctly.
34
+ */
35
+ exportGltf(filename: string, options?: THREEAddons.GLTFExporterOptions, targetObject?: THREE.Object3D | null, quantize?: boolean): void;
36
+ /**
37
+ * Exports to OBJ format.
38
+ * @param filename pure filename without extension.
39
+ */
40
+ exportObj(filename: string, targetObject?: THREE.Object3D | null): void;
41
+ exportStl(filename: string, targetObject?: THREE.Object3D | null): void;
42
+ exportPly(filename: string, binary?: boolean, targetObject?: THREE.Object3D | null): void;
43
+ /**
44
+ * Shows the export options panel.
45
+ */
46
+ showExportPanel(targetFormat?: ExportFormats, filename?: string, targetObject?: THREE.Object3D | null): void;
47
+ private normalizeExportBaseName;
48
+ /**
49
+ * Saves/downloads a blob as a file.
50
+ * @param blob The blob to save.
51
+ * @param filename The filename (with extension) to save as.
52
+ */
53
+ saveBlobAsFile(blob: Blob, filename: string): void;
54
+ saveStringAsFile(text: string, filename: string): void;
55
+ saveArrayBufferAsFile: (buffer: ArrayBuffer, filename: string) => void;
56
+ destroy(): void;
57
+ }
@@ -0,0 +1,41 @@
1
+ import { i18n } from "@gcode-viewer/core";
2
+ export declare const en: {
3
+ export: string;
4
+ format: string;
5
+ fileName: string;
6
+ embedTextures: string;
7
+ embedGeometry: string;
8
+ useTrsTransforms: string;
9
+ visibleObjects: string;
10
+ customExtensions: string;
11
+ quantizeGeometry: string;
12
+ binary: string;
13
+ exportButton: string;
14
+ formatObj: string;
15
+ formatStl: string;
16
+ formatPly: string;
17
+ formatGltf: string;
18
+ formatGlb: string;
19
+ };
20
+ export declare const zh: {
21
+ export: string;
22
+ format: string;
23
+ fileName: string;
24
+ embedTextures: string;
25
+ embedGeometry: string;
26
+ useTrsTransforms: string;
27
+ visibleObjects: string;
28
+ customExtensions: string;
29
+ quantizeGeometry: string;
30
+ binary: string;
31
+ exportButton: string;
32
+ formatObj: string;
33
+ formatStl: string;
34
+ formatPly: string;
35
+ formatGltf: string;
36
+ formatGlb: string;
37
+ };
38
+ export declare const EXPORT_I18N_NAMESPACE: "export";
39
+ export { i18n };
40
+ export type ExportTranslationKey = keyof typeof en;
41
+ export declare function t(key: ExportTranslationKey): string;
@@ -0,0 +1,32 @@
1
+ import { THREE, THREEAddons } from "@gcode-viewer/core";
2
+ export declare const DefaultGltfExportOptions: THREEAddons.GLTFExporterOptions;
3
+ /**
4
+ * Wraps `THREEAddons.GLTFExporter` with optional KHR_mesh_quantization pre-processing.
5
+ */
6
+ export declare class GltfExporter {
7
+ /**
8
+ * Exports `objects` to GLB / GLTF.
9
+ *
10
+ * When `quantize` is true, geometry attributes are converted before export:
11
+ * - POSITION : Float32 → Int16 normalized; decode matrix is baked into each
12
+ * mesh's node matrix (requires `trs: false`, enforced automatically).
13
+ * - NORMAL : Float32 → Int8 normalized (75 % smaller per vertex)
14
+ * - UV attrs : Float32 → Uint16 normalized (50 % smaller, [0,1] range only)
15
+ *
16
+ * Geometry deduplication is preserved: meshes that shared the same BufferGeometry
17
+ * will still share the same quantized clone, so shared geometry is only written once.
18
+ */
19
+ parse(objects: THREE.Object3D[], options: THREEAddons.GLTFExporterOptions, onDone: (result: ArrayBuffer | object) => void, onError: (error: ErrorEvent) => void, quantize?: boolean): void;
20
+ }
21
+ /**
22
+ * Clone `objects` and quantize their geometry attributes.
23
+ * Returns `{ clones, dispose }`. Call `dispose()` after the export finishes.
24
+ *
25
+ * Geometry deduplication is preserved: meshes that shared the same BufferGeometry
26
+ * before cloning will still share the same quantized BufferGeometry afterward,
27
+ * so the GLTFExporter writes each unique geometry only once.
28
+ */
29
+ export declare function quantizeObjectsForGltf(objects: THREE.Object3D[]): {
30
+ clones: THREE.Object3D[];
31
+ dispose: () => void;
32
+ };
@@ -0,0 +1 @@
1
+ export * from "./GltfExporter";
@@ -0,0 +1,2 @@
1
+ import "./ExportPlugin.scss";
2
+ export * from "./ExportPlugin";
@@ -0,0 +1,14 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ import { type ExportedTextureFile } from "./textures";
3
+ export type ObjZipExportResult = {
4
+ objFilename: string;
5
+ objText: string;
6
+ mtlFilename: string | null;
7
+ mtlText: string | null;
8
+ textureFiles: ExportedTextureFile[];
9
+ };
10
+ export declare class ObjZipExporter {
11
+ exportSync(root: THREE.Object3D, _baseName: string): string;
12
+ export(root: THREE.Object3D, baseName: string): Promise<ObjZipExportResult>;
13
+ private injectMtllib;
14
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./ObjZipExporter";
2
+ export * from "./mtl";
3
+ export * from "./textures";
@@ -0,0 +1,9 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ import type { ExportedTextureFile } from "./textures";
3
+ export type MtlTextureBindings = Partial<Record<"map_Kd", ExportedTextureFile>>;
4
+ export declare function getMaterialName(material: THREE.Material, fallbackIndex: number): string;
5
+ /**
6
+ * Minimal MTL writer: writes Kd (color), opacity (d) and optional map_Kd.
7
+ * Writes fields only if source data exists.
8
+ */
9
+ export declare function writeMtl(materials: THREE.Material[], materialToTextures: Map<THREE.Material, MtlTextureBindings>): string;
@@ -0,0 +1,15 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ export type TextureUsage = "map" | "normalMap" | "alphaMap" | "emissiveMap" | "roughnessMap" | "metalnessMap";
3
+ export type CollectedTexture = {
4
+ usage: TextureUsage;
5
+ texture: THREE.Texture;
6
+ };
7
+ export type ExportedTextureFile = {
8
+ key: string;
9
+ usage: TextureUsage;
10
+ filename: string;
11
+ blob: Blob;
12
+ };
13
+ export declare function collectTexturesFromObject(root: THREE.Object3D): CollectedTexture[];
14
+ export declare function textureToBlob(texture: THREE.Texture, preferMime?: string): Promise<Blob | null>;
15
+ export declare function exportTextureFiles(textures: CollectedTexture[], baseDir?: string): Promise<ExportedTextureFile[]>;
@@ -0,0 +1,66 @@
1
+ import { BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ export interface GCodeLayerBarPluginConfig extends Partial<PluginConfig> {
3
+ /**
4
+ * UI element id to contain the plugin. When omitted, the viewer widget container is used.
5
+ */
6
+ containerId?: string;
7
+ }
8
+ /**
9
+ * Vertical layer range bar for {@link GCodeViewer}.
10
+ */
11
+ export declare class GCodeLayerBarPlugin extends Plugin {
12
+ static readonly DEFAULT_ID = "GCodeLayerBarPlugin";
13
+ private readonly cfg;
14
+ private readonly gcodeViewer?;
15
+ private root?;
16
+ private maxLabel?;
17
+ private minLabel?;
18
+ private slider?;
19
+ private fill?;
20
+ private startThumb?;
21
+ private endThumb?;
22
+ private startHintLayer?;
23
+ private startHintHeight?;
24
+ private endHintLayer?;
25
+ private endHintHeight?;
26
+ private modeButton?;
27
+ private estRoot?;
28
+ private estBubble?;
29
+ private minLayer;
30
+ private maxLayer;
31
+ private startLayer;
32
+ private endLayer;
33
+ private singleLayerMode;
34
+ private previousStartLayer;
35
+ private dragThumb?;
36
+ constructor(viewer: BaseViewer, cfg?: GCodeLayerBarPluginConfig);
37
+ private init;
38
+ private hostContainer;
39
+ private buildDom;
40
+ private createBound;
41
+ private createThumb;
42
+ private createHint;
43
+ private onModelsChanged;
44
+ private onLanguageChange;
45
+ private onLayerRangeChanged;
46
+ private refreshFromViewer;
47
+ private setVisible;
48
+ private applyLocalizedTitles;
49
+ private onToggleMode;
50
+ private onWheel;
51
+ private onSliderPointerDown;
52
+ private onSliderPointerMove;
53
+ private onSliderPointerUp;
54
+ private onSliderHoverMove;
55
+ private onSliderHoverLeave;
56
+ private updateEstimatedHover;
57
+ private hideEstimatedHover;
58
+ private nearestThumb;
59
+ private valueFromPointer;
60
+ private applyPointerValue;
61
+ private setRange;
62
+ private fillHint;
63
+ private percent;
64
+ private render;
65
+ destroy(): void;
66
+ }
@@ -0,0 +1,13 @@
1
+ import { i18n } from "@gcode-viewer/core";
2
+ export declare const en: {
3
+ singleLayer: string;
4
+ multiLayer: string;
5
+ };
6
+ export declare const zh: {
7
+ singleLayer: string;
8
+ multiLayer: string;
9
+ };
10
+ export declare const GCODE_LAYER_BAR_I18N_NAMESPACE: "gcodeLayerBar";
11
+ export { i18n };
12
+ export type GCodeLayerBarTranslationKey = keyof typeof en;
13
+ export declare function t(key: GCodeLayerBarTranslationKey | string): string;
@@ -0,0 +1,2 @@
1
+ import "./gcode-layer-bar.scss";
2
+ export * from "./GCodeLayerBarPlugin";