Sunday, March 7, 2010

Developing in makehuman - 2 - GUI

The GUI in makehuman is still far from finished. Since the first alpha there have been many changes already and many other will come. This is because when features are added or modified, we can run out of space, or start to see things differently. Sometimes we experiment to see how a modifier can be manipulated in a different way. For example in the details and microdetails we chose to have tools manipulating the model directly instead of using sliders. Another idea for the macrodetails was a multidimensional slider, like a radar chart which would replace all five sliders. It is impossible to pour the GUI into into its final form while we are still adding functionality and getting new ideas.

However don't let the lack of guidelines stop you from adding a GUI to your own plugins. The current GUI API is very usable, and gets more mature every day.
The layout at the moment is a two level tab control. The tabs at the top represent categories, like modeling, files, render. The ones at the bottom are the tasks in the current category and refine the more broad category in macrodetail, detail and microdetail modeling, or loading, saving and exporting.
So when creating your plugin, the first thought should be "In which category does it belong?". From experience we know that it can be a though question to answer. Sometimes the only answer is adding a new category. This is what we did for measurement for example.

def load(app):
category = gui3d.Category(app, "Measurement", app.getThemeResource("images", "button_measure.png"))

Next you probably want your own task to implement your feature. While it's possible to attach functionality to an instance of gui3d.Task, it's often easier to derive your own class. When you create an instance of your class, you pass the parent of your task, which can either be an existing category

taskview = HairPropertiesTaskView(app.categories["Modelling"])

or the new one which you added.

taskview = MeasurementTaskView(category)

In your derived task you will then add the necessary controls to let the user interact. A good place to see how to use the different controls is the example plugin. You will see that even if you don't add any controls, the model is already visible. This is because the model is attached to the root of the GUI tree. In the onShow event of your task you might want to reset the camera position, like we do in the save task, or hide the model, like we do in the load task. Just don't forget to reset the state when your task gets hidden in onHide.

2 comments:

  1. Definitely, definitely bring the 3d controller objects; they were 'straight out of Avatar' cool. Push Makehuman into the 3d next-gen, don't hold back now, the whole world is going 3d. And get ready for your biggest money maker, the 3d Talking Head. Everyone wants one, nobody else has got the universal-human approach that Makehuman has. Makehuman Real Time Lip Sync = $$$

    ReplyDelete
  2. I know I can't speak for everyone... but I like the sliders. Just wish the information that they modify was more clearly communicated to the user. Age, Height, etc.

    ReplyDelete

© MHteam 2001-2010