feat(ztools): appearance mode system with engineering color presets #20

Open
opened 2026-02-07 16:24:51 +00:00 by forbes · 0 comments
Owner
title, labels, milestone
title labels milestone
feat(ztools): appearance mode system with engineering color presets
feature
ztools
appearance
Appearance System

Summary

Add a configurable appearance mode system to ztools that controls per-part viewport coloring based on the active mode. Initial modes are Realistic (material passthrough) and Engineering (category-based color coding using Catppuccin Mocha palette).

Motivation

FreeCAD's default appearance system ties color to material properties only. Professional engineering workflows benefit from semantic color coding — instantly distinguishing fasteners from structural members, seals from bearings — without affecting the underlying material data.

Scope

  • AppearanceMode base class with apply(doc) and reset(doc) methods
  • RealisticMode — delegates to existing material ShapeAppearance (passthrough, default)
  • EngineeringMode — reads KindredCategory property, maps to palette
  • KindredCategory enum property added to Part::Feature objects
  • View menu toggle: View → Appearance Mode → [Realistic | Engineering]
  • Preference key Kindred/AppearanceMode persisted across sessions
  • Palette loaded from JSON config (theme-overridable)

KindredCategory Enum

Value Label
custom_body Custom Body
fastener Fastener
structural Structural
electrical Electrical
seal_gasket Seal/Gasket
bearing_bushing Bearing/Bushing
spring_compliant Spring/Compliant
moving_part Moving Part

Engineering Palette (Catppuccin Mocha)

Category Color Hex
Custom Body Peach #fab387
Fastener Green #a6e3a1
Structural Blue #89b4fa
Electrical Yellow #f9e2af
Seal/Gasket Mauve #cba6f7
Bearing/Bushing Sapphire #74c7ec
Spring/Compliant Flamingo #f2cdcd
Moving Part Red #f38ba8

Implementation Notes

  • Mode switch stores original ShapeAppearance per-object so RealisticMode can restore cleanly
  • KindredCategory defaults to custom_body for untagged parts
  • Moving Parts gets static Red for now — contextual neighbor-aware coloring is a future enhancement
  • Theme palette is loaded from JSON so custom themes can override colors

File Structure

mods/ztools/
├── appearance/
│   ├── __init__.py
│   ├── mode.py              # AppearanceMode base class
│   ├── realistic.py         # RealisticMode
│   ├── engineering.py       # EngineeringMode
│   ├── palette.py           # Palette loader
│   └── palettes/
│       └── catppuccin_mocha.json

Acceptance Criteria

  • Switching to Engineering mode colors all parts by their KindredCategory
  • Switching to Realistic mode restores original material appearances
  • Untagged parts default to Custom Body (Peach)
  • Mode persists across application restarts
  • Custom palette JSON is loaded and respected
--- title: "feat(ztools): appearance mode system with engineering color presets" labels: ["feature", "ztools", "appearance"] milestone: "Appearance System" --- ## Summary Add a configurable appearance mode system to ztools that controls per-part viewport coloring based on the active mode. Initial modes are **Realistic** (material passthrough) and **Engineering** (category-based color coding using Catppuccin Mocha palette). ## Motivation FreeCAD's default appearance system ties color to material properties only. Professional engineering workflows benefit from semantic color coding — instantly distinguishing fasteners from structural members, seals from bearings — without affecting the underlying material data. ## Scope - [ ] `AppearanceMode` base class with `apply(doc)` and `reset(doc)` methods - [ ] `RealisticMode` — delegates to existing material `ShapeAppearance` (passthrough, default) - [ ] `EngineeringMode` — reads `KindredCategory` property, maps to palette - [ ] `KindredCategory` enum property added to `Part::Feature` objects - [ ] View menu toggle: **View → Appearance Mode → [Realistic | Engineering]** - [ ] Preference key `Kindred/AppearanceMode` persisted across sessions - [ ] Palette loaded from JSON config (theme-overridable) ## KindredCategory Enum | Value | Label | |-------------------|------------------| | `custom_body` | Custom Body | | `fastener` | Fastener | | `structural` | Structural | | `electrical` | Electrical | | `seal_gasket` | Seal/Gasket | | `bearing_bushing` | Bearing/Bushing | | `spring_compliant`| Spring/Compliant | | `moving_part` | Moving Part | ## Engineering Palette (Catppuccin Mocha) | Category | Color | Hex | |------------------|----------|-----------| | Custom Body | Peach | `#fab387` | | Fastener | Green | `#a6e3a1` | | Structural | Blue | `#89b4fa` | | Electrical | Yellow | `#f9e2af` | | Seal/Gasket | Mauve | `#cba6f7` | | Bearing/Bushing | Sapphire | `#74c7ec` | | Spring/Compliant | Flamingo | `#f2cdcd` | | Moving Part | Red | `#f38ba8` | ## Implementation Notes - Mode switch stores original `ShapeAppearance` per-object so `RealisticMode` can restore cleanly - `KindredCategory` defaults to `custom_body` for untagged parts - Moving Parts gets static Red for now — contextual neighbor-aware coloring is a future enhancement - Theme palette is loaded from JSON so custom themes can override colors ## File Structure ``` mods/ztools/ ├── appearance/ │ ├── __init__.py │ ├── mode.py # AppearanceMode base class │ ├── realistic.py # RealisticMode │ ├── engineering.py # EngineeringMode │ ├── palette.py # Palette loader │ └── palettes/ │ └── catppuccin_mocha.json ``` ## Acceptance Criteria - [ ] Switching to Engineering mode colors all parts by their `KindredCategory` - [ ] Switching to Realistic mode restores original material appearances - [ ] Untagged parts default to Custom Body (Peach) - [ ] Mode persists across application restarts - [ ] Custom palette JSON is loaded and respected
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#20