Poikilos / io_import_x

Import/export .x files in Blender 3.0 (and some earlier versions). The *Poikilos fork* attempts to maintain compatibility with the latest stable Blender and allows install via GUI (Click "Code", "Download ZIP"--See "Install" in readme for the rest of the steps). Related project (also recently updated): https://github.com/ldo/blender-addons-orphaned
GNU General Public License v3.0
33 stars 9 forks source link

io_import_x

(based on directX_blender by littleneo) Import .x files into Blender. The Poikilos fork attempts to maintain compatibility with the latest stable Blender and allows install via GUI (See "Install" in readme).

Primary Goals

Known Issues:

-littleneo and Poikilos

Contributing

Contributors have kept this fork going as seen in the commit history. :+1:

The best way to help this project is to contribute code. Tasks left undone (in subsections below) are complex, so pull requests will probably be the only way they will get resolved.

See also:

Orientation

Bones or models may not be reoriented from y-up to z-up and other similar issues such as bones rotated incorrectly may occur where the x file differs from Blender geometry. Since one file may differ from another, how to deal with this consistently is unknown. Someone who figures out how will likely be the one to write the code and fix it.

Animation Code

(Not started yet) The bones would have to be imported correctly (see "Orientation") first. However, the orientation of the model will probably have to be kept the same as the x-file initially (until after writing the animation frames) to avoid very big complications. Then, pose frames would have to be added to the bones (accounting for whether bones have parents which would make animations relative). Importing a keyframe on every frame may be the only way (but that's fine--users can always remove some keyframes manually to make improving the animation easier).

License

This project is distributed under the GNU General Public License v3 (see LICENSE file). Although the original repo did not have a license file, the plugin is also at Blender's svn and git repos, and therefore under the GPL as required by Blender Foundation for all add-ons. Any public licensed code cannot later be limited to a more restrictive license, so adding a GPLv3 license to this repo is ok.

Install

-Poikilos

Usage

Planned Features

Changes

see CHANGELOG.md

Developer Notes

TODO

-littleneo and Poikilos

File Format Parsing

Read Main Structure

Read Main Token Names

(any 'template', any 'frame', any 'mesh')

At the end of main structure, the script prints a tree of the data.

Read Template Definitions

For each template in the dict, populate definitions in it. Create new fields in each token['template'][templatename] according to values found in .x:

token['template'][templatename]['uuid']                 (str) <universally unique identifier>
token['template'][templatename]['members']['name']      (str) member name
token['template'][templatename]['members']['type']      (str) DWORD,FLOAT etc keywords or template name
token['template'][templatename]['restriction']          (str) 'open' , 'closed' , or the specidied (restricted) value

Optimization

Allow 2 steps: preprocess, then random access to file:

So far this looks fast (tested on windows). Preprocessing can be important because of eol and the code I wrote to compute pointer value.

Credits

References

Discussions

See also