Data View for entities in debug menu
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-09-02 19:27:42 -04:00
parent 7c363143f2
commit 249db4fc89
3 changed files with 29 additions and 0 deletions

View File

@ -668,6 +668,8 @@ Unit definition/spawning
Hitbox updates for katana 2H
Fix bug with geometry references not properly flipping in server hitbox collision callback
Fix level editor entity tree not re-rendering when an entity is deleted
Fix server entity not rotation when first person camera rotates
Entity details debug menu Data View
# TODO

View File

@ -1,6 +1,7 @@
package electrosphere.entity;
import java.util.HashMap;
import java.util.Set;
import org.graalvm.polyglot.HostAccess.Export;
@ -87,4 +88,12 @@ public class Entity {
public void removeData(String key){
data.remove(key);
}
/**
* Gets the set of all keys on the entity
* @return The set of all keys
*/
public Set<String> getKeys(){
return this.data.keySet();
}
}

View File

@ -51,6 +51,7 @@ public class ImGuiEntityMacros {
private static Entity detailViewEntity = null;
//tree node values
private static boolean showDataTab = false; //show all data names stored in the entity
private static boolean showActorTab = false; //show the actor tab
private static boolean showPoseActorTab = false; //show the pose actor tab
private static boolean showEquipStateTab = false; //actor details
@ -111,6 +112,9 @@ public class ImGuiEntityMacros {
public void exec() {
ImGui.text("Current ID: " + detailViewEntity.getId());
if(ImGui.treeNode("Views")){
if(ImGui.checkbox("Data View", showDataTab)){
showDataTab = !showDataTab;
}
if(EntityUtils.getActor(detailViewEntity) != null && ImGui.checkbox("Actor Details", showActorTab)){
showActorTab = !showActorTab;
}
@ -145,6 +149,7 @@ public class ImGuiEntityMacros {
drawLinkedEntities();
drawServerViewDir();
drawPhysicsDetails();
drawDataView();
}
});
clientEntityDetailWindow.setOpen(false);
@ -160,6 +165,19 @@ public class ImGuiEntityMacros {
clientEntityDetailWindow.setOpen(true);
}
/**
* Draws the data view
*/
protected static void drawDataView(){
if(showDataTab && ImGui.collapsingHeader("Data View")){
if(detailViewEntity != null){
for(String key : detailViewEntity.getKeys()){
ImGui.text(key);
}
}
}
}
/**
* Client scene entity view
*/