Move rest of the classes to dev.slimev package, comment out wrong unit-test, minor cleanups

This commit is contained in:
Eiren Rain committed 2021-12-24 21:18:58 +02:00
1 parent b81458d034
commit 7b15d242f7
57 files changed
+159 -158

No files matched your search

@@ -0,0 +1,67 @@
package dev.slimevr.vr.trackers;
import com.jme3.math.Quaternion;
import io.eiren.yaml.YamlNode;
public class TrackerConfig {
public final String trackerName;
public String designation;
public String description;
public boolean hide;
public Quaternion adjustment;
public String mountingRotation;
public TrackerConfig(Tracker tracker) {
this.trackerName = tracker.getName();
this.description = tracker.getDescriptiveName();
this.designation = tracker.getBodyPosition() != null ? tracker.getBodyPosition().designation : null;
}
public TrackerConfig(YamlNode node) {
this.trackerName = node.getString("name");
this.description = node.getString("description");
this.designation = node.getString("designation");
this.hide = node.getBoolean("hide", false);
this.mountingRotation = node.getString("rotation");
YamlNode adjNode = node.getNode("adjustment");
if(adjNode != null) {
adjustment = new Quaternion(adjNode.getFloat("x", 0), adjNode.getFloat("y", 0), adjNode.getFloat("z", 0), adjNode.getFloat("w", 0));
}
}
public void setDesignation(String newDesignation) {
this.designation = newDesignation;
}
public void saveConfig(YamlNode configNode) {
configNode.setProperty("name", trackerName);
if(designation != null)
configNode.setProperty("designation", designation);
else
configNode.removeProperty("designation");
if(hide)
configNode.setProperty("hide", hide);
else
configNode.removeProperty("hide");
if(adjustment != null) {
configNode.setProperty("adj.x", adjustment.getX());
configNode.setProperty("adj.y", adjustment.getY());
configNode.setProperty("adj.z", adjustment.getZ());
configNode.setProperty("adj.w", adjustment.getW());
} else {
configNode.removeProperty("adj");
}
if(mountingRotation != null) {
configNode.setProperty("rotation", mountingRotation);
} else {
configNode.removeProperty("rotation");
}
if(description != null) {
configNode.setProperty("description", description);
} else {
configNode.removeProperty("description");
}
}
}