So my previous (maybe incorrect) understanding was that if I wanted to modify the scene graph, I needed to enqueue the logic using app.enqueue(new Callable()) etc. This has worked fine. But recently, one part of my game logic that translates some nodes has been causing the “tried to modify root node outside of renderer thread” error. This is all of the code in the block:
[java]
final GameBoardPiece piece = AVSingletons.players.get(playerID).getPiece(pieceIDs[0]);
GameBoardSystem currentSystem = (GameBoardSystem)AVSingletons.spatials.get(piece.getCurrentHexCoord());
GameBoardSystem system = (GameBoardSystem)AVSingletons.systems.get(systemID);
piece.setCurrentHex(system.hex);
if(currentSystem.getSystemID() != system.getSystemID()){
piece.setCanMove(false);
}
//this is internal collection, not part of scene graph
currentSystem.removePiece(piece);
//this is internal collection, not part of scene graph
system.addPiece(piece);
for(GameBoardPiece pieceIt : system.getPieces()){
if(piece.getAllegience() != pieceIt.getAllegience()){
AVSingletons.battleSystem = system;
if(playerID == AVSingletons.getThisPlayer().getPlayerID()){
<strong>//does nifty modify root node?</strong>
AVSingletons.getNifty().getScreen("hud").findElementById("initatiateButton").show();
}
}
}
piece.setPrevLoc((piece.getLocalTranslation().clone()));
<strong>//only scene graph related code in the block</strong>
piece.setLocalTranslation(coord.clone().add(0, 0, 1));
[/java]