Error Message
************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at OBJ2MAP.MAPCreation.LoadOBJ(MainForm _MainForm, String[] fileLines, EGRP egrp, StreamWriter streamWriter, List`1& _Vertices, List`1& _Faces, List`1& _UVs, List`1& _Brushes, Single scale, Char[] separator1, Char[] separator2)
at OBJ2MAP.MainForm.GoButton_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Therektafire
#243 posted by
Preach on 2019/10/22 22:39:15
I have absolutely zero chance of being able to debug the code, and given how the download is served off archive.org I suspect nobody else will either. So my idea is to see if the bug can be worked around.
If you try running the Blender tool with a different level of decimate modifiers (maybe start with a very low level of alteration) does the same error still strike? If not, try incrementing the levels until the bug strikes or you have something you can work with.
If not, check if just importing into blender and re-exporting without any modifiers causes the crash. If so, might have to rule Blender out entirely, if not then alternative modifiers are the order of the day.
#244 posted by
chedap on 2019/10/22 23:21:03
Depth of 1 is the possible suspect. Try 8 or more.
The larger the faces, the higher the chance that a pyramid would end up as a degenerate brush (i.e. an original face coincides with one of its extruded ones). Since you're increasing face area, increase the depth accordingly.
Also make sure to triangulate the mesh, I don't think OBJ2MAP checks for planar faces.
#245 posted by
khreathor on 2019/10/23 04:08:07
Try using this:
https://bitbucket.org/khreathor/obj-2-map/downloads/obj2map_130_prev.zip
also few tips:
1) Triangulate whole mesh;
2) Set all normals outside;
3) UV it - can be automatic;
4) best to treat 1 blender unit as 1 quake unit, so scale your mesh properly;
5) apply position/rotation/scale before export
When you apply all changes above, you should get flawless conversions.
#246 posted by
chedap on 2019/10/23 05:05:39
...
Didn't realise there was a version that could do UVs. That's amazing. Going to port this into a Blender exporter after HWJam (unless that already exists as well).
#247 posted by
khreathor on 2019/10/23 05:17:16
UVs works only in valve220 format
#248 posted by
chedap on 2019/11/16 12:51:40
As promised,
here's a .map exporter for Blender 2.80
Exports either individual faces as pyramids, or objects as convex brushes. Uses material names for texture assignment and material image size for scaling. Supports UVs both in standard Quake and in Valve220 format (adapted from EricW's implementation for OBJ2MAP). Offers custom grid. Allows saving to clipboard.
The exporter ensures that the brushes are convex and the faces planar. You don't have to triangulate the meshes in advance, but in some cases it can help with UVs (e.g. with mid-edge vertices). There's room for improvement, but it should work fine as is.
Standard format UV export is lossy (no shearing). I don't really expect anyone to be using it over Valve220 anyway, but it should produce decent results for id1-style detailing. Single-axis curves should be fine, no miracles though.
Only tested in Trenchbroom for now. Might need to change precision for other editors. Let me know if it works/breaks elsewhere.
#249 posted by
AlpacaNox on 2020/04/05 13:15:36
That is an amazing plugin, Chedap! Thank you so much for what you do. It works really really well!
@Chedap
#250 posted by
Tintin on 2021/02/03 17:44:57
Installing the .py file through the plugin menu in Blender 2.80 or 2.91 like normal and it doesn't show up. Does this not work anymore?
Hi, I'm trying to convert a level from Unreal Gold and it's full of Infinities and NaNs.
https://mega.nz/file/ADYmXZJB#NIogY6csRsOdwGfK4VElcPpt0rGouUfI3JOWNHFi5oQ
Blender plugin needs "division by zero" protection in one place.
#253 posted by
chedap on 2021/06/30 15:42:47
@Tintin: the plugin is a single python script. That's what you should download (rather than a .zip) and point to in the Blender's "Install..." dialog.
@crystallize: I have added a check for missing images. This prevents the error, but you should not expect sane UVs on export, since without the files there's no way for the exporter to determine the scale.