nodeslicer/doc/MODULES.md
2026-05-06 11:12:13 +03:00

51 lines
2.6 KiB
Markdown

# Module Reference
This file provides a mapping of modules to their primary responsibilities and key symbols.
## Root
- `__init__.py`:
- **Entry Point**: Extension registration (`register`, `unregister`).
- **Node Tree**: `SLICETREE_NodeTree` class.
- **Sockets**: Definitions for all `SLICESOCK_*` classes.
- **Nodes**: Definitions for all `SLICENODE_*` classes.
- **Evaluation Engine**:
- `_resolve_input()`: Recursively evaluates linked sockets.
- `_resolve_output()`: Computes node outputs with a caching system (`_EvalCache`) to avoid redundant calculations.
- `_follow_reroute()`: Handles Blender's Reroute nodes during evaluation.
- **Error Handling**: `NodeException` for user-facing evaluation errors.
- `registry.py`:
- **Auto-Registration**: Utility to track classes decorated with `@register_class`.
- **Resource Management**: Logic for dynamic icon and timer registration.
- `blender_manifest.toml`:
- Metadata for the Blender Extension platform.
- Lists required wheels (Shapely, PyClipper) for different platforms.
- `pyproject.toml`:
- Standard Python project configuration.
- Lists development and runtime dependencies.
## `/core` (Geometry & Slicing)
- `slice.py`:
- `slice_at_range()`: Top-level slicing function that iterates through Z-heights.
- `slice_at_z()`: Vectorized plane-mesh intersection using NumPy.
- `Pather`: Class that converts toolpaths into G-code strings. Handles layer change comments and extrusion calculations.
- `segments_to_slice()`: Utility to convert raw intersection segments into closed loops using Pyclipper and the Even-Odd fill rule.
- `link_segments()`: Logic for joining loose segments into continuous paths.
- `buffer_slice()`: Offset utility using PyclipperOffset. Groups paths by Z-height to ensure independent buffering of layers.
- `geometry.py`:
- `crc32_array()`: High-performance checksum generation for NumPy arrays, used for internal caching and data validation.
## `/infra` (Blender Integration)
- `blender_mesh_capture.py`:
- `SlicingObject`: Represents a single mesh as a NumPy triangle array. Computes bounding boxes and checksums.
- `SlicingCollection` / `SlicingGroup`: Hierarchical wrappers for managing multiple meshes and their metadata (e.g., Wipe Tower location).
- `objects_to_tris()`: Performance-critical function that extracts mesh data from Blender objects into NumPy arrays using `foreach_get`. Handles world-space transformation and unit scaling.
- `blender_bridge.py`:
- **Hierarchy Utilities**: Helpers like `get_all_children()` for traversing Blender's object tree.