Skip to content

ImageMap→Ultra FULL PR2: slicer hooks (Print/ToolOrdering/MMS/LayerRegion/Fill) - #11

Draft
aceRage wants to merge 3 commits into
mainfrom
cursor/imagemap-full-pr2-hooks-a37f
Draft

ImageMap→Ultra FULL PR2: slicer hooks (Print/ToolOrdering/MMS/LayerRegion/Fill)#11
aceRage wants to merge 3 commits into
mainfrom
cursor/imagemap-full-pr2-hooks-a37f

Conversation

@aceRage

@aceRage aceRage commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Description

ImageMap→Ultra FULL PR2 slicer hooks. Wires TextureMapping into the slicer (Print apply, ToolOrdering zone resolve, MMS nested with paint-depth, LayerRegion side+Contoning, Fill Contoning schedule driver, ExtrusionEntityCollection overrides).

Depends on FULL PR1 libs already on cursor/imagemap-full-pr1-libs-lfs-f6e3 (PR #10, 3cdeb9b). This branch starts from that commit, so a merge to main includes both PR1 + PR2. If PR #10 merges first, this PR rebases cleanly onto main.

Feature-patch extract from OrcaSlicer-ImageMap @92548381056. Does not merge ImageMap main.

Locked product rules

  • C3 (paint-depth + TM same object): best-effort. No crash. Paint-depth clamp still bounds painted claims. TM must not break cut_segmented_layers. Not a marketing “supported” claim.
  • PaintDepth.* and paint_depth_* formulas are untouched.
  • PerimeterGenerator is not rewritten. Ultra has_bounded_paint_depth is preserved. IM modulation lives in LayerRegionTextureMapping + ToolOrdering + Fill tagging.

What landed

Area Hook
Print texture_mapping_manager() + texture_mapping_global_settings(). Print::apply loads texture_mapping_definitions. Preview-only JSON keys do not invalidate G-code. No prime-tower images.
ToolOrdering / LayerTools Zone resolve (resolve_filament_id). Virtual TM IDs → physical components when manager present; no-op when empty. Mixed IDs still resolve after TM. Wipe-tower skip when has_texture_mapping_zone && extruders.size() <= 1.
MMS TM outer-wall max width via texture_mapping_outer_wall_gradient_max_line_width before paint-depth clamp uses the width. num_total_filaments = max(mixed, tm). Clamp code paths unchanged.
LayerRegion Side ModulationLineWidth / PerimeterPath / PerimeterPathV2 extracted to LayerRegionTextureMapping.*. Contoning perimeter branches gated on top_surface_contoning_perimeters_active().
Fill Contoning schedule driver (FillTextureMapping.* + SurfaceFillParams fields + collection tagging). Does not boil ImageMap’s ~13k Contoning geometry dump. Solver remains PR1 TextureMappingContoningSolver. Layer::make_fills is the ImageMap 5-arg form (octrees, lightning, throw_if_canceled, optional cache).
ExtrusionEntityCollection texture_mapping_extruder_override + top-surface flags (default off).

Modulation enums: ModulationLineWidth=0, ModulationPerimeterPath=1, ModulationPerimeterPathV2=2.

MMS nesting (critical)

Ultra paint-depth clamp wins for painted claims. The TM branch only adds outer-wall width / filament-count awareness around that clamp. Dual-gate every MMS change with [paintdepth] tests.

Contoning Fill scope

ImageMap Fill.cpp is ~15k lines with ~1198 Contoning hits. This PR ports the schedule driver (params, stack-plan cache, 5-arg make_fills, EEC tagging). It does not copy ImageMap debug SVG export or the polygonization/raster dump. Full infill patterning of Contoning images remains a later thickening of this driver (still without GCode emission here).

Follow-up compile fix (f28ab966b0)

try_make_texture_mapping_perimeters is a free function extracted from ImageMap’s LayerRegion::make_perimeters. The first extract still used *this / [this] / return; (void). Those are now layer_region / return true. Fill keys TM top surfaces off solid_infill_filament (1-based zone ID), not extruder()+1.

Out of scope (intentionally)

  • MMUPaintedTexturePreview, GLGizmo*, Plater (PR4)
  • GCode emission / bbs_3mf (PR3)
  • Format/GLTF*, tinygltf, prime-tower image assets
  • Changing paint_depth_band_* / PaintDepth helpers
  • Wholesale PerimeterGenerator rewrite

C3 spike

After these hooks, hardening C3 beyond best-effort still looks non-cheap: paint-depth clamp, cut_segmented_layers, and TM outer-wall width share compute_layer_color_stat, but painted-claim geometry is still owned by Ultra paint-depth. A dedicated C3 product mode would need fixtures that paint and attach a TM zone on one object, then assert clamp bounds vs TM width — not just “doesn’t crash”.

See docs/imagemap-full-pr2.md.

Screenshots/Recordings/Graphs

N/A (no GUI in this PR).

Tests

  • Extended tests/libslic3r/test_texture_mapping.cpp with empty-manager no-op, virtual zone resolve, Contoning solver component_for_depth ([texturemapping][pr2]), and LayerTools::resolve_filament_id no-op without a manager.
  • [paintdepth] / clamp tests are untouched. Cloud agent snapshot has no built libslic3r_tests binary; please run:
    cd build && ctest --output-on-failure -R 'paint_depth|texture_mapping'
    
    or ./tests/libslic3r/libslic3r_tests '[paintdepth],[texturemapping]'.
Open in Web Open in Cursor 

cursoragent and others added 3 commits September 4, 2026 11:51
…S LUT.

Extract TextureMapping/Contoning/Offset/Remap/ImportedTexture and ColorSolver
vendors from OrcaSlicer-ImageMap @ 9254838. Track lut_wide.png.c with Git
LFS. Register six texture_mapping_* keys only; leave paint_depth_* untouched.

Co-authored-by: aceRage <aceRage@users.noreply.github.com>
Print apply loads texture_mapping_definitions, ToolOrdering resolves
virtual zone IDs, and MMS nests TM outer-wall width around the Ultra
paint-depth clamp. LayerRegion side modulation and Contoning gates live
in LayerRegionTextureMapping; Fill gets a Contoning schedule driver
rather than ImageMap's full geometry dump.

Co-authored-by: aceRage <aceRage@users.noreply.github.com>
try_make_texture_mapping_perimeters is a free function, so *this leftovers from the ImageMap member extract would not compile. Fill now keys top-surface TM off solid_infill_filament, make_fills matches ImageMap's 5-arg cancel+cache form, and Contoning tests seed filament colours.

Co-authored-by: aceRage <aceRage@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants