Phase 4 Bugfixes: viewportSupplier, registry-State, currentTool-Checks
- ToolContext: viewportSupplier liefert worldViewport statt centerStack (setCenterView(centerStack) wäre self-parent JavaFX-Exception) - switchToWorldEditor: registry.deactivateAll() + currentTool-Checks durch registry.activeToolId() ersetzt (currentTool wurde nie auf "objecteditor"/"modeleditor" gesetzt) - ToolRegistry: deactivateAll() hinzugefügt - ModelEditorController.openModelEditor: Idempotenz-Fix wie activatePlaceMode (bei bereits aktivem Controller activate() direkt aufrufen) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -360,7 +360,7 @@ public class EditorApp extends Application {
|
||||
input, jmeApp, () -> stage,
|
||||
this::setStatus, this::setCenterView,
|
||||
root::setRight, node -> topBar.getChildren().set(1, node),
|
||||
() -> centerStack, ASSET_ROOT, this::switchToWorldEditor, registry
|
||||
() -> worldViewport, ASSET_ROOT, this::switchToWorldEditor, registry
|
||||
);
|
||||
vegController = new de.blight.editor.toolset.vegetation.VegetationController(toolCtx);
|
||||
ezTreeController = new de.blight.editor.toolset.eztree.EzTreeController(toolCtx);
|
||||
@@ -770,9 +770,10 @@ public class EditorApp extends Application {
|
||||
}
|
||||
|
||||
private void switchToWorldEditor() {
|
||||
boolean wasObjEditor = "objecteditor".equals(currentTool);
|
||||
boolean wasModelEditor = "modeleditor".equals(currentTool);
|
||||
boolean wasObjEditor = "objecteditor".equals(registry.activeToolId()) || "objecteditor".equals(currentTool);
|
||||
boolean wasModelEditor = "modeleditor".equals(registry.activeToolId()) || "modeleditor".equals(currentTool);
|
||||
boolean wasThumbnailManager = "thumbnailmanager".equals(currentTool);
|
||||
registry.deactivateAll();
|
||||
currentTool = "world";
|
||||
if (jmeApp != null) jmeApp.setRenderThrottled(false);
|
||||
root.setLeft(null); // ggf. gesetzten Content-Tree entfernen
|
||||
@@ -3508,7 +3509,7 @@ public class EditorApp extends Application {
|
||||
}
|
||||
|
||||
if (cat == modelsNode) {
|
||||
if ("modeleditor".equals(currentTool) && relPath.endsWith(".j3o")) {
|
||||
if ("modeleditor".equals(registry.activeToolId()) && relPath.endsWith(".j3o")) {
|
||||
modelEditorController.openModelEditor(relPath, p);
|
||||
return;
|
||||
}
|
||||
@@ -4870,7 +4871,7 @@ public class EditorApp extends Application {
|
||||
/** Gibt zurück, ob das aktive Tool den aufgeklappten Zustand des Asset-Baums behalten soll. */
|
||||
private boolean shouldPreserveExpansion() {
|
||||
return "vegetation".equals(currentTool) || "eztree".equals(currentTool)
|
||||
|| "objecteditor".equals(currentTool) || "modeleditor".equals(currentTool)
|
||||
|| "objecteditor".equals(registry.activeToolId()) || "modeleditor".equals(registry.activeToolId())
|
||||
|| ("world".equals(currentTool)
|
||||
&& (input.activeLayer == SharedInput.LAYER_OBJECTS
|
||||
|| input.activeLayer == SharedInput.LAYER_OBJECTS_EDIT));
|
||||
|
||||
@@ -36,6 +36,14 @@ public class ToolRegistry {
|
||||
return active != null ? active.toolId() : "";
|
||||
}
|
||||
|
||||
/** Deaktiviert das aktive Werkzeug und setzt den Zustand auf "kein Tool aktiv". */
|
||||
public void deactivateAll() {
|
||||
if (active != null) {
|
||||
active.deactivate();
|
||||
active = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Muss jeden JavaFX-AnimationTimer-Frame aufgerufen werden.
|
||||
* Delegiert an {@link ToolController#onFrame()} des aktiven Werkzeugs.
|
||||
|
||||
@@ -267,7 +267,11 @@ public class ModelEditorController implements ToolController {
|
||||
public void openModelEditor(String relPath, Path absolutePath) {
|
||||
this.pendingRelPath = relPath;
|
||||
this.pendingAbsPath = absolutePath;
|
||||
ctx.registry().activate(this);
|
||||
if (ctx.registry().getActive() == this) {
|
||||
activate();
|
||||
} else {
|
||||
ctx.registry().activate(this);
|
||||
}
|
||||
}
|
||||
|
||||
/** Öffnet den Datei-Dialog für den Modell-Import. */
|
||||
|
||||
Reference in New Issue
Block a user