Commit 58f48b8b authored by legoc's avatar legoc
Browse files

Improving the move/rename/remove operations (speed and display)

parent 09ed2029
......@@ -2989,13 +2989,16 @@ public class EditorMenuBar extends MenuBar {
* Updates the 3D scene and the tree view.
*/
@SuppressWarnings("unchecked")
private void updateScene(Component newRootComponent) {
private void updateScene() {
if (!modelLoaded()) {
return;
}
Component rootComponent = Nomad3DEditor.getInstance().getModel().getRoot();
// Save the expanded state of the tree items.
HashMap<String, Boolean> itemStates = Nomad3DEditor.getInstance().getTreeViewExpandedStates(newRootComponent.getTreeItem());
HashMap<String, Boolean> itemStates = Nomad3DEditor.getInstance().getTreeViewExpandedStates(rootComponent.getTreeItem());
// We need to reset the movement here.
// We prefer to do it in any case because even for axis edition, the change of axis (when cancelling) resets the axis to the initial clone.
......@@ -3006,28 +3009,21 @@ public class EditorMenuBar extends MenuBar {
// Reset the component name duplication id.
Nomad3DEditor.getInstance().getModel().setComponentNameDuplicationId();
Nomad3DEditor.getInstance().getRoot().getChildren().remove(Nomad3DEditor.getInstance().getModel().getDisplayedRoot().getSceneNode());
Nomad3DEditor.getInstance().getRoot().getChildren().remove(rootComponent.getSceneNode());
Nomad3DEditor.getInstance().getModel().computeSceneHierarchies(activeLod);
Nomad3DEditor.getInstance().getRoot().getChildren().add(newRootComponent.getSceneNode());
Nomad3DEditor.getInstance().getHierarchyView().setRoot(newRootComponent.getTreeItem());
Nomad3DEditor.getInstance().getRoot().getChildren().add(rootComponent.getSceneNode());
Nomad3DEditor.getInstance().getHierarchyView().setRoot(rootComponent.getTreeItem());
// Restore the expanded state of the tree items.
Nomad3DEditor.getInstance().expandTreeView(newRootComponent.getTreeItem(), itemStates);
Nomad3DEditor.getInstance().getModel().setDisplayedRoot(newRootComponent);
Nomad3DEditor.getInstance().expandTreeView(rootComponent.getTreeItem(), itemStates);
updateAxes();
updateWalls();
updateSystem();
updateFocus();
}
/**
* Updates the 3D scene and the tree view.
*/
@SuppressWarnings("unchecked")
private void updateScene() {
updateScene(Nomad3DEditor.getInstance().getModel().getDisplayedRoot());
// Set the display to the displayed root.
Nomad3DEditor.getInstance().setDisplayedRootComponent(Nomad3DEditor.getInstance().getModel().getDisplayedRoot());
}
public void setDisplayedRootComponent(Component component) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment