You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TigerKat 43bf1a79f8 Added animation importing. 4 years ago
LICENSE Initial commit 5 years ago
README.md Added animation importing. 4 years ago
__init__.py Added animation importing. 4 years ago
anim.py Added support for importing skeletons from skel_*.anim files. 4 years ago
bones.py Now able to parse bone track data and skeleton hierarchies from .anim files. 4 years ago
compression_anim.py Now able to parse bone track data and skeleton hierarchies from .anim files. 4 years ago
dds2tex.py Added texture handling tools. 5 years ago
export_geo.py Fix for normals being effectively reversed. 4 years ago
geo.py Now tries and attach imported models to an armature, and place it at the bone. 4 years ago
geo_edit.py Added 'swap_left_right' to 'geo_edit.py' to swap left and right bones in a .geo's model. 4 years ago
geo_list.py The Blender add-on export/import menus now have an option for feet and meters. 5 years ago
geomesh.py Now tries and attach imported models to an armature, and place it at the bone. 4 years ago
import_anim.py Added animation importing. 4 years ago
import_geo.py Now gets the bone to position the model to from the model's name. Now also adds the armature's position to final model's position, making it line up better. 4 years ago
import_skel.py Added support for importing skeletons from skel_*.anim files. 4 years ago
polygrid.py Added Blender export support. 5 years ago
stl_dump.py Added geo_edit.py as a simple command line tool for modifying .geo files. 5 years ago
texture.py Added texture handling tools. 5 years ago
texture_extract.py Added texture handling tools. 5 years ago
util.py Early work for perfroming animation importing and exporting. 4 years ago
vec_math.py Now rebuilds the PolyGrid data when writing a .geo file. 5 years ago

README.md

geopy

A Blender add-on and Python tools for manipulating .geo and .anim files.

Blender Add-On

The Blender add-on allows you to:

  • export .geo files
  • import .geo files
  • import skeletons from skel_*.anim files

Installing the Add-On

  1. Download geopy-v0.2.5.zip
  2. In Blender open "User Preferences" then select the "Add-ons" tab.
  3. Click the "Install Add-on from File..." button and select the downloaded zip.
  4. Enable the add-on and click the "Save User Preferences" button.

Using the Add-On

Exporting models

  1. Select 1 or more meshes to export in object mode.
  2. From the menu select File->Export->"City of Heroes (Feet) (.geo)" (or "City of Heroes (Meters) (.geo)" if your meshes have been scaled in meters).
  3. Browse to the file you want to create and click "Export GEO".

Notes: Models are exported with the name of the mesh they come from, so having the meshes named correctly is recommended.

Importing models

  1. From the menu select File->Import->"City of Heroes (Feet) (.geo)" (or "City of Heroes (Meters) (.geo)" if your converting to meters).
  2. Browse to the file you want to import and click "Import GEO". All models in the .geo file will then be imported.

Note: A model's name is expected to be in the format of "GEO__", where is the bone the model will be anchored to.

Note: If multiple armatures exist, the armature you wish to use must be selected. Otherwise it will use the first armature it will find.

Note: Presently LOD models are excluded from imports.

Importing skeletons

  1. From the menu select File->Import->"City of Heroes Skeleton (skel_*.anim).
  2. Browse to the file you want to import and click "Import".

Note: A new aramature will be created using the name found inside the file.

Note: The import will fail if the .anim file is missing a skeleton hierarchy.

Importing animations

  1. From the menu select File->Import->"City of Heroes Animation (*.anim).
  2. Browse to the file you want to import and click "Import".

Note: It will import as a NLA track to the currently selected armature.

Note: If bone in the animation is missing from armature, the import will fail. Note: If there is an existing animation in the armature with the same name as what you're trying to import, the import will fail. Rename your existing animation, and retry the import.

Tools

These command line tools allow inspection and modification of .geo files.

geo.py

Contains the Geo class, which represents the contents of .geo files. Can be run to test the reading and writing functionality.

geo.py <infile.geo> [<outfile.geo>]

If only an input .geo file is specified, it will read the input and dump the contents of the .geo to the console.

If an output .geo file is specified, it will read the input .geo file, and write the contents to the output as a new .geo file.

stl_dump.py

Dumps the meshes of a .geo file to .stl files. Used for testing and validation, as .stl isn't useful for games.

stl_dump.py <file.geo>

Dumps all the meshes contained in <file.geo> to <geo_name>/<model_name.stl>. <geo_name> and <model_name> are read from the .geo.

geo_edit.py

A command line tool for modifying a .geo file

geo_edit.py <infile.geo> <outfile.geo> <operation> [<operation options> ...]

Operation Description
del_model <reg_ex> Deletes all models whose name contains the regular expression <reg_ex>.
geo_name <name> Change the .geo's name to <name>.
swap_left_right <reg_ex> Swap left and right bones for all models matching <reg_ex>.
rename_model <old> <new> Rename a model from <old> to <new>.
rename_texture <old> <new> Rename a texture from <old> to <new>.
rescale_all <scale> Rescale all vertices in all models by multiplying them all by <scale> .
set_model_scale <model> <x> <y> <z> Set the scale properties of the given model (not the same as rescaling).
Multiple operations can be specified and performed in the same run.

Unless noted otherwise, model names and regular expressions are case sensitive.

geo_list.py

A command line tool for list the model name inside of 1 or more .geo files.

geo_list.py [<output_options>] <file.geo> [<file.geo> ...]

The output format is: <geo_name> : <model_name>

<output_options> adds additional items that can be outputted: -t Prints the triangle count of the model. Added output format: ": <tri_count>" -s Prints the scale of the model. Added output format: ": <sacle_x>, <sacle_y>, <sacle_z>"

texture.py

Contains the Texture class, which represents .texture files. Can be run to test the reading and writing functionality.

Note: Requires Wand to be installed: http://wand-py.org/

texture.py <infile.texture> [<outfile.texture>]

If only an input .texture is specified, it will read the input file and dump the contents to the console.

If an output .texture is specified, it will read the input.texture file, and write the contents to the output .texture file.

texture_extract.py

A command line tool for extracting an image from a .texture file.

Note: Requires Wand to be installed: http://wand-py.org/

texture_extract.py <infile.texture> [<outfile>]

Reads the file <infile.texture> and writes the contained image to an output file.

If <outfile> is specified it will write to this file. If no <outfile> is specified it will use the file name contained inside the .texture file, recreating the directory structure.

dds2tex.py

A command line tool for converting a .dds file into a .texture .

Note: Requires Wand to be installed: http://wand-py.org/

texture_extract.py <infile.dds> [<outfile.texture> [<texture_filename>]]

<infile.dds> is the input file.

<outfile.texture> is the output file. If not specified it will use the same file name as the input except with a .texture extension. If <outfile.texture> is a directory it will use <texture_filename> with a .texture extension as the file name and directory, but placed under the directory <outfile.texture> .

<texture_filename> the filename to store inside the .texture file. If this not specified, it defaults to <infile.dds> . If <infile.dds> contains "texture_library" it will discard everything before "texture_library" use the remainder.

Known Issues

  • Not all structures are handled (reflection quads)
  • Not all structures are regenerated when writing a .geo file. (Reductions)
  • Blender import of .geo files is currently a stub.