- fix threading in SceneToolController

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8626 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent 89aa2b160f
commit b90d093ef0
  1. 32
      sdk/jme3-core/src/com/jme3/gde/core/scene/controller/SceneToolController.java

@ -97,7 +97,6 @@ public class SceneToolController implements AppState {
//cursor.attachChild(cursorArrowX);
cursor.attachChild(cursorArrowY);
//cursor.attachChild(cursorArrowZ);
toolsNode.attachChild(cursor);
//grid
grid = new Geometry("grid", new Grid(20, 20, 1.0f));
@ -203,11 +202,17 @@ public class SceneToolController implements AppState {
if (mesh == null) {
return;
}
Geometry selectionGeometry = new Geometry("selection_geometry_sceneviewer", mesh);
final Geometry selectionGeometry = new Geometry("selection_geometry_sceneviewer", mesh);
selectionGeometry.setMaterial(blueMat);
selectionGeometry.setLocalTransform(geom.getWorldTransform());
toolsNode.attachChild(selectionGeometry);
selectionShape = selectionGeometry;
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
toolsNode.attachChild(selectionGeometry);
return null;
}
});
}
protected void attachBoxSelection(Spatial geom) {
@ -219,12 +224,18 @@ public class SceneToolController implements AppState {
WireBox wireBox = new WireBox();
wireBox.fromBoundingBox(bbox);
selctionShapeOffset.set(bbox.getCenter()).subtractLocal(geom.getWorldTranslation());
Geometry selectionGeometry = new Geometry("selection_geometry_sceneviewer", wireBox);
final Geometry selectionGeometry = new Geometry("selection_geometry_sceneviewer", wireBox);
selectionGeometry.setMaterial(blueMat);
selectionGeometry.setLocalTransform(geom.getWorldTransform());
selectionGeometry.setLocalTranslation(bbox.getCenter());
toolsNode.attachChild(selectionGeometry);
selectionShape = selectionGeometry;
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
toolsNode.attachChild(selectionGeometry);
return null;
}
});
}
}
@ -250,12 +261,18 @@ public class SceneToolController implements AppState {
if (control == null) {
return;
}
Spatial selectionGeometry = DebugShapeFactory.getDebugShape(control.getCollisionShape());
final Spatial selectionGeometry = DebugShapeFactory.getDebugShape(control.getCollisionShape());
if (selectionGeometry != null) {
selectionGeometry.setMaterial(blueMat);
selectionGeometry.setLocalTransform(geom.getWorldTransform());
toolsNode.attachChild(selectionGeometry);
selectionShape = selectionGeometry;
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
toolsNode.attachChild(selectionGeometry);
return null;
}
});
}
}
@ -342,6 +359,7 @@ public class SceneToolController implements AppState {
}
public void stateAttached(AppStateManager asm) {
toolsNode.attachChild(cursor);
// throw new UnsupportedOperationException("Not supported yet.");
}

Loading…
Cancel
Save