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,
|
input, jmeApp, () -> stage,
|
||||||
this::setStatus, this::setCenterView,
|
this::setStatus, this::setCenterView,
|
||||||
root::setRight, node -> topBar.getChildren().set(1, node),
|
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);
|
vegController = new de.blight.editor.toolset.vegetation.VegetationController(toolCtx);
|
||||||
ezTreeController = new de.blight.editor.toolset.eztree.EzTreeController(toolCtx);
|
ezTreeController = new de.blight.editor.toolset.eztree.EzTreeController(toolCtx);
|
||||||
@@ -770,9 +770,10 @@ public class EditorApp extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void switchToWorldEditor() {
|
private void switchToWorldEditor() {
|
||||||
boolean wasObjEditor = "objecteditor".equals(currentTool);
|
boolean wasObjEditor = "objecteditor".equals(registry.activeToolId()) || "objecteditor".equals(currentTool);
|
||||||
boolean wasModelEditor = "modeleditor".equals(currentTool);
|
boolean wasModelEditor = "modeleditor".equals(registry.activeToolId()) || "modeleditor".equals(currentTool);
|
||||||
boolean wasThumbnailManager = "thumbnailmanager".equals(currentTool);
|
boolean wasThumbnailManager = "thumbnailmanager".equals(currentTool);
|
||||||
|
registry.deactivateAll();
|
||||||
currentTool = "world";
|
currentTool = "world";
|
||||||
if (jmeApp != null) jmeApp.setRenderThrottled(false);
|
if (jmeApp != null) jmeApp.setRenderThrottled(false);
|
||||||
root.setLeft(null); // ggf. gesetzten Content-Tree entfernen
|
root.setLeft(null); // ggf. gesetzten Content-Tree entfernen
|
||||||
@@ -3508,7 +3509,7 @@ public class EditorApp extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cat == modelsNode) {
|
if (cat == modelsNode) {
|
||||||
if ("modeleditor".equals(currentTool) && relPath.endsWith(".j3o")) {
|
if ("modeleditor".equals(registry.activeToolId()) && relPath.endsWith(".j3o")) {
|
||||||
modelEditorController.openModelEditor(relPath, p);
|
modelEditorController.openModelEditor(relPath, p);
|
||||||
return;
|
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. */
|
/** Gibt zurück, ob das aktive Tool den aufgeklappten Zustand des Asset-Baums behalten soll. */
|
||||||
private boolean shouldPreserveExpansion() {
|
private boolean shouldPreserveExpansion() {
|
||||||
return "vegetation".equals(currentTool) || "eztree".equals(currentTool)
|
return "vegetation".equals(currentTool) || "eztree".equals(currentTool)
|
||||||
|| "objecteditor".equals(currentTool) || "modeleditor".equals(currentTool)
|
|| "objecteditor".equals(registry.activeToolId()) || "modeleditor".equals(registry.activeToolId())
|
||||||
|| ("world".equals(currentTool)
|
|| ("world".equals(currentTool)
|
||||||
&& (input.activeLayer == SharedInput.LAYER_OBJECTS
|
&& (input.activeLayer == SharedInput.LAYER_OBJECTS
|
||||||
|| input.activeLayer == SharedInput.LAYER_OBJECTS_EDIT));
|
|| input.activeLayer == SharedInput.LAYER_OBJECTS_EDIT));
|
||||||
|
|||||||
@@ -36,6 +36,14 @@ public class ToolRegistry {
|
|||||||
return active != null ? active.toolId() : "";
|
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.
|
* Muss jeden JavaFX-AnimationTimer-Frame aufgerufen werden.
|
||||||
* Delegiert an {@link ToolController#onFrame()} des aktiven Werkzeugs.
|
* Delegiert an {@link ToolController#onFrame()} des aktiven Werkzeugs.
|
||||||
|
|||||||
@@ -267,8 +267,12 @@ public class ModelEditorController implements ToolController {
|
|||||||
public void openModelEditor(String relPath, Path absolutePath) {
|
public void openModelEditor(String relPath, Path absolutePath) {
|
||||||
this.pendingRelPath = relPath;
|
this.pendingRelPath = relPath;
|
||||||
this.pendingAbsPath = absolutePath;
|
this.pendingAbsPath = absolutePath;
|
||||||
|
if (ctx.registry().getActive() == this) {
|
||||||
|
activate();
|
||||||
|
} else {
|
||||||
ctx.registry().activate(this);
|
ctx.registry().activate(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Öffnet den Datei-Dialog für den Modell-Import. */
|
/** Öffnet den Datei-Dialog für den Modell-Import. */
|
||||||
public void openModelImport(Window owner) {
|
public void openModelImport(Window owner) {
|
||||||
|
|||||||
Reference in New Issue
Block a user