PDA

View Full Version : TESTERS WANTED: Swap/Rotate UVs Plugin


ChaosMageX
29th Jul 2011, 6:03 PM
Greetings to the meshing community!

I'd like to present a simple plugin that I made for Milkshape almost a year ago, but forgot to share with the rest of the community. I made it to fix some broken UV coordinates on the mesh of the Grim Reaper's hourglass, exported from TS2.
This plugin is great for fixing meshes with broken UV coordinates, but it could possibly break meshes with triangles that share vertices, so please read the Known Issues below. That's why I've been reluctant to release it until now, so use it at your own risk. Still, I hope at least some meshers will get some use out of this tool in fixing meshes with broken UV coordinates.

DISCLAIMER: :alarm:
This plugin is provided free of charge. This plugin is currently an incomplete work in progress in its beta testing phase, and is therefore subject to change at any time. By downloading and using this program, you are subject to this disclaimer.
Except when otherwise stated in writing, the creators and distributors of this plugin provide it 'as is' without warranty of any kind, either expressed or implied. The entire risk as to the performance of this plugin is with you. In no event will the creators or distributors of this tool be liable to you for any damages caused by its use, including, but not limited to, any incidental or consequential damages to your computer, your meshes, your copy of The Sims 3 or any of its expansion packs or stuff packs or other additions or modifications, third party or otherwise, or your computer bursting into a ball of flames visible from space.

WHAT THIS IS:
This plugin is designed to be able to swap the UV coordinates of the vertices on each currently selected triangle in the mesh. It can swap the UV coordinates between two of a triangle's vertices, or rotate all three of them by performing three consecutive swaps. It is useful for fixing broken meshes exported from TS2 objects for upgrading them to TS3.

INSTALLATION:

Download msSwapRotateUVs.zip.
Extract its contents (msSwapRotateUVs.dll) to your Milkshape 3D installation directory, so that it's right next to ms3d.exe, just like other plugins for Milkshape 3D.


USE:

Open up the mesh you want to edit the UV coords of in Milkshape 3D.
Select the triangles you want to edit by whatever means you prefer.
Click Face-->Swap/Rotate UVs in the top menu, which will cause a pop-up dialog to appear with 5 available options for swapping or rotating the UV coordinates of the vertices on the selected triangles.
Select one of these options and click the OK button, which will cause the UV coordinates to be swapped or rotated between the vertices of each selected triangle consecutively. However, if any of the selected triangles share an affected vertex, this could create issues in the mesh. Please read Known Issues below.
If the swap or rotation option you selected doesn't fix the mesh's UV coordinates, or further damages them, just click Edit-->Undo in the top menu. Then, either repeat the steps above with a different swap or rotation option selected, or use a different plugin to fix your mesh's UV coordinates.


KNOWN ISSUES:

This plugin performs the UV coordinate swapping/rotating operation on the vertices of each currently selected triangle in the mesh, one after the other. :!: It does not keep track of which vertices in the mesh it has already altered. :!: If two or more selected triangles share a vertex, this plugin could potentially swap out the UV coordinates of that vertex for the first polygon using it, and then swap out those UV coordinates out again for each following triangle that also uses it, causing the mesh's UV coordinates to be further damaged. More importantly, trying to run this plugin again with the same swap selected or the reverse rotation selected would only exacerbate this damage, since it operates on the selected triangles in the same order each time.
Before using this tool, always try to make sure that none of the currently selected triangles share a vertex, and even after making sure, use this tool at your own risk. If this plugin does end up further damaging the mesh's UV coordinates instead of fixing them, just click Edit-->Undo in the top menu. If a certain swapping or rotation didn't fix the mesh's UV coordinates, you can try running the tool again with a different one selected, or just try using a different plugin to fix the UV coordinates.


Assistance Wanted:

I have included the source code for this plugin, along with the Visual Studio 2008 project for compiling it in msSwapRotateUVs-Source.zip. If you know how to program in C/C++ and how to make working Milkshape 3D plugins, feel free to improve this plugin, expand its capabilities, or fix its issues.
This is a relatively simple tool, but other things besides the known issues above could go wrong with it. If you encounter any problems while using this tool, please let me know about them by posting as much detail as possible in this thread. Also include the Milkshape 3D project file if you can.