Material/Ebene-Separation: Hatch raus aus Material (Refactor a)

Material ist jetzt rein 3D — Section-Hatch (2D-Schnitt) wird nicht mehr
am Material definiert, sondern am Layer (via Rhino-Layer-Dialog oder
spaeter via Ebenen-Settings + neuer Hatch-Tab im Project-Settings).

Schema-Aenderungen:
- _normalize_material: hatch + scale entfernt
- _MATERIAL_LIBRARY (elemente.py): hatch + scale aus allen Builtin-Mats
- _get_all_materials: ohne hatch
- _send_state materials payload: nur {name, color}
- Library import_material: PBR + Texturen werden weitergegeben

Backend:
- _ensure_material_sublayer: erstellt Sublayer mit Color, RESETTET aber
  alten SectionHatchIndex auf -1 (= "kein eigener Hatch") damit
  Inheritance/User-Override greift. Vorher wurden alte Material-Hatch-
  Werte da haengen geblieben.

Frontend:
- MaterialDetail: Schraffur-Section entfernt
- hatchPatterns-Prop entfernt

Konsequenz: existierende Waende verlieren ihren Section-Hatch beim
naechsten Regen. User definiert Section-Hatches jetzt auf Layer-Ebene.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 02:10:04 +02:00
parent ad56d9e930
commit 8d3b3af882
4 changed files with 43 additions and 61 deletions
+6 -10
View File
@@ -141,11 +141,13 @@ _PROJECT_SETTINGS_DEFAULTS = {
def _normalize_material(m):
"""Garantiert Material-Schema. Felder:
"""Garantiert Material-Schema. Material ist REIN 3D — Section-Hatch
(2D-Schnitt) wird via Ebenen-Settings am Layer konfiguriert.
Felder:
- Identitaet: name, source ('local'|'library'|'builtin'), libraryId
- Section-Hatch (2D): color, hatch, scale
- PBR (3D-Render): roughness (0..1), reflection (0..1),
transparency (0..1), iorN (1.0..2.5)
- 3D-Farbe: color
- PBR (3D-Render): roughness, reflection, transparency (0..1),
iorN (1.0..2.5)
- UV: uvScaleM (= 1 Welt-Meter ≙ wieviel der Textur)
- Texturen: textures = { diffuse, bump, roughness, transparency }
pro Slot {path: absolute string} oder null. Strength fuer Bump."""
@@ -158,7 +160,6 @@ def _normalize_material(m):
p = t.get("path")
if not p: return None
out = {"path": str(p)}
# Bump hat zusaetzlich strength (-1..1, default 0.5)
if slot == "bump":
try: out["strength"] = float(t.get("strength", 0.5))
except Exception: out["strength"] = 0.5
@@ -166,18 +167,13 @@ def _normalize_material(m):
return {
"name": m.get("name") or "Unbenannt",
"color": m.get("color") or "#888888",
"hatch": m.get("hatch") or "Solid",
"scale": float(m.get("scale", 1.0) or 1.0),
"source": m.get("source") or "local",
"libraryId": m.get("libraryId"),
# PBR (3D-Render) — alle 0..1 ausser iorN
"roughness": _clamp01(m.get("roughness", 0.7)),
"reflection": _clamp01(m.get("reflection", 0.1)),
"transparency": _clamp01(m.get("transparency", 0.0)),
"iorN": _clamp(m.get("iorN", 1.0), 1.0, 2.5),
# UV-Skalierung (1 m = uvScaleM Textur-Tiles)
"uvScaleM": float(m.get("uvScaleM", 1.0) or 1.0),
# Texturen
"textures": {
"diffuse": _tex("diffuse"),
"bump": _tex("bump"),