2
2
using System . Collections . Generic ;
3
3
using System . Data ;
4
4
using System . Data . SQLite ;
5
+ using System . Text ;
5
6
using UnityDataTools . Analyzer . SerializedObjects ;
6
7
using UnityDataTools . FileSystem . TypeTreeReaders ;
7
8
@@ -19,7 +20,7 @@ public void Init(SQLiteConnection db)
19
20
command . ExecuteNonQuery ( ) ;
20
21
21
22
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 )" ;
23
24
m_InsertCommand . Parameters . Add ( "@id" , DbType . Int64 ) ;
24
25
m_InsertCommand . Parameters . Add ( "@sub_meshes" , DbType . Int32 ) ;
25
26
m_InsertCommand . Parameters . Add ( "@blend_shapes" , DbType . Int32 ) ;
@@ -28,6 +29,8 @@ public void Init(SQLiteConnection db)
28
29
m_InsertCommand . Parameters . Add ( "@vertices" , DbType . Int32 ) ;
29
30
m_InsertCommand . Parameters . Add ( "@compression" , DbType . Int32 ) ;
30
31
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 ) ;
31
34
}
32
35
33
36
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
42
45
m_InsertCommand . Parameters [ "@bones" ] . Value = mesh . Bones ;
43
46
m_InsertCommand . Parameters [ "@compression" ] . Value = mesh . Compression ;
44
47
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 ;
45
62
46
63
m_InsertCommand . ExecuteNonQuery ( ) ;
47
64
0 commit comments