Commit 33f6c036 authored by Ivan Dages's avatar Ivan Dages
Browse files

component : toggle configuration visibility

parent 9005d4a9
......@@ -442,6 +442,32 @@ public class Component {
this.axis.moveTo(oldAxisValue);
}
public void setConfigurationVisibility(boolean visible, String configName, String configSourceName, boolean recursive) {
ConfigParams config = this.getConfigurationByName(configName);
config.setVisible(visible);
if (visible && !this.isRoot() && !this.parent.getConfigurationByName(configName).isVisible()) {
parent.setConfigurationVisibility(visible, configName, configSourceName, false);
}
try {
ConfigParams configSource = this.getConfigurationByName(configSourceName);
config.setRotation(configSource.getRotation());
config.setTranslation(configSource.getTranslation());
config.setScale(configSource.getScale());
} catch (NullPointerException e) {
// Nothing to do : no source config
} catch (Exception e) {
Logger.getLogger("nomad-3d").severe(e.getMessage());
e.printStackTrace();
}
if (recursive) {
for (Component child : this.children) {
child.setConfigurationVisibility(visible, configName, configSourceName, recursive);
}
}
}
/**
* Gets a specific child by its name.
* @param name Name of the child
......
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