[271][272][215] Exporte und Rendering folgen Umbaufilter und Variantenkombination der Ansicht

Gemeinsame Ansicht export/exportView.ts (Umbaufilter, Etappe, Kombination der aktiven Ebene) als EIN Weg in IFC, OBJ/STL/glTF, STEP,
Blender-Paket und Cycles-Szene (Text der Kern-Abfragen, renovation::view_from_text). Cycles-Szene: Ausgeblendetes fehlt, Umbau-Farben nur
auf Wunsch (renovationColors, cycles_scene_styled); Explosionsaxonometrie bekommt die Umbau-Farben, Pick/Explosion folgten dem Filter schon.
App: Export-Dialog und Rendering-Dialog zeigen die Ansicht und lassen Hauptvarianten/kein Filter wählen; Häkchen Umbau-Farben im Bild.
CLI: --renovation/--phase auch für ifc, obj, stl, glb, gltf, step, render, blend; render --engine cycles --renovation-colors.
Tests: Kern export_view_tests.rs, vitest exportView/exportViewState/render, e2e exportView271; Bilder doc/review-272/07-09.
This commit is contained in:
Claude committed 2026-11-17 15:40:12 +00:00
1 parent 78791a347a
commit 2fb42aac07
32 files changed
+695 -42

No files matched your search

+8
View File
@@ -12,7 +12,9 @@ import {
type Codec,
type CyclesPackage,
type CyclesSceneOptions,
type ExportView,
type RenderCameraSpec,
exportViewFields,
} from "../core";
import type { Project } from "../model/types";
import { pakoCodec } from "../export/zlibCodec";
@@ -108,6 +110,10 @@ export interface CyclesRequest {
exposureEv?: number;
/** Belichtungskorrektur in EV beim Tonwert, auf die automatische Belichtung (0 = keine). */
extraEv?: number;
/** [271][272] Ansicht der Szene (Umbaufilter, Etappe, Variantenkombination); fehlt sie, gilt kein Filter und die Hauptvarianten. */
view?: ExportView;
/** [271] Umbau-Farben im Bild (Vorgabe aus: Materialfarben). */
renovationColors?: boolean;
}
export interface CyclesHooks {
@@ -181,6 +187,8 @@ export async function renderWithCycles(project: Project, req: CyclesRequest, hoo
backfilled: req.backfilled,
context: req.context,
exposureEv: req.exposureEv,
...exportViewFields(req.view),
...(req.renovationColors ? { renovationColors: true } : {}),
});
if (pkg.info.meshes === 0) throw new CyclesRenderError("empty", 0, "");
if (pkg.missingTextures.length > 0) hooks.onMissingTextures?.(pkg.missingTextures.length);
+40
View File
@@ -0,0 +1,40 @@
// [271][272] Ansicht für Export-/Rendering-Dialog: Umbaufilter (mit Anzeigename) und Variantenkombination der aktiven Ebene.
import { beforeEach, describe, expect, it } from "vitest";
import { getState, setState } from "./appStore";
import { activeExportView } from "./exportViewState";
import { buildUmbauSampleProject } from "../model/sampleProjectUmbau";
import { buildVariantenSampleProject } from "../model/sampleProjectVarianten";
import { hasExportView } from "../core";
beforeEach(() => {
setState({ project: buildVariantenSampleProject(), activeLevelId: "eg" });
});
describe("activeExportView", () => {
it("ohne Filter und Wahl: leer, die Dialoge zeigen Hauptvarianten", () => {
const v = activeExportView();
expect(hasExportView(v.view)).toBe(false);
expect(v.labels).toEqual({ renovation: null, combination: null });
});
it("Kombination der aktiven Ebene mit Namen", () => {
const p = buildVariantenSampleProject();
setState({ project: { ...p, drawingLevels: p.drawingLevels.map((l) => (l.id === "eg" ? { ...l, designOptionCombination: "studie-2" } : l)) } });
const v = activeExportView();
expect(v.view.designOptions).toEqual({ dachform: "b", fassade: "b" });
expect(v.labels.combination).toBe("Studie 2 Satteldach/Bandfenster");
// Andere Ebene: eigene Ansicht (hier ohne Wahl).
getState().setActiveLevelId("og");
expect(hasExportView(activeExportView().view)).toBe(false);
});
it("Umbaufilter der aktiven Ebene mit Anzeigename und Etappe", () => {
const p = buildUmbauSampleProject();
const phase = p.renovation?.phases?.[0];
setState({ project: { ...p, drawingLevels: p.drawingLevels.map((l) => (l.id === "eg" ? { ...l, renovationFilter: "endzustand", renovationPhase: phase?.id } : l)) } });
const v = activeExportView();
expect(v.view).toEqual({ renovation: "endzustand", renovationPhase: phase?.id });
expect(v.labels.renovation).toContain("Endzustand");
expect(v.labels.renovation).toContain(phase!.name);
});
});
+19
View File
@@ -0,0 +1,19 @@
// [271][272] Ansicht für Exporte und Rendering aus dem Zustand der App: Umbaufilter, Etappe und Variantenkombination der
// aktiven Ebene (wie das 3D-Fenster sie zeigt), dazu die lesbare Fassung für Dialoge. Die Rechnung selbst: `export/exportView.ts`.
import { exportViewLabels, levelExportView, type ExportView } from "../core";
import { getState } from "./appStore";
import { renovationFilterLabel } from "./renovationHook";
export interface ActiveExportView {
view: ExportView;
labels: { renovation: string | null; combination: string | null };
}
/** Ansicht der aktiven Ebene (`activeLevelId`) des aktuellen Projekts. */
export function activeExportView(): ActiveExportView {
const st = getState();
const view = levelExportView(st.project, st.activeLevelId);
const own = st.project.renovation?.filters ?? [];
return { view, labels: exportViewLabels(st.project, view, (id) => renovationFilterLabel(id, own)) };
}
+10 -8
View File
@@ -26,6 +26,7 @@ import { exportProjectName } from "../export/competitionIdentity";
import { confirmAnonymousExport, setAnonymityProjectFileName } from "./anonymityGate";
import { exportScheduleCsv } from "../export/exportSchedule";
import { exportIfcSpf, type IfcExportOptions } from "../export/exportIfc";
import type { ExportView } from "../export/exportView";
import { loadFileio } from "../engine/fileioWasm";
import { exportProjectStep } from "../export/exportStep";
import { exportGlb, exportMtl, exportObj, exportStl } from "../export/exportMesh";
@@ -749,13 +750,14 @@ export function useProjectFileActions(
// Führt den gewählten Direkt-Export (CSV/IFC/OBJ/STL) mit dem im Dialog
// gewählten Dateinamen aus. Erzeugung aus dem jeweiligen reinen Kern, Download
// über den robusten Helfer.
const runExport = (format: ExportSaveFormat, filename: string, ifcOptions?: IfcExportOptions) => {
const runExport = (format: ExportSaveFormat, filename: string, ifcOptions?: IfcExportOptions, view?: ExportView) => {
// [208] Anonyme Abgabe: Freitext vorher prüfen (Dialog), erst dann schreiben.
void confirmAnonymousExport(getState().project, [filename]).then((ok) => {
if (ok) runExportChecked(format, filename, ifcOptions);
if (ok) runExportChecked(format, filename, ifcOptions, view);
});
};
const runExportChecked = (format: ExportSaveFormat, filename: string, ifcOptions?: IfcExportOptions) => {
// [271][272] `view`: Umbaufilter und Variantenkombination der aktiven Ansicht (3D-Formate); fehlt sie, gelten Hauptvarianten und alles.
const runExportChecked = (format: ExportSaveFormat, filename: string, ifcOptions?: IfcExportOptions, view?: ExportView) => {
const project = getState().project;
switch (format) {
case "csv":
@@ -764,7 +766,7 @@ export function useProjectFileActions(
case "ifc":
// IFC schreibt Rust (Format-Modul pkgFileIo, wird beim ersten Export nachgeladen).
void loadFileio()
.then(() => downloadTextFile(exportIfcSpf(project, ifcOptions), filename))
.then(() => downloadTextFile(exportIfcSpf(project, { ...ifcOptions, view }), filename))
.catch((e) => notify(`${t("ifc.export.failed")}: ${e instanceof Error ? e.message : String(e)}`, "error"));
break;
case "obj":
@@ -773,17 +775,17 @@ export function useProjectFileActions(
// OBJ/STL/glTF schreibt Rust (Format-Modul pkgFileIo, wird beim ersten Export nachgeladen).
void loadFileio()
.then(() => {
if (format === "glb") void saveBinaryFile(exportGlb(project), filename, "model/gltf-binary");
if (format === "glb") void saveBinaryFile(exportGlb(project, { view }), filename, "model/gltf-binary");
// [201] OBJ mit MTL (Farben) als zweite Datei gleichen Namens; STL kennt keine Farben.
else if (format === "obj") void saveTextWithCompanion((mtlName) => ({ main: exportObj(project, {}, mtlName), companion: exportMtl(project) }), filename, "mtl");
else downloadTextFile(exportStl(project), filename);
else if (format === "obj") void saveTextWithCompanion((mtlName) => ({ main: exportObj(project, { view }, mtlName), companion: exportMtl(project, { view }) }), filename, "mtl");
else downloadTextFile(exportStl(project, { view }), filename);
})
.catch((e) => notify(`${t("mesh.export.failed")}: ${e instanceof Error ? e.message : String(e)}`, "error"));
break;
case "step":
// B-Rep via truck-WASM (asynchron): Körper, die truck nicht bauen kann, werden
// übersprungen — der Export bleibt trotzdem erhalten, Hinweis per Meldung.
void exportProjectStep(project, filename.replace(/\.[^.]+$/, ""))
void exportProjectStep(project, filename.replace(/\.[^.]+$/, ""), view)
.then((r) => {
downloadTextFile(r.text, filename);
if (r.skipped.length > 0) {