Commit 1e4c60b9 authored by Ivan Dages's avatar Ivan Dages
Browse files

debug : remove parent from selection when removing a component from it

parent 5c4569cd
......@@ -268,23 +268,39 @@ public class Model {
Logger.getLogger("nomad-3d").fine("Component added.");
return res;
}
/**
* Remove a component from the selection.
* @param c Component to remove
* @return true if the selection contained the component
*/
public boolean removeFromSelection(Component c) {
return removeFromSelection(c, true);
}
/**
* Remove a component from the selection.
* @param c Component to remove
* @param updateTreeView true to uncheck the tree item of the component
* @return true if the selection contained the component
*/
private boolean removeFromSelection(Component c, boolean updateTreeView) {
Logger.getLogger("nomad-3d").fine("Removing component \"" + c.getName() + "\" from selection...");
if (c.isLeaf()) {
MeshView meshView = (MeshView)c.getSceneNode();
meshView.setMaterial(c.getMaterial());
}
if (c.getTreeItem() != null) {
if (c.getTreeItem() != null && updateTreeView) {
c.getTreeItem().selectedProperty().set(false);
}
c.visibleAxis(false);
boolean res = this.selection.remove(c);
// Remove parent for consistency
if (res && !c.isRoot()) {
removeFromSelection(c.getParent(), false);
}
Logger.getLogger("nomad-3d").fine("Component removed.");
return res;
}
......
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