diff --git a/Editor/README.md b/Editor/README.md index 97fdf69..eeb45a3 100644 --- a/Editor/README.md +++ b/Editor/README.md @@ -1,52 +1,70 @@ -# Editor - -Files for using the Unity editor - -## Installation - -Place the "Editor" folder anywhere in your project Assets folder. - -## Usage - -### MeshPostProcessor - -Used to perform various operations to models on import to unity - -#### Add Colliders - -To convert objects to colliders on import, add the following strings to the object's name: - -* `_COLLIDER`: Converts to a mesh collider - -* `_SPHERECOLLIDER`: Converts to a sphere collider - -* `_CAPSULECOLLIDER`: Converts to a capsule collider, with the axis along the object's longest axis - -* `_BOXCOLLIDER`: Converts to a box collider. The box will be aligned to the object's local coordinates - -#### Merge Meshes - -Add `_MERGE` to an object's name, and all its child objects meshes will be automatically merged into one. Does not work for skinned meshes - -#### Delete Objects - -Add `_DEL` to an object's name to delete it on import - -#### Trim animations - -Automatically removes any animations with only 2 keyframes to make them easier to edit manually - - -### TexturePostProcessor - -Used to perform various operations on textures on import to Unity. Configured with constants in the top of the file. - -Only works on files with the extension `EXTENSION` (default ".png"). - -#### Specular maps - -If `SPEC_ENABLE` is enabled (default true), textures with the suffix `SPEC_TAG` (default "-spec") will be copied into the alpha channel of the texture without that suffix. For example, the file `foo-spec.png` will be copied into the alpha channel of the imported texture `foo.png`. - -#### Normal maps - -If `NORMAL_ENABLE` is enabled (default true), textures with the suffix `NORMAL_TAG` (default "-spec") will be marked as normal maps on import and when KSP PartTools exports the texture. if `NORMAL_GENERATE` is enabled (default true), then the texture will automatically be converted from a hightmap using Unity's normal map generation tool. +# Editor + +Files for using the Unity editor + +## Installation + +Place the "Editor" folder anywhere in your project Assets folder. + +## Usage + +### MeshPostProcessor + +Used to perform various operations to models on import to unity + +#### Add Colliders + +To convert objects to colliders on import, add the following strings to the object's name: + +* `_COLLIDER`: Converts to a mesh collider + +* `_SPHERECOLLIDER`: Converts to a sphere collider + +* `_CAPSULECOLLIDER`: Converts to a capsule collider, with the axis along the object's longest axis + +* `_BOXCOLLIDER`: Converts to a box collider. The box will be aligned to the object's local coordinates + +#### Merge Meshes + +Add `_MERGE` to an object's name, and all its child objects meshes will be automatically merged into one. Does not work for skinned meshes + +#### Delete Objects + +Add `_DEL` to an object's name to delete it on import + +#### Trim animations + +Automatically removes any animations with only 2 keyframes to make them easier to edit manually + +####Additional Notes (when used in conjunction with Taniwha’s Blender Mu Plugin) + +For those who use Taniwha’s Blender importer, to import existing .mu’s, the following steps & notes + need to be addressed before importing your model into Unity with the MeshPostProcessor installed: + + 1) You need to make sure you only suffix the name of the *object*, and *not* of the mesh, with the above operators. + 2) In Blender, you need to convert any imported collider instances to “real”. + a) To do this, in Object Mode, select the collider instance object, then select: + Object→Apply→Make Instances Real (Shift-Ctrl-A) + b) Then move the new object back into it’s original place in your hierarchy. + Holding Shift+Alt while dragging/dropping will keep its transforms/properties. + c) Rename the *object* name, adding the appropriate operator suffix. + (I suggest removing the “collider:” prefix from the *mesh* name, but thats just personal preference) + 3) Now you have to go into Edit Mode, and fill in all the faces in the mesh. Check that all of + the created face normals are facing outside. + (When you make real the collider instances, only vertices & edges seem to get created, and not faces.) + This will be apparent, if upon Unity import, you get this error, or similar in the Console window: + ‘Can't calculate tangents, because mesh '_BOXCOLLIDER|mesh:|Dupli|' doesn't contain normals.’ + +### TexturePostProcessor + +Used to perform various operations on textures on import to Unity. Configured with constants in the top of the file. + +Only works on files with the extension `EXTENSION` (default ".png"). + +#### Specular maps + +If `SPEC_ENABLE` is enabled (default true), textures with the suffix `SPEC_TAG` (default "-spec") will be copied into the alpha channel of the texture without that suffix. For example, the file `foo-spec.png` will be copied into the alpha channel of the imported texture `foo.png`. + +#### Normal maps + +If `NORMAL_ENABLE` is enabled (default true), textures with the suffix `NORMAL_TAG` (default "-spec") will be marked as normal maps on import and when KSP PartTools exports the texture. if `NORMAL_GENERATE` is enabled (default true), then the texture will automatically be converted from a hightmap using Unity's normal map generation tool.