I am creating a properties window for the 3d objects in a sandbox editor. The objects can have different properties, so depending on the type of object, a different property window would be shown. The ui is created in nifty.
My basic approach would be:
top level component is window with scrollcomponent inside.
a panel with the properties of each object type will be created at startup.
each property will be visualized with custom controls that I made. (panel with horizontal orientation)
if an object is selected the appropriate panel will be added to the scroll-able component.
Do you think this is a good approach with the nifty gui? Anybody have a better idea? The thing I worry about the most is the behavior of the scroll component.
The principle works, I didn’t have too much trouble with the scroll panel. I followed the advice to update the scrollpanel element like this :
[java]
Element scrollPanel = this.currentScreen.findElementByName(“scrollPropertiesPanel”);
if (scrollPanel != null) {
System.out.println(“Layouting scrollpanel”);
scrollPanel.layoutElements();
scrollPanel.getNiftyControl(ScrollPanel.class).setUp(0, 5, 0, 50, AutoScroll.OFF);
}
[/java]
What didn’t work was reusing a property panel for a given object type. I have to recreate the property panel every time I use it. I use markForRemoval to remove a panel from the scroll panel and that seems to change some state in the panel that makes it difficult later on to add it again.
Maybe somebody has an idea how to make reuse of Element objects possible?
I subscribe to all the slider events in my controller, and check if the id matches the id of
the specific slider in this controller. Probably should change that to listen
to one specific slider in my controller, still trying to find out how to do that.