Display-Modes: 3D-Template + Auto-Assign + Material/Raytracing-Slots
- Neues Template rhino/templates/dossier_3d.ini fuer perspektivische Views - Registry-Loop in oberleiste.py generalisiert (Plan + 3D + Material + Raytracing) — Material/Raytracing skippen wenn kein Template vorhanden, um Cycles-Pipeline-Clone-Crash zu vermeiden - Guid-Replace praezisiert: nur Section-Header-Guid, nie PipelineId - Plan-spezifische ini-Patches auf target_name=="Dossier Plan" gegated - Auto-Assign in startup.py: Parallel-Viewports -> Plan, Perspective -> 3D, einmal-pro-Doc via doc.Strings-Flag (User-Overrides bleiben) - schnitte.activate_schnitt setzt Dossier Plan explizit (Hatches auch in Schnittperspektive sichtbar) - GestaltungApp Section-Block neu strukturiert: PenBlock fuer 3D als 'Fill' innerhalb der Section, Solid-Fill-Toggle entfernt (war Duplikat)
This commit is contained in:
@@ -76,6 +76,71 @@ def _migrate_active_doc(*_):
|
||||
print("[STARTUP] Migration:", ex)
|
||||
|
||||
|
||||
_DOC_FLAG_VIEW_MODES = "dossier_view_modes_initialized"
|
||||
|
||||
|
||||
def _assign_default_display_modes(doc):
|
||||
"""Setzt einmalig pro Doc die Display-Modes auf die Dossier-Defaults:
|
||||
- Parallel-Projektionen (Top/Front/Right/Schnitt-parallel) -> 'Dossier Plan'
|
||||
- Perspektive (Perspective/Schnittperspektive) -> 'Dossier 3D'
|
||||
Persistiert einen Flag in doc.Strings → laeuft nur EINMAL pro Doc.
|
||||
User-Overrides (manuelles Wechseln) bleiben damit erhalten.
|
||||
"""
|
||||
if doc is None: return
|
||||
try:
|
||||
if doc.Strings.GetValue(_DOC_FLAG_VIEW_MODES) == "1":
|
||||
return # schon initialisiert
|
||||
except Exception: pass
|
||||
|
||||
try:
|
||||
from Rhino.Display import DisplayModeDescription
|
||||
except Exception as ex:
|
||||
print("[STARTUP] view-modes: DMD nicht verfuegbar:", ex); return
|
||||
|
||||
# Mode-Lookup per Name
|
||||
mode_plan = mode_3d = None
|
||||
try:
|
||||
for dm in DisplayModeDescription.GetDisplayModes():
|
||||
try:
|
||||
n = dm.EnglishName
|
||||
if n == "Dossier Plan": mode_plan = dm
|
||||
elif n == "Dossier 3D": mode_3d = dm
|
||||
except Exception: pass
|
||||
except Exception as ex:
|
||||
print("[STARTUP] view-modes: Mode-List:", ex); return
|
||||
|
||||
if mode_plan is None and mode_3d is None:
|
||||
print("[STARTUP] view-modes: keine Dossier-Modes registriert — skip")
|
||||
return
|
||||
|
||||
n_set = 0
|
||||
try:
|
||||
for view in doc.Views:
|
||||
try:
|
||||
vp = view.ActiveViewport
|
||||
if vp is None: continue
|
||||
is_par = bool(vp.IsParallelProjection)
|
||||
target = mode_plan if is_par else mode_3d
|
||||
if target is None: continue
|
||||
try:
|
||||
vp.DisplayMode = target
|
||||
n_set += 1
|
||||
except Exception as ex:
|
||||
print("[STARTUP] view-modes set ({}): {}".format(
|
||||
vp.Name, ex))
|
||||
except Exception: pass
|
||||
try:
|
||||
doc.Views.Redraw()
|
||||
except Exception: pass
|
||||
except Exception as ex:
|
||||
print("[STARTUP] view-modes iterate:", ex)
|
||||
|
||||
try:
|
||||
doc.Strings.SetString(_DOC_FLAG_VIEW_MODES, "1")
|
||||
except Exception: pass
|
||||
print("[STARTUP] view-modes: {} Viewport(s) gesetzt".format(n_set))
|
||||
|
||||
|
||||
def _on_doc_opened(sender, e):
|
||||
"""Greift bei jedem geoeffneten Doc nach Rhino-Start. Migration ist
|
||||
idempotent (Flag in doc.Strings)."""
|
||||
@@ -83,6 +148,7 @@ def _on_doc_opened(sender, e):
|
||||
doc = e.Document if hasattr(e, "Document") else Rhino.RhinoDoc.ActiveDoc
|
||||
import panel_base
|
||||
panel_base.migrate_to_dossier(doc)
|
||||
_assign_default_display_modes(doc)
|
||||
except Exception as ex:
|
||||
print("[STARTUP] _on_doc_opened:", ex)
|
||||
|
||||
@@ -141,6 +207,11 @@ def _load_all(sender, e):
|
||||
text_editor._ensure_double_click_hook()
|
||||
except Exception as ex:
|
||||
print("[STARTUP] text_editor hook:", ex)
|
||||
# Display-Modes auf Default fuer aktives Doc setzen (einmalig)
|
||||
try:
|
||||
_assign_default_display_modes(Rhino.RhinoDoc.ActiveDoc)
|
||||
except Exception as ex:
|
||||
print("[STARTUP] view-modes assign:", ex)
|
||||
# DOSSIERUI Window-Layout — Hinweis fuer manuelles Laden
|
||||
_hint_dossier_ui()
|
||||
# Startup-Timing-Summary 3 Sekunden spaeter (nachdem alle async Idle-
|
||||
|
||||
Reference in New Issue
Block a user