Bugfixes: ObjectController-Toolbar, Emitter ingame, Esc-Shortcut
ObjectController: Welt-Toolbar bleibt beim F7-Öffnen sichtbar (kein eigener Toolbar mehr). Modus wechselt automatisch: Platzieren wenn Modell/Ordner ausgewählt, sonst Bearbeiten. Neuer Button + Esc-Shortcut zum Aufheben der Platzierungs-Auswahl. WorldScene: EmitterSystem eingebunden — platzierte Emitter werden jetzt auch im Spiel geladen und proximity-basiert aktiviert. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5409,6 +5409,9 @@ public class EditorApp extends Application {
|
|||||||
|| input.activeLayer == SharedInput.LAYER_WATERFALL
|
|| input.activeLayer == SharedInput.LAYER_WATERFALL
|
||||||
|| input.activeLayer == SharedInput.LAYER_VOXEL_CLIFF))
|
|| input.activeLayer == SharedInput.LAYER_VOXEL_CLIFF))
|
||||||
input.cancelZoneDrawing = true;
|
input.cancelZoneDrawing = true;
|
||||||
|
else if (pressed && input.activeLayer == SharedInput.LAYER_OBJECTS
|
||||||
|
&& "objecteditor".equals(registry.activeToolId()))
|
||||||
|
Platform.runLater(objectController::cancelPlacement);
|
||||||
}
|
}
|
||||||
case DELETE -> {
|
case DELETE -> {
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import de.blight.editor.ToolContext;
|
|||||||
import de.blight.editor.ToolController;
|
import de.blight.editor.ToolController;
|
||||||
import de.blight.editor.ui.TextureChooser;
|
import de.blight.editor.ui.TextureChooser;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Orientation;
|
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
@@ -40,8 +39,6 @@ public class ObjectController implements ToolController {
|
|||||||
private Button objMergeBtn;
|
private Button objMergeBtn;
|
||||||
private Button objSaveBtn;
|
private Button objSaveBtn;
|
||||||
private Button objDeleteBtn;
|
private Button objDeleteBtn;
|
||||||
private ToggleButton objPlaceBtn;
|
|
||||||
private ToggleButton objEditBtn;
|
|
||||||
private ToggleButton selModeObjectBtn;
|
private ToggleButton selModeObjectBtn;
|
||||||
private ToggleGroup meshToggleGroup;
|
private ToggleGroup meshToggleGroup;
|
||||||
private Label randomTreeStatusLabel;
|
private Label randomTreeStatusLabel;
|
||||||
@@ -61,7 +58,6 @@ public class ObjectController implements ToolController {
|
|||||||
@Override
|
@Override
|
||||||
public void activate() {
|
public void activate() {
|
||||||
ctx.setCenterView().accept(ctx.viewportSupplier().get());
|
ctx.setCenterView().accept(ctx.viewportSupplier().get());
|
||||||
ctx.setMainToolbar().accept(buildObjectEditorToolBar(pendingPlaceMode));
|
|
||||||
if (pendingPlaceMode) {
|
if (pendingPlaceMode) {
|
||||||
ctx.input().activeLayer = SharedInput.LAYER_OBJECTS;
|
ctx.input().activeLayer = SharedInput.LAYER_OBJECTS;
|
||||||
ctx.setRightPanel().accept(buildObjectPlacePanel());
|
ctx.setRightPanel().accept(buildObjectPlacePanel());
|
||||||
@@ -108,7 +104,10 @@ public class ObjectController implements ToolController {
|
|||||||
// ── Öffentliche API ─────────────────────────────────────────────────────
|
// ── Öffentliche API ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
public void activatePlaceMode() {
|
public void activatePlaceMode() {
|
||||||
pendingPlaceMode = true;
|
// Place mode only when something is actually selected; otherwise fall back to edit mode
|
||||||
|
boolean hasSelection = (ctx.input().pendingModelPath != null && !ctx.input().pendingModelPath.isEmpty())
|
||||||
|
|| (ctx.input().treeFolderPath != null && !ctx.input().treeFolderPath.isEmpty());
|
||||||
|
pendingPlaceMode = hasSelection;
|
||||||
if (ctx.registry().getActive() == this) {
|
if (ctx.registry().getActive() == this) {
|
||||||
activate();
|
activate();
|
||||||
} else {
|
} else {
|
||||||
@@ -129,48 +128,26 @@ public class ObjectController implements ToolController {
|
|||||||
if (multiPlaceCB != null) multiPlaceCB.setSelected(true);
|
if (multiPlaceCB != null) multiPlaceCB.setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Zeigt das Platzieren-Panel (ohne Toolbar-Wechsel – für Aufrufe aus dem Welt-Editor). */
|
/** Zeigt das Platzieren-Panel. */
|
||||||
public void showPlacePanel() {
|
public void showPlacePanel() {
|
||||||
|
pendingPlaceMode = true;
|
||||||
ctx.input().activeLayer = SharedInput.LAYER_OBJECTS;
|
ctx.input().activeLayer = SharedInput.LAYER_OBJECTS;
|
||||||
ctx.setRightPanel().accept(buildObjectPlacePanel());
|
ctx.setRightPanel().accept(buildObjectPlacePanel());
|
||||||
if (objPlaceBtn != null) objPlaceBtn.setSelected(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Zeigt das Bearbeiten-Panel (ohne Toolbar-Wechsel). */
|
/** Zeigt das Bearbeiten-Panel. */
|
||||||
public void showEditPanel() {
|
public void showEditPanel() {
|
||||||
|
pendingPlaceMode = false;
|
||||||
ctx.input().activeLayer = SharedInput.LAYER_OBJECTS_EDIT;
|
ctx.input().activeLayer = SharedInput.LAYER_OBJECTS_EDIT;
|
||||||
ctx.input().pendingModelPath = null;
|
ctx.input().pendingModelPath = null;
|
||||||
ctx.setRightPanel().accept(buildObjectEditPanel());
|
ctx.setRightPanel().accept(buildObjectEditPanel());
|
||||||
if (objEditBtn != null) objEditBtn.setSelected(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Toolbar ──────────────────────────────────────────────────────────────
|
/** Hebt die Platzierungs-Auswahl auf und wechselt zum Selektier-Modus. */
|
||||||
|
public void cancelPlacement() {
|
||||||
private ToolBar buildObjectEditorToolBar(boolean placeMode) {
|
ctx.input().pendingModelPath = null;
|
||||||
Button backBtn = new Button("← Welteneditor");
|
ctx.input().treeFolderPath = null;
|
||||||
backBtn.setOnAction(e -> ctx.switchToWorld().run());
|
showEditPanel();
|
||||||
|
|
||||||
objPlaceBtn = new ToggleButton("+ Platzieren");
|
|
||||||
objEditBtn = new ToggleButton("# Bearbeiten");
|
|
||||||
objPlaceBtn.setStyle("-fx-font-weight: bold;");
|
|
||||||
objEditBtn.setStyle("-fx-font-weight: bold;");
|
|
||||||
|
|
||||||
ToggleGroup objGroup = new ToggleGroup();
|
|
||||||
objPlaceBtn.setToggleGroup(objGroup);
|
|
||||||
objEditBtn.setToggleGroup(objGroup);
|
|
||||||
if (placeMode) objPlaceBtn.setSelected(true);
|
|
||||||
else objEditBtn.setSelected(true);
|
|
||||||
|
|
||||||
objPlaceBtn.setOnAction(e -> showPlacePanel());
|
|
||||||
objEditBtn.setOnAction(e -> showEditPanel());
|
|
||||||
|
|
||||||
Label label = new Label("Objekt Editor");
|
|
||||||
label.setStyle("-fx-font-weight: bold; -fx-font-size: 13;");
|
|
||||||
ToolBar tb = new ToolBar();
|
|
||||||
tb.getItems().addAll(backBtn, new Separator(Orientation.VERTICAL),
|
|
||||||
objPlaceBtn, objEditBtn,
|
|
||||||
new Separator(Orientation.VERTICAL), label);
|
|
||||||
return tb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Platzieren-Panel ─────────────────────────────────────────────────────
|
// ── Platzieren-Panel ─────────────────────────────────────────────────────
|
||||||
@@ -179,6 +156,12 @@ public class ObjectController implements ToolController {
|
|||||||
VBox inner = new VBox(8);
|
VBox inner = new VBox(8);
|
||||||
inner.setPadding(new Insets(10));
|
inner.setPadding(new Insets(10));
|
||||||
|
|
||||||
|
Button cancelBtn = new Button("✕ Auswahl aufheben [Esc]");
|
||||||
|
cancelBtn.setMaxWidth(Double.MAX_VALUE);
|
||||||
|
cancelBtn.setStyle("-fx-background-color: #e8e8e8;");
|
||||||
|
cancelBtn.setOnAction(e -> cancelPlacement());
|
||||||
|
inner.getChildren().add(cancelBtn);
|
||||||
|
|
||||||
inner.getChildren().addAll(sectionTitle("Baum aus Ordner"), new Separator());
|
inner.getChildren().addAll(sectionTitle("Baum aus Ordner"), new Separator());
|
||||||
|
|
||||||
treeFolderCB = new ComboBox<>();
|
treeFolderCB = new ComboBox<>();
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ public class WorldScene extends BaseAppState {
|
|||||||
private de.blight.game.state.RiverSoundState riverSound;
|
private de.blight.game.state.RiverSoundState riverSound;
|
||||||
private de.blight.game.state.AmbientSoundSystem ambientSounds;
|
private de.blight.game.state.AmbientSoundSystem ambientSounds;
|
||||||
private de.blight.game.state.MusicSystem musicSystem;
|
private de.blight.game.state.MusicSystem musicSystem;
|
||||||
|
private de.blight.game.state.EmitterSystem emitterSystem;
|
||||||
private de.blight.game.audio.FootstepSystem footstepSystem;
|
private de.blight.game.audio.FootstepSystem footstepSystem;
|
||||||
private de.blight.game.state.DrownState drownState;
|
private de.blight.game.state.DrownState drownState;
|
||||||
private WaterInteractionState waterInteractionState;
|
private WaterInteractionState waterInteractionState;
|
||||||
@@ -277,6 +278,8 @@ public class WorldScene extends BaseAppState {
|
|||||||
BlightGame.status("Lade Welt-Objekte...");
|
BlightGame.status("Lade Welt-Objekte...");
|
||||||
app.getStateManager().attach(new RiverState());
|
app.getStateManager().attach(new RiverState());
|
||||||
app.getStateManager().attach(new de.blight.game.state.WaterfallState());
|
app.getStateManager().attach(new de.blight.game.state.WaterfallState());
|
||||||
|
emitterSystem = new de.blight.game.state.EmitterSystem();
|
||||||
|
app.getStateManager().attach(emitterSystem);
|
||||||
WorldObjectsState worldObjects = new WorldObjectsState();
|
WorldObjectsState worldObjects = new WorldObjectsState();
|
||||||
worldObjects.setLodFactor((float) graphicsSettings.viewDistance.lod0Range);
|
worldObjects.setLodFactor((float) graphicsSettings.viewDistance.lod0Range);
|
||||||
app.getStateManager().attach(worldObjects);
|
app.getStateManager().attach(worldObjects);
|
||||||
@@ -467,6 +470,7 @@ public class WorldScene extends BaseAppState {
|
|||||||
if (riverSound != null) riverSound.setPlayerPosition(pos);
|
if (riverSound != null) riverSound.setPlayerPosition(pos);
|
||||||
if (ambientSounds != null) ambientSounds.setPlayerPosition(pos);
|
if (ambientSounds != null) ambientSounds.setPlayerPosition(pos);
|
||||||
if (musicSystem != null) musicSystem.setPlayerPosition(pos);
|
if (musicSystem != null) musicSystem.setPlayerPosition(pos);
|
||||||
|
if (emitterSystem != null) emitterSystem.setPlayerPosition(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (musicSystem != null && dayNight != null)
|
if (musicSystem != null && dayNight != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user