Initial commit — Dossier Rhino 8 Plugin
OpenStudio-Suite Architektur-Plugin fuer Rhino 8 (Mac): - Smart-Elemente: Wand, Decke, Dach (Pult/Sattel/Walm/Mansarde), Oeffnungen (Fenster/Tueren mit Rahmen + Sims + Glas + Fluegel), Treppen (gerade · L · Wendel mit Schrittmass-Validierung) - Live-Previews mit Step-Lines + Soll-Range-Clamping - Bidirektionale Selection-Sync zwischen Source-Linie und Volume - Geschoss-/Ebenen-Verwaltung mit OKFF-Persistenz - Layouts mit PDF-Export - Ausschnitte / Massstab / Override-Regeln - Petrol-Gruen Theme (Rapport-konform) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
dist/
|
||||
.DS_Store
|
||||
@@ -0,0 +1,90 @@
|
||||
# Dossier Launcher
|
||||
|
||||
Standalone macOS-App, die als Projekt-Hub für Dossier-Projekte in Rhino 8 dient.
|
||||
Wählt eine `.3dm` aus, konfiguriert pro Projekt welche Module aktiv sind, startet
|
||||
Rhino mit der Datei. Das Python-Plugin in `rhino/` liest beim Start die
|
||||
`dossier.project.json` (neben der `.3dm`) und lädt nur die aktivierten Module.
|
||||
|
||||
## Setup (einmalig)
|
||||
|
||||
### 1. Dependencies installieren
|
||||
|
||||
```bash
|
||||
cd launcher
|
||||
npm install
|
||||
```
|
||||
|
||||
Beim ersten `npm run tauri dev` zieht Cargo zusätzlich die Rust-Dependencies
|
||||
(dauert ein paar Minuten).
|
||||
|
||||
### 2. Rhino Auto-Run einrichten
|
||||
|
||||
Damit die Module bei jedem Rhino-Start automatisch laden:
|
||||
|
||||
1. Rhino 8 starten
|
||||
2. `Rhinoceros 8` → `Preferences` → `General` → **Startup commands**
|
||||
3. Folgende Zeile eintragen:
|
||||
```
|
||||
_-RunPythonScript "/Users/karim/STUDIO/rhino-panel/rhino/startup.py"
|
||||
```
|
||||
4. OK → Rhino neu starten
|
||||
|
||||
Ab jetzt lädt `startup.py` bei jedem Rhino-Start:
|
||||
- mit `dossier.project.json` neben der `.3dm` → nur konfigurierte Module
|
||||
- ohne Config → alle Module (Backwards-Compat zum bisherigen Verhalten)
|
||||
|
||||
## Entwicklung
|
||||
|
||||
```bash
|
||||
npm run tauri dev
|
||||
```
|
||||
|
||||
Startet Vite (Port 5174) und öffnet die Tauri-Window. Hot-Reload für React,
|
||||
Rust-Änderungen brauchen einen Rebuild.
|
||||
|
||||
## Build (.app + .dmg)
|
||||
|
||||
```bash
|
||||
npm run tauri build
|
||||
```
|
||||
|
||||
Output: `src-tauri/target/release/bundle/macos/Dossier.app` und
|
||||
`src-tauri/target/release/bundle/dmg/Dossier_0.1.0_*.dmg`
|
||||
|
||||
**Vor dem ersten Build**: Icons hinterlegen. Aktuell ist `bundle.icon` in
|
||||
`src-tauri/tauri.conf.json` leer. Mit
|
||||
```bash
|
||||
npm run tauri icon path/zur/icon.png
|
||||
```
|
||||
generiert Tauri das vollständige Icon-Set (1024×1024 PNG als Quelle reicht).
|
||||
|
||||
## Architektur
|
||||
|
||||
```
|
||||
launcher/
|
||||
├── modules.json # Modul-Manifest (statisch, in Binary einkompiliert)
|
||||
├── src/ # React-Frontend
|
||||
│ ├── App.jsx # Project Hub + Modul-Dialog
|
||||
│ └── styles.css
|
||||
└── src-tauri/ # Rust-Backend
|
||||
├── src/lib.rs # Tauri-Commands
|
||||
└── tauri.conf.json
|
||||
```
|
||||
|
||||
**Datenfluss:**
|
||||
1. Launcher liest `~/Library/Application Support/Dossier/recent.json`
|
||||
2. User klickt „Öffnen" → Launcher schreibt `dossier.project.json` neben die
|
||||
`.3dm` und ruft `open -a "Rhinoceros 8" file.3dm`
|
||||
3. Rhino startet, `startup.py` läuft, liest die Config, lädt nur die aktivierten
|
||||
Module
|
||||
4. Jedes Modul registriert sein eigenes Panel via `panel_base.register_and_open`
|
||||
|
||||
## Module-Manifest erweitern
|
||||
|
||||
Wenn ein neues Modul dazukommt, **drei Stellen** synchron halten:
|
||||
|
||||
1. `launcher/modules.json` — Eintrag mit `id`, `name`, `description`, `pythonModule`, `dependsOn`
|
||||
2. `rhino/startup.py` — `_MODULE_TO_PY` Map ergänzen
|
||||
3. `rhino/<pythonModule>.py` — die Python-Implementierung
|
||||
|
||||
Launcher rebuilden (`npm run tauri build`), neue `.app` ersetzt die alte.
|
||||
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Dossier</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,65 @@
|
||||
[
|
||||
{
|
||||
"id": "ebenen",
|
||||
"name": "Ebenen-Manager",
|
||||
"description": "Zeichnungsebenen (Geschosse, Schnitte, Ansichten) verwalten.",
|
||||
"pythonModule": "rhinopanel",
|
||||
"dependsOn": []
|
||||
},
|
||||
{
|
||||
"id": "oberleiste",
|
||||
"name": "Oberleiste",
|
||||
"description": "Massstab, Display-Mode, Snaps, Overrides — die Top-Toolbar.",
|
||||
"pythonModule": "oberleiste",
|
||||
"dependsOn": []
|
||||
},
|
||||
{
|
||||
"id": "ausschnitte",
|
||||
"name": "Ausschnitte",
|
||||
"description": "Viewport-Ausschnitte mit Kamera, Massstab und Layer-Sichtbarkeit speichern.",
|
||||
"pythonModule": "ausschnitte",
|
||||
"dependsOn": ["oberleiste"]
|
||||
},
|
||||
{
|
||||
"id": "gestaltung",
|
||||
"name": "Gestaltung",
|
||||
"description": "Wand-Typen, Materialien, Texturen.",
|
||||
"pythonModule": "gestaltung",
|
||||
"dependsOn": ["ebenen"]
|
||||
},
|
||||
{
|
||||
"id": "werkzeuge",
|
||||
"name": "Werkzeuge",
|
||||
"description": "Hilfs-Werkzeuge fuer wiederkehrende Aufgaben.",
|
||||
"pythonModule": "werkzeuge",
|
||||
"dependsOn": []
|
||||
},
|
||||
{
|
||||
"id": "overrides",
|
||||
"name": "Overrides",
|
||||
"description": "Layer-Style Overrides (Linientypen, Farben, Druck-Gewichte).",
|
||||
"pythonModule": "overrides_panel",
|
||||
"dependsOn": ["oberleiste"]
|
||||
},
|
||||
{
|
||||
"id": "dimensionen",
|
||||
"name": "Dimensionen",
|
||||
"description": "Object Info Palette: Position, Abmessungen, Drehung der Selektion bearbeiten (wie in Vectorworks).",
|
||||
"pythonModule": "dimensionen",
|
||||
"dependsOn": []
|
||||
},
|
||||
{
|
||||
"id": "layouts",
|
||||
"name": "Layouts",
|
||||
"description": "Layouts erstellen und Details mit Ausschnitten bestuecken.",
|
||||
"pythonModule": "layouts",
|
||||
"dependsOn": ["ausschnitte"]
|
||||
},
|
||||
{
|
||||
"id": "elemente",
|
||||
"name": "Elemente",
|
||||
"description": "Smart-Elemente: Waende als Achse (editierbar) + Volumen (auto-generiert), verknuepft mit Geschossen.",
|
||||
"pythonModule": "elemente",
|
||||
"dependsOn": ["ebenen"]
|
||||
}
|
||||
]
|
||||
Generated
+1706
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "dossier-launcher",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.0.0",
|
||||
"@tauri-apps/plugin-dialog": "^2.0.0",
|
||||
"react": "^19.2.6",
|
||||
"react-dom": "^19.2.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^2.0.0",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"esbuild": "^0.28.0",
|
||||
"vite": "^8.0.12"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
/target
|
||||
/gen
|
||||
Generated
+4829
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
[package]
|
||||
name = "dossier-launcher"
|
||||
version = "0.1.0"
|
||||
description = "Dossier — Projekt-Launcher fuer Rhino"
|
||||
authors = ["Karim Gabriele Varano"]
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "dossier_launcher_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri-plugin-dialog = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
directories = "5"
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
codegen-units = 1
|
||||
lto = true
|
||||
opt-level = "s"
|
||||
strip = true
|
||||
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability fuer das Hauptfenster",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"dialog:default"
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,174 @@
|
||||
// Verhindert ein extra Konsolen-Fenster auf Windows im Release-Build.
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
||||
// Statisches Modul-Manifest — in die Binary einkompiliert, sodass die App
|
||||
// keine externe Datei zur Laufzeit braucht. Wer Module aendert: modules.json
|
||||
// im launcher-Root bearbeiten, dann neu bauen.
|
||||
const MODULES_JSON: &str = include_str!("../../modules.json");
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
struct Project {
|
||||
name: String,
|
||||
path: String,
|
||||
modules: Vec<String>,
|
||||
#[serde(rename = "lastOpened")]
|
||||
last_opened: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
struct ProjectConfig {
|
||||
name: String,
|
||||
modules: Vec<String>,
|
||||
#[serde(rename = "dossierVersion")]
|
||||
dossier_version: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
struct Settings {
|
||||
// App-Name oder absoluter Pfad zur Rhino-App. `open -a` akzeptiert beides:
|
||||
// "Rhinoceros 8" -> sucht in /Applications
|
||||
// "/Applications/Rhino 8.app" oder ein Beta-Build irgendwo anders.
|
||||
#[serde(rename = "rhinoApp")]
|
||||
rhino_app: String,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
rhino_app: "Rhinoceros 8".into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn dossier_dir() -> PathBuf {
|
||||
// ~/Library/Application Support/Dossier auf macOS,
|
||||
// entsprechend Plattform-Pendants sonst.
|
||||
let dir = directories::ProjectDirs::from("ch", "gabrielevarano", "Dossier")
|
||||
.map(|p| p.data_dir().to_path_buf())
|
||||
.unwrap_or_else(|| PathBuf::from("."));
|
||||
fs::create_dir_all(&dir).ok();
|
||||
dir
|
||||
}
|
||||
|
||||
fn recent_path() -> PathBuf {
|
||||
dossier_dir().join("recent.json")
|
||||
}
|
||||
|
||||
fn settings_path() -> PathBuf {
|
||||
dossier_dir().join("settings.json")
|
||||
}
|
||||
|
||||
fn load_settings() -> Settings {
|
||||
let p = settings_path();
|
||||
if !p.exists() {
|
||||
return Settings::default();
|
||||
}
|
||||
fs::read_to_string(&p)
|
||||
.ok()
|
||||
.and_then(|raw| serde_json::from_str(&raw).ok())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn list_recent() -> Vec<Project> {
|
||||
let p = recent_path();
|
||||
if !p.exists() {
|
||||
return vec![];
|
||||
}
|
||||
let raw = fs::read_to_string(&p).unwrap_or_default();
|
||||
serde_json::from_str(&raw).unwrap_or_default()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn save_recent(projects: Vec<Project>) -> Result<(), String> {
|
||||
let p = recent_path();
|
||||
let raw = serde_json::to_string_pretty(&projects).map_err(|e| e.to_string())?;
|
||||
fs::write(&p, raw).map_err(|e| format!("recent.json schreiben: {e}"))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn write_project_config(
|
||||
path3dm: String,
|
||||
name: String,
|
||||
modules: Vec<String>,
|
||||
) -> Result<(), String> {
|
||||
let p = Path::new(&path3dm);
|
||||
let dir = p
|
||||
.parent()
|
||||
.ok_or_else(|| format!("Kein gueltiger Ordner aus Pfad: {path3dm}"))?;
|
||||
let config_path = dir.join("dossier.project.json");
|
||||
let config = ProjectConfig {
|
||||
name,
|
||||
modules,
|
||||
dossier_version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
};
|
||||
let raw = serde_json::to_string_pretty(&config).map_err(|e| e.to_string())?;
|
||||
fs::write(&config_path, raw).map_err(|e| format!("project-config schreiben: {e}"))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn read_project_config(path3dm: String) -> Result<Option<ProjectConfig>, String> {
|
||||
let p = Path::new(&path3dm);
|
||||
let dir = p.parent().ok_or_else(|| "Pfad ungueltig".to_string())?;
|
||||
let config_path = dir.join("dossier.project.json");
|
||||
if !config_path.exists() {
|
||||
return Ok(None);
|
||||
}
|
||||
let raw = fs::read_to_string(&config_path).map_err(|e| e.to_string())?;
|
||||
let cfg: ProjectConfig = serde_json::from_str(&raw).map_err(|e| e.to_string())?;
|
||||
Ok(Some(cfg))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn open_rhino(path3dm: String) -> Result<(), String> {
|
||||
// macOS: `open -a <app> <file>`. `<app>` kann ein App-Name (in /Applications
|
||||
// gesucht) oder ein absoluter Pfad zur .app sein. Aus den Settings — Default
|
||||
// "Rhinoceros 8", falls der User nichts angepasst hat.
|
||||
let settings = load_settings();
|
||||
Command::new("open")
|
||||
.args(["-a", &settings.rhino_app, &path3dm])
|
||||
.spawn()
|
||||
.map_err(|e| format!(
|
||||
"open-Befehl fehlgeschlagen ({}): {e}", settings.rhino_app
|
||||
))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn read_settings() -> Settings {
|
||||
load_settings()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn save_settings(settings: Settings) -> Result<(), String> {
|
||||
let raw = serde_json::to_string_pretty(&settings).map_err(|e| e.to_string())?;
|
||||
fs::write(settings_path(), raw).map_err(|e| format!("settings.json schreiben: {e}"))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn read_modules_manifest() -> Result<serde_json::Value, String> {
|
||||
serde_json::from_str(MODULES_JSON).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
list_recent,
|
||||
save_recent,
|
||||
write_project_config,
|
||||
read_project_config,
|
||||
open_rhino,
|
||||
read_modules_manifest,
|
||||
read_settings,
|
||||
save_settings
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("Fehler beim Starten der Tauri-App");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// Tauri 2 Konvention: main.rs ist nur Einstieg, Logik in lib.rs (fuer Mobile-
|
||||
// Unterstuetzung und damit `tauri::generate_context!` korrekt aufgeloest wird).
|
||||
fn main() {
|
||||
dossier_launcher_lib::run()
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Dossier",
|
||||
"version": "0.1.0",
|
||||
"identifier": "ch.gabrielevarano.dossier",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
"beforeBuildCommand": "(cd .. && npm run build) && npm run build",
|
||||
"devUrl": "http://127.0.0.1:5183",
|
||||
"frontendDist": "../dist"
|
||||
},
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"label": "main",
|
||||
"title": "Dossier",
|
||||
"width": 920,
|
||||
"height": 640,
|
||||
"minWidth": 720,
|
||||
"minHeight": 480,
|
||||
"resizable": true,
|
||||
"fullscreen": false
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": ["app", "dmg"],
|
||||
"icon": ["icons/icon.png"],
|
||||
"copyright": "© 2026 Karim Gabriele Varano",
|
||||
"category": "DeveloperTool",
|
||||
"shortDescription": "Dossier Launcher",
|
||||
"longDescription": "Projekt-Launcher fuer das Dossier-Plugin in Rhino 8.",
|
||||
"resources": {
|
||||
"../../dist": "dist",
|
||||
"../../rhino": "rhino"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,325 @@
|
||||
import React, { useEffect, useState, useMemo } from 'react'
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import { open as openDialog, save as saveDialog } from '@tauri-apps/plugin-dialog'
|
||||
|
||||
// Transitive Dependency-Aufloesung: gibt Set aller Module zurueck, die
|
||||
// aktiviert sein muessen, wenn `selected` aktiviert sind.
|
||||
function resolveDeps(selected, allModules) {
|
||||
const byId = Object.fromEntries(allModules.map(m => [m.id, m]))
|
||||
const out = new Set(selected)
|
||||
let changed = true
|
||||
while (changed) {
|
||||
changed = false
|
||||
for (const id of [...out]) {
|
||||
const m = byId[id]
|
||||
if (!m) continue
|
||||
for (const dep of (m.dependsOn || [])) {
|
||||
if (!out.has(dep)) { out.add(dep); changed = true }
|
||||
}
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// Modul-IDs, die aktuell aktiv sind WEIL eine andere Auswahl sie braucht.
|
||||
function lockedBy(selected, allModules) {
|
||||
const byId = Object.fromEntries(allModules.map(m => [m.id, m]))
|
||||
const locked = new Set()
|
||||
for (const id of selected) {
|
||||
const m = byId[id]
|
||||
if (!m) continue
|
||||
for (const dep of (m.dependsOn || [])) {
|
||||
if (selected.has(dep) || selected.has(id)) locked.add(dep)
|
||||
}
|
||||
}
|
||||
return locked
|
||||
}
|
||||
|
||||
function formatRelative(iso) {
|
||||
if (!iso) return ''
|
||||
try {
|
||||
const d = new Date(iso)
|
||||
const now = new Date()
|
||||
const diff = (now - d) / 1000
|
||||
if (diff < 60) return 'vor wenigen Sek.'
|
||||
if (diff < 3600) return `vor ${Math.floor(diff/60)} Min.`
|
||||
if (diff < 86400) return `vor ${Math.floor(diff/3600)} h`
|
||||
if (diff < 86400 * 7) return `vor ${Math.floor(diff/86400)} Tagen`
|
||||
return d.toLocaleDateString('de-CH')
|
||||
} catch { return '' }
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const [recent, setRecent] = useState([])
|
||||
const [modules, setModules] = useState([])
|
||||
const [dialog, setDialog] = useState(null) // null | { mode: 'new'|'edit', project? }
|
||||
const [settingsOpen, setSettingsOpen] = useState(false)
|
||||
const [busy, setBusy] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
invoke('list_recent').then(setRecent).catch(console.error)
|
||||
invoke('read_modules_manifest').then(setModules).catch(console.error)
|
||||
}, [])
|
||||
|
||||
const refresh = () => invoke('list_recent').then(setRecent).catch(console.error)
|
||||
|
||||
const openProject = async (proj) => {
|
||||
if (busy) return
|
||||
setBusy(true)
|
||||
try {
|
||||
await invoke('open_rhino', { path3dm: proj.path })
|
||||
const next = recent.map(p =>
|
||||
p.path === proj.path ? { ...p, lastOpened: new Date().toISOString() } : p
|
||||
)
|
||||
await invoke('save_recent', { projects: next })
|
||||
setRecent(next)
|
||||
} catch (ex) {
|
||||
alert(`Rhino-Start fehlgeschlagen: ${ex}`)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
const editProject = (proj) => {
|
||||
setDialog({ mode: 'edit', project: proj })
|
||||
}
|
||||
|
||||
const saveProject = async ({ name, path, modules: mods }) => {
|
||||
if (!path) { alert('Bitte eine .3dm-Datei auswaehlen.'); return }
|
||||
if (!name.trim()) { alert('Bitte einen Projekt-Namen angeben.'); return }
|
||||
try {
|
||||
await invoke('write_project_config', { path3dm: path, name: name.trim(), modules: mods })
|
||||
const others = recent.filter(p => p.path !== path)
|
||||
const next = [{ name: name.trim(), path, modules: mods,
|
||||
lastOpened: new Date().toISOString() }, ...others]
|
||||
await invoke('save_recent', { projects: next })
|
||||
setRecent(next)
|
||||
setDialog(null)
|
||||
} catch (ex) {
|
||||
alert(`Speichern fehlgeschlagen: ${ex}`)
|
||||
}
|
||||
}
|
||||
|
||||
const removeProject = async (proj) => {
|
||||
const next = recent.filter(p => p.path !== proj.path)
|
||||
await invoke('save_recent', { projects: next })
|
||||
setRecent(next)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="app">
|
||||
<div className="topbar">
|
||||
<span className="brand">DOSSIER</span>
|
||||
<span className="version">0.1.0</span>
|
||||
<div className="spacer" />
|
||||
<button onClick={() => setDialog({ mode: 'new' })}>Neues Projekt</button>
|
||||
<button onClick={() => setSettingsOpen(true)} title="Einstellungen"
|
||||
style={{ padding: '6px 10px' }}>⚙</button>
|
||||
</div>
|
||||
|
||||
<div className="main">
|
||||
<h2 className="section-title">Kuerzlich geoeffnet</h2>
|
||||
{recent.length === 0 ? (
|
||||
<div className="empty">
|
||||
Noch keine Projekte. Klick „Neues Projekt" zum Starten.
|
||||
</div>
|
||||
) : (
|
||||
<div className="project-list">
|
||||
{recent.map(p => (
|
||||
<div key={p.path} className="project-card"
|
||||
onDoubleClick={() => openProject(p)}>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<div className="name">{p.name}</div>
|
||||
<div className="path">{p.path}</div>
|
||||
</div>
|
||||
<div className="meta">
|
||||
{p.modules?.length || 0} Module · {formatRelative(p.lastOpened)}
|
||||
</div>
|
||||
<button onClick={() => editProject(p)}>Bearbeiten</button>
|
||||
<button className="primary" disabled={busy}
|
||||
onClick={() => openProject(p)}>
|
||||
Öffnen
|
||||
</button>
|
||||
<button onClick={() => removeProject(p)} title="Aus Liste entfernen">×</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{dialog && (
|
||||
<ProjectDialog
|
||||
mode={dialog.mode}
|
||||
project={dialog.project}
|
||||
modules={modules}
|
||||
onCancel={() => setDialog(null)}
|
||||
onSave={saveProject}
|
||||
/>
|
||||
)}
|
||||
{settingsOpen && (
|
||||
<SettingsDialog onClose={() => setSettingsOpen(false)} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function SettingsDialog({ onClose }) {
|
||||
const [rhinoApp, setRhinoApp] = useState('')
|
||||
const [loaded, setLoaded] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
invoke('read_settings')
|
||||
.then(s => { setRhinoApp(s.rhinoApp || 'Rhinoceros 8'); setLoaded(true) })
|
||||
.catch(() => { setRhinoApp('Rhinoceros 8'); setLoaded(true) })
|
||||
}, [])
|
||||
|
||||
const pickRhino = async () => {
|
||||
// .app-Bundles sind technisch Ordner, macOS behandelt sie aber im File-Picker
|
||||
// als auswaehlbare Pakete, wenn der Extension-Filter "app" gesetzt ist.
|
||||
// directory:true wuerde stattdessen reinnavigieren — falsch.
|
||||
const sel = await openDialog({
|
||||
title: 'Rhino-App waehlen',
|
||||
filters: [{ name: 'Anwendung', extensions: ['app'] }],
|
||||
defaultPath: '/Applications',
|
||||
})
|
||||
if (typeof sel === 'string') setRhinoApp(sel)
|
||||
}
|
||||
|
||||
const useDefault = () => setRhinoApp('Rhinoceros 8')
|
||||
|
||||
const save = async () => {
|
||||
try {
|
||||
await invoke('save_settings', { settings: { rhinoApp: rhinoApp.trim() || 'Rhinoceros 8' } })
|
||||
onClose()
|
||||
} catch (ex) {
|
||||
alert(`Speichern fehlgeschlagen: ${ex}`)
|
||||
}
|
||||
}
|
||||
|
||||
if (!loaded) return null
|
||||
|
||||
return (
|
||||
<div className="dialog-bg" onClick={(e) => { if (e.target === e.currentTarget) onClose() }}>
|
||||
<div className="dialog" style={{ width: 520 }}>
|
||||
<header>Einstellungen</header>
|
||||
<div className="body">
|
||||
<div className="row">
|
||||
<label>Rhino-Anwendung</label>
|
||||
<div className="file-picker">
|
||||
<input type="text" value={rhinoApp}
|
||||
onChange={e => setRhinoApp(e.target.value)}
|
||||
placeholder="Rhinoceros 8" />
|
||||
<button onClick={pickRhino}>Waehlen…</button>
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: 'var(--text-muted)', lineHeight: 1.5 }}>
|
||||
App-Name (in /Applications gesucht) oder absoluter Pfad zur .app.
|
||||
Beispiele:<br />
|
||||
<code style={{ fontFamily: 'var(--mono)' }}>Rhinoceros 8</code> · <code style={{ fontFamily: 'var(--mono)' }}>/Applications/Rhino 8.app</code> · <code style={{ fontFamily: 'var(--mono)' }}>/Applications/Rhino 8 WIP.app</code>
|
||||
<button onClick={useDefault} style={{ display: 'block', marginTop: 8, fontSize: 11 }}>
|
||||
Standard verwenden
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<button onClick={onClose}>Abbrechen</button>
|
||||
<button className="primary" onClick={save}>Speichern</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function ProjectDialog({ mode, project, modules, onCancel, onSave }) {
|
||||
const [name, setName] = useState(project?.name || '')
|
||||
const [path, setPath] = useState(project?.path || '')
|
||||
const [picked, setPicked] = useState(new Set(project?.modules || ['ebenen', 'oberleiste']))
|
||||
|
||||
const effective = useMemo(() => resolveDeps(picked, modules), [picked, modules])
|
||||
const locked = useMemo(() => {
|
||||
// Module, die aktiv sind, aber NICHT direkt gewaehlt — also nur als Dep
|
||||
const out = new Set()
|
||||
for (const id of effective) {
|
||||
if (!picked.has(id)) out.add(id)
|
||||
}
|
||||
return out
|
||||
}, [picked, effective, modules])
|
||||
|
||||
const toggle = (id) => {
|
||||
if (locked.has(id)) return // nicht direkt abwaehlbar
|
||||
setPicked(prev => {
|
||||
const next = new Set(prev)
|
||||
if (next.has(id)) next.delete(id); else next.add(id)
|
||||
return next
|
||||
})
|
||||
}
|
||||
|
||||
const pickFile = async () => {
|
||||
const sel = mode === 'new'
|
||||
? await openDialog({
|
||||
title: '3dm-Datei auswaehlen',
|
||||
filters: [{ name: 'Rhino', extensions: ['3dm'] }],
|
||||
})
|
||||
: await openDialog({
|
||||
title: '3dm-Datei auswaehlen',
|
||||
filters: [{ name: 'Rhino', extensions: ['3dm'] }],
|
||||
})
|
||||
if (typeof sel === 'string') setPath(sel)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="dialog-bg" onClick={(e) => { if (e.target === e.currentTarget) onCancel() }}>
|
||||
<div className="dialog">
|
||||
<header>{mode === 'new' ? 'Neues Projekt' : 'Projekt bearbeiten'}</header>
|
||||
<div className="body">
|
||||
<div className="row">
|
||||
<label>Projekt-Name</label>
|
||||
<input type="text" value={name} onChange={e => setName(e.target.value)}
|
||||
placeholder="z.B. Wohnhaus Brunner" autoFocus />
|
||||
</div>
|
||||
<div className="row">
|
||||
<label>3dm-Datei</label>
|
||||
<div className="file-picker">
|
||||
<input type="text" value={path} readOnly
|
||||
placeholder="Pfad zur 3dm-Datei" />
|
||||
<button onClick={pickFile}>Waehlen…</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<label>Module ({[...effective].length} aktiv)</label>
|
||||
<div className="module-grid">
|
||||
{modules.map(m => {
|
||||
const isActive = effective.has(m.id)
|
||||
const isLocked = locked.has(m.id)
|
||||
return (
|
||||
<div
|
||||
key={m.id}
|
||||
className={`module-row ${isActive ? 'active' : ''} ${isLocked ? 'locked' : ''}`}
|
||||
onClick={() => toggle(m.id)}
|
||||
title={isLocked ? 'Wird von einem anderen Modul gebraucht' : ''}
|
||||
>
|
||||
<div className="check">{isActive ? (isLocked ? '🔒' : '✓') : ''}</div>
|
||||
<div className="info">
|
||||
<div className="name">{m.name}</div>
|
||||
<div className="desc">{m.description}</div>
|
||||
{(m.dependsOn || []).length > 0 && (
|
||||
<div className="dep">braucht: {m.dependsOn.join(', ')}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<button onClick={onCancel}>Abbrechen</button>
|
||||
<button className="primary"
|
||||
onClick={() => onSave({ name, path, modules: [...effective] })}>
|
||||
Speichern
|
||||
</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import React from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import App from './App.jsx'
|
||||
import './styles.css'
|
||||
|
||||
createRoot(document.getElementById('root')).render(<App />)
|
||||
@@ -0,0 +1,231 @@
|
||||
:root {
|
||||
--bg-base: #1c1c1e;
|
||||
--bg-panel: #2a2a2c;
|
||||
--bg-elev: #34343a;
|
||||
--border: #3a3a3e;
|
||||
--text: #eaeaea;
|
||||
--text-muted: #8a8a8e;
|
||||
--accent: #5a9e5a;
|
||||
--accent-hover: #6cb56c;
|
||||
--danger: #c87050;
|
||||
--font: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
|
||||
--mono: 'DM Mono', 'Menlo', monospace;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
html, body, #root {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
background: var(--bg-base);
|
||||
color: var(--text);
|
||||
font-family: var(--font);
|
||||
font-size: 13px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
button {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
background: var(--bg-elev);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
padding: 6px 12px;
|
||||
cursor: pointer;
|
||||
transition: background 0.1s ease;
|
||||
}
|
||||
button:hover:not(:disabled) { background: #404048; }
|
||||
button:disabled { opacity: 0.4; cursor: not-allowed; }
|
||||
button.primary {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
color: white;
|
||||
}
|
||||
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
|
||||
|
||||
input[type="text"] {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
background: var(--bg-base);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
padding: 6px 10px;
|
||||
outline: none;
|
||||
}
|
||||
input[type="text"]:focus { border-color: var(--accent); }
|
||||
|
||||
.app {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
}
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 14px 20px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: var(--bg-panel);
|
||||
}
|
||||
.topbar .brand {
|
||||
font-family: var(--mono);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.12em;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.topbar .version {
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
color: var(--text-muted);
|
||||
opacity: 0.6;
|
||||
}
|
||||
.topbar .spacer { flex: 1; }
|
||||
|
||||
.main { flex: 1; overflow-y: auto; padding: 20px; }
|
||||
|
||||
.section-title {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-muted);
|
||||
margin: 0 0 12px 0;
|
||||
}
|
||||
|
||||
.project-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.project-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 14px;
|
||||
background: var(--bg-panel);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.1s ease;
|
||||
}
|
||||
.project-card:hover { border-color: #555; }
|
||||
.project-card .name {
|
||||
font-weight: 500;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.project-card .path {
|
||||
font-family: var(--mono);
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.project-card .meta {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.empty {
|
||||
padding: 40px;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.module-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 8px;
|
||||
}
|
||||
.module-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
padding: 10px 12px;
|
||||
background: var(--bg-panel);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.module-row.locked { opacity: 0.7; cursor: default; }
|
||||
.module-row .check {
|
||||
flex-shrink: 0;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 4px;
|
||||
border: 1.5px solid var(--border);
|
||||
background: var(--bg-base);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 11px;
|
||||
color: white;
|
||||
}
|
||||
.module-row.active .check { background: var(--accent); border-color: var(--accent); }
|
||||
.module-row.locked .check { background: #555; border-color: #555; }
|
||||
.module-row .info { flex: 1; min-width: 0; }
|
||||
.module-row .info .name { font-weight: 500; margin-bottom: 2px; }
|
||||
.module-row .info .desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
|
||||
.module-row .info .dep {
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
color: var(--text-muted);
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.dialog-bg {
|
||||
position: fixed; inset: 0;
|
||||
background: rgba(0,0,0,0.6);
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
z-index: 10;
|
||||
}
|
||||
.dialog {
|
||||
width: 600px; max-width: 90vw;
|
||||
max-height: 90vh;
|
||||
background: var(--bg-base);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
.dialog header {
|
||||
padding: 14px 18px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
font-weight: 500;
|
||||
}
|
||||
.dialog .body {
|
||||
padding: 18px;
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
.dialog .row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.dialog .row label {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
letter-spacing: 0.05em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.dialog footer {
|
||||
padding: 12px 18px;
|
||||
border-top: 1px solid var(--border);
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
.file-picker {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
.file-picker input { flex: 1; font-family: var(--mono); font-size: 11px; }
|
||||
@@ -0,0 +1,26 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
// Tauri-spezifisch: kein Browser-Open, fixer Port, ignoriert src-tauri fuer Hot-Reload.
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
clearScreen: false,
|
||||
server: {
|
||||
// Eigener Port (nicht 5173/5174 — die nutzen andere Studio-Projekte wie
|
||||
// Rapport). Host explizit IPv4, weil Tauri's devUrl auf 127.0.0.1
|
||||
// bindet — sonst kann Tauri auf [::1]:<port> eines anderen Vite-Servers
|
||||
// landen, wenn localhost zuerst zu IPv6 resolved.
|
||||
port: 5183,
|
||||
strictPort: true,
|
||||
host: '127.0.0.1',
|
||||
},
|
||||
envPrefix: ['VITE_', 'TAURI_'],
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
target: 'safari14',
|
||||
// Vite 8: 'oxc' ist der eingebaute Rust-Minifier (default). 'esbuild'
|
||||
// wuerde ein separates Paket erfordern — nicht noetig fuer uns.
|
||||
minify: 'oxc',
|
||||
sourcemap: false,
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user