The XAML export script for Blender allows the popular free 3D modeler to be used to create content for WPF applications. 3D scenes created in Blender are exported to .xaml files which can be dynamically loaded or compiled into your WPF applications.Installation Instructions
- Install the version of Blender indicated in the release notes. Blender is available from http://www.blender.org
- Copy the xaml_export.py file to Blender's scripts directory. On Windows this is typically located at one of the following locations:
C:\Program Files\Blender Foundation\Blender\.blender\scripts
C:\Documents and Settings\<YourUserName>\Application Data\Blender Foundation\Blender\.blender\scripts
- Restart Blender. If the installation was successful you should see a new entry under Blender's ~File~Export menu for "Xaml (.xaml)..."
After composing your 3D scene is Blender choose the ~File~Export~Xaml menu. This will display Blender's standard file dialog. Enter the name of your scene and press the "Export Xaml" button.
The exported Xaml can be viewed in the WPF Model Viewer, which is included in the 3D Tools project
. Alternatively, you can dynamically load the Xaml into your WPF application using XamlReader.Load(fileStream).Known Issues
- The ImageSource property is exported as a fully qualified path as it appears in Blender (e.g., "D:\MyModels\Ballmer.png").
- If you add a texture, you will need to go into the UV editor and add texture coordinates. The exporter does not export the "default" UV coordinates that Blender displays when a mesh has no UV coordinates assigned.
- The Windows Presentation Foundation does not have an image codec for Targa (*.tga) files. If you export a model which uses Targa files you will need to convert these by hand to a format supported by the WPF (e.g., PNG) and fix the exported .xaml by hand.
- Diffuse materials are exported as a simple texture if applicable or a solid color if no texture is available. Other types of materials are not currently supported.
- Blender uses different lighting equations than the WPF. As a result, exported lighting is approximate. Only "Sun", "Lamp", and "Spot" light types are supported.
- There is currently no support for animation or support for geometry types other than meshes. The recommended workflow is to use Expression Blend to create the animations.