-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImportTRSKL.py
615 lines (521 loc) · 24.6 KB
/
ImportTRSKL.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
bl_info = {
"name": "Pokémon Switch V2 Armature (.TRSKL)",
"author": "Scarlett/SomeKitten & ElChicoEevee",
"version": (0, 0, 2),
"blender": (4, 0, 0),
"location": "File > Import",
"description": "drvictorvs simply modified the original importer to only \
import armatures",
"warning": "",
"category": "Import",
}
import math
import os
import os.path
import random
import shutil
import struct
import sys
from os import path
from pathlib import Path
import bpy
import mathutils
from bpy.props import (BoolProperty, CollectionProperty, EnumProperty,
FloatProperty, StringProperty)
from bpy.types import Operator, OperatorFileListElement
from bpy_extras.io_utils import ImportHelper
# READ THIS: change to True when running in Blender, False when running using
# fake-bpy-module-latest
IN_BLENDER_ENV = True
class PokeSVSkelImport(bpy.types.Operator, ImportHelper):
bl_idname = "custom_import_armature.pokeskelscarletviolet"
bl_label = "Import"
bl_options = {"PRESET", "UNDO"}
filename_ext = ".trskl"
filter_glob: StringProperty(
default="*.trskl",
options={"HIDDEN"},
maxlen=255,
)
filepath = bpy.props.StringProperty(
subtype="FILE_PATH",
)
files = CollectionProperty(type=bpy.types.PropertyGroup)
bonestructh: BoolProperty(
name="Bone Extras (WIP)",
description="Bone Extras (WIP)",
default=False,
)
def draw(self, context):
layout = self.layout
box = layout.box()
box.prop(self, "bonestructh")
def execute(self, context):
directory = os.path.dirname(self.filepath)
if self.multiple == False:
filename = os.path.basename(self.filepath)
f = open(os.path.join(directory, filename), "rb")
from_trsklsv(directory, f, self.bonestructh)
f.close()
return {"FINISHED"}
else:
file_list = sorted(os.listdir(directory))
obj_list = [item for item in file_list if item.endswith(".trskl")]
for item in obj_list:
f = open(os.path.join(directory, item), "rb")
from_trsklsv(directory, f, self.bonestructh)
f.close()
return {"FINISHED"}
def from_trsklsv(filep, trskl, bonestructh):
# make collection
if IN_BLENDER_ENV:
new_collection = bpy.data.collections.new(os.path.basename(trskl.name[:-6]))
bpy.context.scene.collection.children.link(new_collection)
bone_structure = None
bone_array = []
bone_id_map = {}
bone_rig_array = []
trskl_bone_adjust = 0
print("Parsing TRSKL...")
if trskl is not None:
print("Parsing TRSKL...")
trskl_file_start = readlong(trskl)
fseek(trskl, trskl_file_start)
trskl_struct = ftell(trskl) - readlong(trskl)
fseek(trskl, trskl_struct)
trskl_struct_len = readshort(trskl)
if trskl_struct_len == 0x000C:
trskl_struct_section_len = readshort(trskl)
trskl_struct_start = readshort(trskl)
trskl_struct_bone = readshort(trskl)
trskl_struct_b = readshort(trskl)
trskl_struct_c = readshort(trskl)
trskl_struct_bone_adjust = 0
elif trskl_struct_len == 0x000E:
trskl_struct_section_len = readshort(trskl)
trskl_struct_start = readshort(trskl)
trskl_struct_bone = readshort(trskl)
trskl_struct_b = readshort(trskl)
trskl_struct_c = readshort(trskl)
trskl_struct_bone_adjust = readshort(trskl)
else:
raise AssertionError("Unexpected TRSKL header struct length!")
if trskl_struct_bone_adjust != 0:
fseek(trskl, trskl_file_start + trskl_struct_bone_adjust)
trskl_bone_adjust = readlong(trskl)
print(f"Mesh node IDs start at {trskl_bone_adjust}")
if trskl_struct_bone != 0:
fseek(trskl, trskl_file_start + trskl_struct_bone)
trskl_bone_start = ftell(trskl) + readlong(trskl)
fseek(trskl, trskl_bone_start)
bone_count = readlong(trskl)
if IN_BLENDER_ENV:
new_armature = bpy.data.armatures.new(os.path.basename(trskl.name))
bone_structure = bpy.data.objects.new(
os.path.basename(trskl.name), new_armature
)
new_collection.objects.link(bone_structure)
bpy.context.view_layer.objects.active = bone_structure
bpy.ops.object.editmode_toggle()
for x in range(bone_count):
bone_offset = ftell(trskl) + readlong(trskl)
bone_ret = ftell(trskl)
fseek(trskl, bone_offset)
print(f"Bone {x} start: {hex(bone_offset)}")
trskl_bone_struct = ftell(trskl) - readlong(trskl)
fseek(trskl, trskl_bone_struct)
trskl_bone_struct_len = readshort(trskl)
if trskl_bone_struct_len == 0x0012:
trskl_bone_struct_ptr_section_len = readshort(trskl)
trskl_bone_struct_ptr_string = readshort(trskl)
trskl_bone_struct_ptr_bone = readshort(trskl)
trskl_bone_struct_ptr_c = readshort(trskl)
trskl_bone_struct_ptr_d = readshort(trskl)
trskl_bone_struct_ptr_parent = readshort(trskl)
trskl_bone_struct_ptr_rig_id = readshort(trskl)
trskl_bone_struct_ptr_bone_merge = readshort(trskl)
trskl_bone_struct_ptr_h = 0
elif trskl_bone_struct_len == 0x0014:
trskl_bone_struct_ptr_section_len = readshort(trskl)
trskl_bone_struct_ptr_string = readshort(trskl)
trskl_bone_struct_ptr_bone = readshort(trskl)
trskl_bone_struct_ptr_c = readshort(trskl)
trskl_bone_struct_ptr_d = readshort(trskl)
trskl_bone_struct_ptr_parent = readshort(trskl)
trskl_bone_struct_ptr_rig_id = readshort(trskl)
trskl_bone_struct_ptr_bone_merge = readshort(trskl)
trskl_bone_struct_ptr_h = readshort(trskl)
else:
trskl_bone_struct_ptr_section_len = readshort(trskl)
trskl_bone_struct_ptr_string = readshort(trskl)
trskl_bone_struct_ptr_bone = readshort(trskl)
trskl_bone_struct_ptr_c = readshort(trskl)
trskl_bone_struct_ptr_d = readshort(trskl)
trskl_bone_struct_ptr_parent = readshort(trskl)
trskl_bone_struct_ptr_rig_id = readshort(trskl)
trskl_bone_struct_ptr_bone_merge = readshort(trskl)
trskl_bone_struct_ptr_h = readshort(trskl)
if trskl_bone_struct_ptr_bone_merge != 0:
fseek(trskl, bone_offset + trskl_bone_struct_ptr_bone_merge)
bone_merge_start = ftell(trskl) + readlong(trskl)
fseek(trskl, bone_merge_start)
bone_merge_string_len = readlong(trskl)
if bone_merge_string_len != 0:
bone_merge_string = readfixedstring(
trskl, bone_merge_string_len
)
print(f"BoneMerge to {bone_merge_string}")
else:
bone_merge_string = ""
if trskl_bone_struct_ptr_bone != 0:
fseek(trskl, bone_offset + trskl_bone_struct_ptr_bone)
bone_pos_start = ftell(trskl) + readlong(trskl)
fseek(trskl, bone_pos_start)
bone_pos_struct = ftell(trskl) - readlong(trskl)
fseek(trskl, bone_pos_struct)
bone_pos_struct_len = readshort(trskl)
if bone_pos_struct_len != 0x000A:
raise AssertionError("Unexpected bone position struct length!")
bone_pos_struct_section_len = readshort(trskl)
bone_pos_struct_ptr_scl = readshort(trskl)
bone_pos_struct_ptr_rot = readshort(trskl)
bone_pos_struct_ptr_trs = readshort(trskl)
fseek(trskl, bone_pos_start + bone_pos_struct_ptr_trs)
bone_tx = readfloat(trskl)
bone_ty = readfloat(trskl)
bone_tz = readfloat(trskl)
# TODO ArceusScale
# LINE 1797
fseek(trskl, bone_pos_start + bone_pos_struct_ptr_rot)
bone_rx = readfloat(trskl)
bone_ry = readfloat(trskl)
bone_rz = readfloat(trskl)
fseek(trskl, bone_pos_start + bone_pos_struct_ptr_scl)
bone_sx = readfloat(trskl)
bone_sy = readfloat(trskl)
bone_sz = readfloat(trskl)
if trskl_bone_struct_ptr_string != 0:
fseek(trskl, bone_offset + trskl_bone_struct_ptr_string)
bone_string_start = ftell(trskl) + readlong(trskl)
fseek(trskl, bone_string_start)
bone_str_len = readlong(trskl)
bone_name = readfixedstring(trskl, bone_str_len)
if trskl_bone_struct_ptr_parent != 0x00:
fseek(trskl, bone_offset + trskl_bone_struct_ptr_parent)
bone_parent = readlong(trskl) + 1
else:
bone_parent = 0
print(bone_parent)
if trskl_bone_struct_ptr_rig_id != 0:
fseek(trskl, bone_offset + trskl_bone_struct_ptr_rig_id)
bone_rig_id = readlong(trskl) + trskl_bone_adjust
while len(bone_rig_array) <= bone_rig_id:
bone_rig_array.append("")
bone_rig_array[bone_rig_id] = bone_name
bone_matrix = mathutils.Matrix.LocRotScale(
(bone_tx, bone_ty, bone_tz),
mathutils.Euler((bone_rx, bone_ry, bone_rz)),
(bone_sx, bone_sy, bone_sz),
)
if IN_BLENDER_ENV:
new_bone = new_armature.edit_bones.new(bone_name)
new_bone.use_connect = False
new_bone.use_inherit_rotation = True
if bonestructh == True:
if trskl_bone_struct_ptr_h == 0:
new_bone.use_inherit_scale = True
else:
new_bone.use_inherit_scale = False
new_bone.use_local_location = True
new_bone.head = (0, 0, 0)
new_bone.tail = (0, 0, 0.1)
new_bone.matrix = bone_matrix
if bone_parent != 0:
new_bone.parent = new_armature.edit_bones[bone_parent - 1]
new_bone.matrix = (
new_armature.edit_bones[bone_parent - 1].matrix
@ bone_matrix
)
if bone_name in bone_rig_array:
bone_id_map[bone_rig_array.index(bone_name)] = bone_name
else:
bone_rig_array.append(bone_name)
bone_id_map[len(bone_rig_array) - 1] = bone_name
bone_array.append(new_bone)
fseek(trskl, bone_ret)
fclose(trskl)
if IN_BLENDER_ENV:
bpy.ops.object.editmode_toggle()
class PokeArcSkelImport(bpy.types.Operator, ImportHelper):
bl_idname = "custom_import_armature.pokeskellegendsarceus"
bl_label = "Import"
bl_options = {"PRESET", "UNDO"}
filename_ext = ".trskl"
filter_glob: StringProperty(
default="*.trskl",
options={"HIDDEN"},
maxlen=255,
)
filepath = bpy.props.StringProperty(
subtype="FILE_PATH",
)
files = CollectionProperty(type=bpy.types.PropertyGroup)
rare: BoolProperty(
name="Load Shiny",
description="Uses rare material instead of normal one",
default=False,
)
multiple: BoolProperty(
name="Load All Folder",
description="Uses rare material instead of normal one",
default=False,
)
loadlods: BoolProperty(
name="Load LODS",
description="Uses rare material instead of normal one",
default=False,
)
def draw(self, context):
layout = self.layout
box = layout.box()
box.prop(self, "rare")
box = layout.box()
box.prop(self, "multiple")
box = layout.box()
box.prop(self, "loadlods")
def execute(self, context):
directory = os.path.dirname(self.filepath)
if self.multiple == False:
filename = os.path.basename(self.filepath)
f = open(os.path.join(directory, filename), "rb")
from_trskl(directory, f, self.rare, self.loadlods)
f.close()
return {"FINISHED"}
else:
file_list = sorted(os.listdir(directory))
obj_list = [item for item in file_list if item.endswith(".trskl")]
for item in obj_list:
f = open(os.path.join(directory, item), "rb")
from_trskl(directory, f, self.rare, self.loadlods)
f.close()
return {"FINISHED"}
def from_trskl(filep, trskl):
# make collection
if IN_BLENDER_ENV:
new_collection = bpy.data.collections.new(os.path.basename(trskl.name))
bpy.context.scene.collection.children.link(new_collection)
bone_structure = None
bone_array = []
bone_id_map = {}
bone_rig_array = []
trskl_bone_adjust = 0
print("Parsing TRSKL...")
trskl_file_start = readlong(trskl)
fseek(trskl, trskl_file_start)
trskl_struct = ftell(trskl) - readlong(trskl)
fseek(trskl, trskl_struct)
trskl_struct_len = readshort(trskl)
if trskl is not None:
print("Parsing TRSKL...")
trskl_file_start = readlong(trskl)
fseek(trskl, trskl_file_start)
trskl_struct = ftell(trskl) - readlong(trskl)
fseek(trskl, trskl_struct)
trskl_struct_len = readshort(trskl)
if trskl_struct_len == 0x000C:
trskl_struct_section_len = readshort(trskl)
trskl_struct_start = readshort(trskl)
trskl_struct_bone = readshort(trskl)
trskl_struct_b = readshort(trskl)
trskl_struct_c = readshort(trskl)
trskl_struct_bone_adjust = 0
elif trskl_struct_len == 0x000E:
trskl_struct_section_len = readshort(trskl)
trskl_struct_start = readshort(trskl)
trskl_struct_bone = readshort(trskl)
trskl_struct_b = readshort(trskl)
trskl_struct_c = readshort(trskl)
trskl_struct_bone_adjust = readshort(trskl)
else:
raise AssertionError("Unexpected TRSKL header struct length!")
if trskl_struct_bone_adjust != 0:
fseek(trskl, trskl_file_start + trskl_struct_bone_adjust)
trskl_bone_adjust = readlong(trskl)
print(f"Mesh node IDs start at {trskl_bone_adjust}")
if trskl_struct_bone != 0:
fseek(trskl, trskl_file_start + trskl_struct_bone)
trskl_bone_start = ftell(trskl) + readlong(trskl)
fseek(trskl, trskl_bone_start)
bone_count = readlong(trskl)
if IN_BLENDER_ENV:
new_armature = bpy.data.armatures.new(os.path.basename(trskl.name))
bone_structure = bpy.data.objects.new(
os.path.basename(trskl.name), new_armature
)
new_collection.objects.link(bone_structure)
bpy.context.view_layer.objects.active = bone_structure
bpy.ops.object.editmode_toggle()
for x in range(bone_count):
bone_offset = ftell(trskl) + readlong(trskl)
bone_ret = ftell(trskl)
fseek(trskl, bone_offset)
print(f"Bone {x} start: {hex(bone_offset)}")
trskl_bone_struct = ftell(trskl) - readlong(trskl)
fseek(trskl, trskl_bone_struct)
trskl_bone_struct_len = readshort(trskl)
if trskl_bone_struct_len == 0x0012:
trskl_bone_struct_ptr_section_len = readshort(trskl)
trskl_bone_struct_ptr_string = readshort(trskl)
trskl_bone_struct_ptr_bone = readshort(trskl)
trskl_bone_struct_ptr_c = readshort(trskl)
trskl_bone_struct_ptr_d = readshort(trskl)
trskl_bone_struct_ptr_parent = readshort(trskl)
trskl_bone_struct_ptr_rig_id = readshort(trskl)
trskl_bone_struct_ptr_bone_merge = readshort(trskl)
trskl_bone_struct_ptr_h = 0
elif trskl_bone_struct_len == 0x0014:
trskl_bone_struct_ptr_section_len = readshort(trskl)
trskl_bone_struct_ptr_string = readshort(trskl)
trskl_bone_struct_ptr_bone = readshort(trskl)
trskl_bone_struct_ptr_c = readshort(trskl)
trskl_bone_struct_ptr_d = readshort(trskl)
trskl_bone_struct_ptr_parent = readshort(trskl)
trskl_bone_struct_ptr_rig_id = readshort(trskl)
trskl_bone_struct_ptr_bone_merge = readshort(trskl)
trskl_bone_struct_ptr_h = readshort(trskl)
else:
trskl_bone_struct_ptr_section_len = readshort(trskl)
trskl_bone_struct_ptr_string = readshort(trskl)
trskl_bone_struct_ptr_bone = readshort(trskl)
trskl_bone_struct_ptr_c = readshort(trskl)
trskl_bone_struct_ptr_d = readshort(trskl)
trskl_bone_struct_ptr_parent = readshort(trskl)
trskl_bone_struct_ptr_rig_id = readshort(trskl)
trskl_bone_struct_ptr_bone_merge = readshort(trskl)
trskl_bone_struct_ptr_h = readshort(trskl)
if trskl_bone_struct_ptr_bone_merge != 0:
fseek(trskl, bone_offset + trskl_bone_struct_ptr_bone_merge)
bone_merge_start = ftell(trskl) + readlong(trskl)
fseek(trskl, bone_merge_start)
bone_merge_string_len = readlong(trskl)
if bone_merge_string_len != 0:
bone_merge_string = readfixedstring(
trskl, bone_merge_string_len
)
print(f"BoneMerge to {bone_merge_string}")
else:
bone_merge_string = ""
if trskl_bone_struct_ptr_bone != 0:
fseek(trskl, bone_offset + trskl_bone_struct_ptr_bone)
bone_pos_start = ftell(trskl) + readlong(trskl)
fseek(trskl, bone_pos_start)
bone_pos_struct = ftell(trskl) - readlong(trskl)
fseek(trskl, bone_pos_struct)
bone_pos_struct_len = readshort(trskl)
if bone_pos_struct_len != 0x000A:
raise AssertionError("Unexpected bone position struct length!")
bone_pos_struct_section_len = readshort(trskl)
bone_pos_struct_ptr_scl = readshort(trskl)
bone_pos_struct_ptr_rot = readshort(trskl)
bone_pos_struct_ptr_trs = readshort(trskl)
fseek(trskl, bone_pos_start + bone_pos_struct_ptr_trs)
bone_tx = readfloat(trskl)
bone_ty = readfloat(trskl)
bone_tz = readfloat(trskl)
# TODO ArceusScale
# LINE 1797
fseek(trskl, bone_pos_start + bone_pos_struct_ptr_rot)
bone_rx = readfloat(trskl)
bone_ry = readfloat(trskl)
bone_rz = readfloat(trskl)
fseek(trskl, bone_pos_start + bone_pos_struct_ptr_scl)
bone_sx = readfloat(trskl)
bone_sy = readfloat(trskl)
bone_sz = readfloat(trskl)
if trskl_bone_struct_ptr_string != 0:
fseek(trskl, bone_offset + trskl_bone_struct_ptr_string)
bone_string_start = ftell(trskl) + readlong(trskl)
fseek(trskl, bone_string_start)
bone_str_len = readlong(trskl)
bone_name = readfixedstring(trskl, bone_str_len)
if trskl_bone_struct_ptr_parent != 0x00:
fseek(trskl, bone_offset + trskl_bone_struct_ptr_parent)
bone_parent = readlong(trskl) + 1
else:
bone_parent = 0
if trskl_bone_struct_ptr_rig_id != 0:
fseek(trskl, bone_offset + trskl_bone_struct_ptr_rig_id)
bone_rig_id = readlong(trskl) + trskl_bone_adjust
while len(bone_rig_array) <= bone_rig_id:
bone_rig_array.append("")
bone_rig_array[bone_rig_id] = bone_name
bone_matrix = mathutils.Matrix.LocRotScale(
(bone_tx, bone_ty, bone_tz),
mathutils.Euler((bone_rx, bone_ry, bone_rz)),
(bone_sx, bone_sy, bone_sz),
)
if IN_BLENDER_ENV:
new_bone = new_armature.edit_bones.new(bone_name)
new_bone.use_connect = False
new_bone.use_inherit_rotation = True
new_bone.use_inherit_scale = True
new_bone.use_local_location = True
new_bone.head = (0, 0, 0)
new_bone.tail = (0, 0, 0.1)
new_bone.matrix = bone_matrix
if bone_parent != 0:
new_bone.parent = bone_array[bone_parent - 1]
new_bone.matrix = (
bone_array[bone_parent - 1].matrix @ bone_matrix
)
if bone_name in bone_rig_array:
bone_id_map[bone_rig_array.index(bone_name)] = bone_name
else:
print(f"Bone {bone_name} not found in bone rig array!")
bone_array.append(new_bone)
fseek(trskl, bone_ret)
fclose(trskl)
if IN_BLENDER_ENV:
bpy.ops.object.editmode_toggle()
def readbyte(file):
return int.from_bytes(file.read(1), byteorder="little")
def readshort(file):
return int.from_bytes(file.read(2), byteorder="little")
def readlong(file): # SIGNED!!!!
bytes_data = file.read(4)
# print(f"readlong: {bytes_data}")
return int.from_bytes(bytes_data, byteorder="little", signed=True)
def readfloat(file):
return struct.unpack("<f", file.read(4))[0]
def readhalffloat(file):
return struct.unpack("<e", file.read(2))[0]
def readfixedstring(file, length):
bytes_data = file.read(length)
# print(f"readfixedstring ({length}): {bytes_data}")
return bytes_data.decode("utf-8")
def fseek(file, offset):
# print(f"Seeking to {offset}")
file.seek(offset)
def ftell(file):
return file.tell()
def fclose(file):
file.close()
def replace_current_menu_item(menu, item):
for func in menu._dyn_ui_initialize():
if func.__name__ == item.__name__:
menu.remove(func)
menu.append(item)
def ImportTRSKL_menu_func_import(self, context):
self.layout.operator(PokeArcSkelImport.bl_idname, text="PLA Armature (.trskl)")
self.layout.operator(PokeSVSkelImport.bl_idname, text="ScVi Armature (.trskl)")
def register():
bpy.utils.register_class(PokeArcSkelImport)
bpy.utils.register_class(PokeSVSkelImport)
replace_current_menu_item(
bpy.types.TOPBAR_MT_file_import, ImportTRSKL_menu_func_import
)
def unregister():
bpy.utils.unregister_class(PokeArcSkelImport)
bpy.utils.unregister_class(PokeSVSkelImport)
if __name__ == "__main__":
register()