22using System . Collections . Generic ;
33using System . Data ;
44using System . Data . SQLite ;
5+ using System . Text ;
56using UnityDataTools . Analyzer . SerializedObjects ;
67using UnityDataTools . FileSystem . TypeTreeReaders ;
78
@@ -19,7 +20,7 @@ public void Init(SQLiteConnection db)
1920 command . ExecuteNonQuery ( ) ;
2021
2122 m_InsertCommand = new SQLiteCommand ( db ) ;
22- m_InsertCommand . CommandText = "INSERT INTO meshes(id, sub_meshes, blend_shapes, bones, indices, vertices, compression, rw_enabled) VALUES(@id, @sub_meshes, @blend_shapes, @bones, @indices, @vertices, @compression, @rw_enabled)" ;
23+ m_InsertCommand . CommandText = "INSERT INTO meshes(id, sub_meshes, blend_shapes, bones, indices, vertices, compression, rw_enabled, vertex_size, channels ) VALUES(@id, @sub_meshes, @blend_shapes, @bones, @indices, @vertices, @compression, @rw_enabled, @vertex_size, @channels )" ;
2324 m_InsertCommand . Parameters . Add ( "@id" , DbType . Int64 ) ;
2425 m_InsertCommand . Parameters . Add ( "@sub_meshes" , DbType . Int32 ) ;
2526 m_InsertCommand . Parameters . Add ( "@blend_shapes" , DbType . Int32 ) ;
@@ -28,6 +29,8 @@ public void Init(SQLiteConnection db)
2829 m_InsertCommand . Parameters . Add ( "@vertices" , DbType . Int32 ) ;
2930 m_InsertCommand . Parameters . Add ( "@compression" , DbType . Int32 ) ;
3031 m_InsertCommand . Parameters . Add ( "@rw_enabled" , DbType . Int32 ) ;
32+ m_InsertCommand . Parameters . Add ( "@vertex_size" , DbType . Int32 ) ;
33+ m_InsertCommand . Parameters . Add ( "@channels" , DbType . String ) ;
3134 }
3235
3336 public void Process ( Context ctx , long objectId , RandomAccessReader reader , out string name , out long streamDataSize )
@@ -42,6 +45,20 @@ public void Process(Context ctx, long objectId, RandomAccessReader reader, out s
4245 m_InsertCommand . Parameters [ "@bones" ] . Value = mesh . Bones ;
4346 m_InsertCommand . Parameters [ "@compression" ] . Value = mesh . Compression ;
4447 m_InsertCommand . Parameters [ "@rw_enabled" ] . Value = mesh . RwEnabled ;
48+ m_InsertCommand . Parameters [ "@vertex_size" ] . Value = mesh . VertexSize ;
49+
50+ StringBuilder channels = new StringBuilder ( ) ;
51+ foreach ( var channel in mesh . Channels )
52+ {
53+ channels . Append ( channel . Usage . ToString ( ) ) ;
54+ channels . Append ( ' ' ) ;
55+ channels . Append ( channel . Type . ToString ( ) ) ;
56+ channels . Append ( '[' ) ;
57+ channels . Append ( channel . Dimension ) ;
58+ channels . AppendLine ( "]" ) ;
59+ }
60+
61+ m_InsertCommand . Parameters [ "@channels" ] . Value = channels ;
4562
4663 m_InsertCommand . ExecuteNonQuery ( ) ;
4764
0 commit comments