Fehler beim Selection Tool behoben
This commit is contained in:
@@ -762,6 +762,25 @@ public class EditorApp extends Application {
|
||||
root.setRight(buildZonenPanel());
|
||||
}
|
||||
|
||||
if (input.auswahlLightSelected) {
|
||||
input.auswahlLightSelected = false;
|
||||
if (atmosphaereBtn != null) {
|
||||
atmosphaereBtn.setSelected(true);
|
||||
root.setRight(buildAtmospherePanel());
|
||||
updateLightPanel(input.selectedLightInfo);
|
||||
}
|
||||
}
|
||||
|
||||
if (input.auswahlEmitterSelected) {
|
||||
input.auswahlEmitterSelected = false;
|
||||
if (atmosphaereBtn != null) {
|
||||
atmosphaereBtn.setSelected(true);
|
||||
input.activeLayer = SharedInput.LAYER_EMITTERS;
|
||||
root.setRight(buildAtmospherePanel());
|
||||
updateEmitterPanel(input.selectedEmitterInfo);
|
||||
}
|
||||
}
|
||||
|
||||
if (input.itemSelectionChanged) {
|
||||
input.itemSelectionChanged = false;
|
||||
updateAuswahlItemPanel(input.selectedItemInfo);
|
||||
|
||||
@@ -1124,7 +1124,15 @@ public class SharedInput {
|
||||
/** JavaFX → JME3: Selektierten Item-Spawn löschen. */
|
||||
public volatile boolean deleteSelectedItemRequested = false;
|
||||
/** JME3-intern: Auswahl-Klick für ItemPlacementState (kein Objekt/keine Zone getroffen). */
|
||||
public final ConcurrentLinkedQueue<ObjectClick> auswahlClickQueue = new ConcurrentLinkedQueue<>();
|
||||
public final ConcurrentLinkedQueue<ObjectClick> auswahlClickQueue = new ConcurrentLinkedQueue<>();
|
||||
/** JME3-intern: Auswahl-Klick für LightState (kein Objekt/keine Zone getroffen). */
|
||||
public final ConcurrentLinkedQueue<ObjectClick> auswahlLightClickQueue = new ConcurrentLinkedQueue<>();
|
||||
/** JME3-intern: Auswahl-Klick für EmitterState (kein Objekt/keine Zone getroffen). */
|
||||
public final ConcurrentLinkedQueue<ObjectClick> auswahlEmitterClickQueue = new ConcurrentLinkedQueue<>();
|
||||
/** JME3 → JavaFX: Licht im Auswahl-Modus selektiert → Atmosphäre/Licht-Werkzeug aktivieren. */
|
||||
public volatile boolean auswahlLightSelected = false;
|
||||
/** JME3 → JavaFX: Emitter im Auswahl-Modus selektiert → Atmosphäre/Emitter-Werkzeug aktivieren. */
|
||||
public volatile boolean auswahlEmitterSelected = false;
|
||||
|
||||
// ── Voxel-Textur-Malen ────────────────────────────────────────────────────
|
||||
/** Parallel-Queue zu textureEditQueue – wird von submitEdit(layer=4) mitbefüllt,
|
||||
|
||||
@@ -82,6 +82,11 @@ public class EmitterState extends BaseAppState {
|
||||
|
||||
@Override
|
||||
public void update(float tpf) {
|
||||
SharedInput.ObjectClick auswahlClick;
|
||||
while ((auswahlClick = input.auswahlEmitterClickQueue.poll()) != null) {
|
||||
handleAuswahlClick(auswahlClick);
|
||||
}
|
||||
|
||||
if (input.activeLayer != SharedInput.LAYER_EMITTERS) return;
|
||||
|
||||
SharedInput.EmitterClick click;
|
||||
@@ -135,6 +140,19 @@ public class EmitterState extends BaseAppState {
|
||||
};
|
||||
}
|
||||
|
||||
private void handleAuswahlClick(SharedInput.ObjectClick click) {
|
||||
float jmeX = click.screenX() * (float) input.viewportScaleX;
|
||||
float jmeY = cam.getHeight() - click.screenY() * (float) input.viewportScaleY;
|
||||
Vector3f near = cam.getWorldCoordinates(new Vector2f(jmeX, jmeY), 0f);
|
||||
Vector3f far = cam.getWorldCoordinates(new Vector2f(jmeX, jmeY), 1f);
|
||||
Ray ray = new Ray(near, far.subtract(near).normalizeLocal());
|
||||
int hit = pickMarker(ray);
|
||||
if (hit >= 0) {
|
||||
selectEmitter(hit);
|
||||
input.auswahlEmitterSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
private int pickMarker(Ray ray) {
|
||||
for (int i = 0; i < markers.size(); i++) {
|
||||
CollisionResults res = new CollisionResults();
|
||||
|
||||
@@ -86,6 +86,11 @@ public class LightState extends BaseAppState {
|
||||
|
||||
@Override
|
||||
public void update(float tpf) {
|
||||
SharedInput.ObjectClick auswahlClick;
|
||||
while ((auswahlClick = input.auswahlLightClickQueue.poll()) != null) {
|
||||
handleAuswahlClick(auswahlClick);
|
||||
}
|
||||
|
||||
if (input.activeLayer != SharedInput.LAYER_LIGHTS) return;
|
||||
|
||||
SharedInput.LightClick click;
|
||||
@@ -137,6 +142,19 @@ public class LightState extends BaseAppState {
|
||||
selectLight(lights.size() - 1);
|
||||
}
|
||||
|
||||
private void handleAuswahlClick(SharedInput.ObjectClick click) {
|
||||
float jmeX = click.screenX() * (float) input.viewportScaleX;
|
||||
float jmeY = cam.getHeight() - click.screenY() * (float) input.viewportScaleY;
|
||||
Vector3f near = cam.getWorldCoordinates(new Vector2f(jmeX, jmeY), 0f);
|
||||
Vector3f far = cam.getWorldCoordinates(new Vector2f(jmeX, jmeY), 1f);
|
||||
Ray ray = new Ray(near, far.subtract(near).normalizeLocal());
|
||||
int hit = pickMarker(ray);
|
||||
if (hit >= 0) {
|
||||
selectLight(hit);
|
||||
input.auswahlLightSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
/** Trifft den Glow-Halo oder den Bulb irgendeines Markers. */
|
||||
private int pickMarker(Ray ray) {
|
||||
for (int i = 0; i < markers.size(); i++) {
|
||||
|
||||
@@ -715,6 +715,8 @@ public class SceneObjectState extends BaseAppState {
|
||||
input.soundAreaClickQueue.offer(new SharedInput.SoundAreaClick(sx, sy, false));
|
||||
input.locationZoneClickQueue.offer(new SharedInput.LocationZoneClick(sx, sy, false));
|
||||
input.auswahlClickQueue.offer(click);
|
||||
input.auswahlLightClickQueue.offer(click);
|
||||
input.auswahlEmitterClickQueue.offer(click);
|
||||
return;
|
||||
}
|
||||
if (input.activeLayer != SharedInput.LAYER_OBJECTS) { deselectAll(); return; }
|
||||
|
||||
Reference in New Issue
Block a user