X-Hax / sa_tools

Sonic Adventure Toolset
http://info.sonicretro.org/SA_Tools
109 stars 24 forks source link

Assimp Chunk import fails on a weighted model #196

Closed PiKeyAr closed 2 years ago

PiKeyAr commented 2 years ago

sa2sonic.zip Trying to import this model results in the following error. Non-weighted chunk models seem to import fine.

System.ArgumentException: Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: 'System.Comparison`1[SAModel.SAEditorCommon.Import.AssimpStuff+VertInfo]'.
   at System.Collections.Generic.ArraySortHelper`1.Sort(Span`1 keys, Comparison`1 comparer)
   at System.Collections.Generic.List`1.Sort(Comparison`1 comparison)
   at SAModel.SAEditorCommon.Import.AssimpStuff.ProcessMeshChunk(Mesh aiMesh, Scene scene, String[] texInfo, String[]& bones) in D:\GitHub\sa_tools\Libraries\SAEditorCommon\Import\AssimpStuff.cs:line 783
   at SAModel.SAEditorCommon.Import.AssimpStuff.AssimpImportWeighted(Scene scene, String[] texInfo) in D:\GitHub\sa_tools\Libraries\SAEditorCommon\Import\AssimpStuff.cs:line 975
   at SAModel.SAEditorCommon.Import.AssimpStuff.AssimpImport(Scene scene, Node node, ModelFormat modelFormat, String[] texInfo, Boolean asSingle) in D:\GitHub\sa_tools\Libraries\SAEditorCommon\Import\AssimpStuff.cs:line 953
   at SAModel.SAMDL.MainForm.ImportModel_Assimp(String objFileName, Boolean importAsSingle, Boolean selected, Boolean importColladaRoot) in D:\GitHub\sa_tools\SAMDL\MainForm.cs:line 2305
   at SAModel.SAMDL.MainForm.ImportModelFromFile(String modelFilename) in D:\GitHub\sa_tools\SAMDL\MainForm.cs:line 186
   at SAModel.SAMDL.MainForm.LoadFileList(String[] files, Boolean cmdLoad) in D:\GitHub\sa_tools\SAMDL\MainForm.cs:line 151
   at SAModel.SAMDL.MainForm.MainForm_Load(Object sender, EventArgs e) in D:\GitHub\sa_tools\SAMDL\MainForm.cs:line 318
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at SAModel.SAMDL.MainForm.WndProc(Message& m) in D:\GitHub\sa_tools\SAMDL\MainForm.cs:line 60
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)
Shadowth117 commented 2 years ago

This should be resolved. There remains an issue with verts with only a particular node alongside verts with many nodes and that node, but this has been an issue for a very long time. In theory, it can be worked around, but is rather annoying.