Alpha4 makes it a lot easier to write new features for makehuman without touching the existing code. This was not possible before, which made it more difficult to accept user submissions, as we had to review changes which went into the official code.
Starting from alpha4 we have a small plugin framework which makes it easy to add and remove features. At startup, makehuman now looks for .py files in the plugins folder which are not starting with an underscore (which makes it easier to disable unwanted plugins). It loads them one by one and calls the load entry point passing a reference to the application. The plugin can use this reference to add the necessary GUI widgets or code to the application.
Currently we have moved all render exporters to the new architecture. Since not many people will have all renderers, and since not all render exporters are as updated as aqsis, this move makes it easier to only enable what users need.
Besides cleaning up existing code, we have been using it to prototype new features. Kirill made a new panel to adjust and see basic measurements of the model in cm. I made a panel to adjust the hair color before rendering in aqsis, mainly to see how usable the API is to create new features.
The rules for plugins are very simple:
- A plugin is a .py file in the plugins folder with a load entry point.
- A plugin only imports core files.
The reason a plugin cannot import other plugins is that it makes it difficult to know which files belong to which plugin. We still need to define a convention for shared files beyond the core makehuman files.
To get started, download alpha4 or a later version from svn and look at example_plugin.py or any of the other plugins to see how you can create your own feature in makehuman.
0 comments:
Post a Comment