-
Notifications
You must be signed in to change notification settings - Fork 33
/
REEM_NOESIS_CMD-Chinese.ms
2835 lines (2565 loc) · 98.8 KB
/
REEM_NOESIS_CMD-Chinese.ms
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
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
try ( destroydialog formNoesisCMD; clearlistener() ) catch ()
(
--RE Engine MESH Noesis CMD tool
--Version: v0.47
--Last Release: August 17, 2023
--Authors: alphaZomega, mariokart64n
local noesis_path = "D:\\work\\noesisv4466\\Noesis.exe"
local re2_pak_location = "F:\\modmanager\\REtool\\RE2_chunk_000\\natives\\x64\\"
local re3_pak_location = "F:\\modmanager\\REtool\\RE3_chunk_000\\natives\\stm\\"
local re4_pak_location = "D:\\REtool\\re_chunk_000\\natives\\stm\\"
local re7_pak_location = "F:\\modmanager\\REtool\\RE7_chunk_000\\natives\\x64\\"
local re8_pak_location = "F:\\modmanager\\REtool\\RE8_chunk_000\\natives\\stm\\"
local reve_pak_location = "F:\\modmanager\\REtool\\REVE_chunk_000\\natives\\stm\\"
local re2rt_pak_location = "F:\\modmanager\\REtool\\RE2rt_chunk_000\\natives\\stm\\"
local re3rt_pak_location = "F:\\modmanager\\REtool\\RE3rt_chunk_000\\natives\\stm\\"
local re7rt_pak_location = "F:\\modmanager\\REtool\\RE7rt_chunk_000\\natives\\stm\\"
local dmc5_pak_location = "F:\\modmanager\\REtool\\DMC_chunk_000\\natives\\x64\\"
local mhrise_pak_location = "F:\\modmanager\\REtool\\MHRise_chunk_000\\natives\\stm\\"
local sf6_pak_location = "F:\\modmanager\\REtool\\SF6Beta_chunk_000\\natives\\stm\\"
--local rt_pak_location = "F:\\modmanager\\REtool\\RE2RT_chunk_000\\natives\\stm\\"
local show_ReWrite2 = true
local current_pak_location = re2_pak_location
local force_backface_culling = true
local reimport_path = "F:\\"
local python_plugin = "fmt_RE_MESH.py"
local current_extension = ".2109108288"
local current_extension2 = ".2109108288"
local current_path_prefix = "stm"
local names_to_objects --dictionary
global formNoesisCMD
struct losDic ( --maxscript dictionary
private
table = #(),
fn binSort a b = (
if a[1] > b[1] then 1
else if a[1] < b[1] then -1
else 0
),
fn formatDic dic level:0 spaces:4 = (
strm = "\n" as stringStream
padding = ""
if level != 0 then (
for a=1 to level do for b=1 to spaces do padding += " "
)
for k in (dic.keys()) do (
val = dic.getK k
case (classof val) of (
(losDic):format "%%:\n%" padding k (formatDic val level:(level+1) spaces:spaces) to:strm
default:format "%%:%\n" padding k val to:strm
)
)
(strm as string)
),
public
fn count = keys.count,
fn getK k = (
val = bsearch #(k) table binSort
if val == undefined then return val
val[2]
),
fn setK k v = (
val = bsearch #(k) table binSort
if val == undefined then (
append table #(k,v)
qsort table binSort
return this
)
val[2] = v
this
),
fn hasK k = (
t = case (bsearch #(k) table binSort) of (
(undefined):false
default:true
)
t
),
fn delK k = (
indx --findItem keysL (k as name)
for i=1 to table.count where table[i][1] == k do (
indx = i
exit
)
if indx == 0 then throw ("there is no key "+k+" in dictionary")
deleteItem table indx
this
),
fn keys = (
out = for k in table collect k[1]
out
),
fn pprint = (
print (formatDic this)
ok
)
)
local gamesList = #( "REVerse", "MHRSunbreak", "RE2", "RE3", "RE4", "DMC5", "RE8", "RE7 RT", "RE7", "RE2 RT", "RE3 RT", "MHRise", "SF6")
local currentItem = "RE4"
local currentItemIdx = 5
local currentItemIdx2 = 5
local games_to_mdfExts = losDic()
for key in gamesList do
games_to_mdfExts.setK key (
case key of (
"RE2 RT": ".21"
"RE3 RT": ".21"
"RE4": ".32"
"RE2": ".10"
"DMC5": ".10"
"RE3": ".13"
"RE7": ".32"
"RE7 RT": ".21"
"RE8": ".19"
"MHRise": ".19"
"MHRSunbreak": ".23"
"SF6": ".31"
"REVerse": ".20"
default: ""
)
)
fn getAlignedOffset tell alignment = (
local offset = case alignment of (
2: tell + (mod tell 2)
4: bit.and (tell + 3) 0xFFFFFFFFFFFFFFFC
8: bit.and (tell + 7) 0xFFFFFFFFFFFFFFF8
16: bit.and (tell + 15) 0xFFFFFFFFFFFFFFF0
default: tell
)
offset
)
fn ReadFixedString &bstream fixedLen = (
local str = ""
local length = 0
try (
for s = 1 to fixedLen do (
local c = (readshort bstream) as integer
if c == 0 then exit
fseek bstream -2 #seek_cur
local d = readbyte bstream
if d == 0 then continue
str += bit.intAsChar(d)
if d != 32 then length = s
)
) catch ( "" ) --print "Error reading string"
substring str 1 length
)
fn detectedBools bstream tell = (
local originalTell = ftell bstream
local nonBoolTotal = 0
local temp = 0
fseek bstream tell #seek_set
for i = 1 to 4 do (
temp = ReadByte bstream
if temp != 1 and temp != 0 then
nonBoolTotal += 1
)
fseek bstream originalTell #seek_set
if nonBoolTotal == 0 then
return true
return false
)
struct via_GameObject (
Name,
Tag,
DrawSelf,
UpdateSelf,
TimeScale,
offset
)
fn Read_via_GameObject &bstream timescale_offset = (
local Info = via_GameObject()
fseek bstream (getAlignedOffset (ftell bstream) 4) #seek_set
info.offset = ftell bstream
local NameSize = Readlong bstream
Info.Name = ReadFixedString bstream (NameSize * 2)
fseek bstream (getAlignedOffset (ftell bstream) 4) #seek_set
local TagSize = Readlong bstream
Info.Tag = ReadFixedString bstream (TagSize*2)
Info.DrawSelf = ReadByte bstream
Info.UpdateSelf = ReadByte bstream
--fseek bstream (getAlignedOffset (ftell bstream) 4) #seek_set
fseek bstream timescale_offset #seek_set
Info.TimeScale = ReadFloat bstream
print ("Found possible GameObject " + (info as string))
Info
)
struct via_Transform (
LocalPosition,
LocalRotation,
LocalScale,
ParentBone,
SameJointsConstraints,
AbsoluteScaling
)
fn Read_via_Transform &bstream = (
local Info = via_Transform()
fseek bstream (getAlignedOffset (ftell bstream) 16) #seek_set
Info.LocalPosition = (point3 (Readfloat bstream) (Readfloat bstream) (Readfloat bstream))--(point3 (ReadFloat bstream) (ReadFloat bstream) (ReadFloat bstream))
Readlong bstream
Info.LocalRotation = (quat (Readfloat bstream) (Readfloat bstream) (Readfloat bstream) (Readfloat bstream))
Info.LocalScale = (point3 (Readfloat bstream) (Readfloat bstream) (Readfloat bstream))
Readlong bstream
fseek bstream (getAlignedOffset (ftell bstream) 4) #seek_set
local ParentBoneSize = Readlong bstream
Info.ParentBone = ReadFixedString bstream (ParentBoneSize*2)
Info.SameJointsConstraints = ReadByte bstream
Info.AbsoluteScaling = ReadByte bstream
Info
)
fn readLongAt bstream pos = (
local returnPos = ftell bstream
fseek bstream pos #seek_set
local long = readlong bstream
fseek bstream returnPos #seek_set
long
)
fn readByteAndReturn bstream = (
local read_byte = readByte bstream
fseek bstream -1 #seek_cur
read_byte
)
fn detectedFloat bstream = (
local flt = (Readfloat bstream)
if flt == undefined then return false
flt = abs flt
(flt == 0 or (flt >= 0.000000001 and flt <= 100000000.0) )
)
fn detectedXform bstream = (
local returnpos = ftell bstream
local detected = true
fseek bstream (getAlignedOffset (ftell bstream) 16) #seek_set
for i=1 to 12 do (
if not (detectedFloat bstream) then (
detected = false
exit
)
)
fseek bstream returnpos #seek_set
detected
)
fn detectedString bstream offset = (
local pos = ftell bstream
local result = false
fseek bstream offset #seek_set
if (ReadByte bstream) != 0 and (ReadByte bstream) == 0 and (ReadByte bstream) != 0 and (ReadByte bstream) == 0 and (ReadByte bstream) != 0 and (ReadByte bstream) == 0 then
result = true
fseek bstream pos #seek_set
result
)
fn redetectStringBehind bstream is_second_time = (
local pos = ftell bstream
local slash_detected = false
if detectedString bstream (ftell bstream) then (
while (detectedString bstream (ftell bstream)) == true do (--and readLongAt bstream ((ftell bstream) - 4) < pos - (ftell bstream)
fseek bstream -2 #seek_cur
slash_detected = slash_detected or ((readByteAndReturn bstream) == 47) --this fn is for gameobjects, not files
)
fseek bstream -2 #seek_cur
)
if not is_second_time and (detectedString bstream (ftell bstream - 10)) then (
fseek bstream -10 #seek_cur
redetectStringBehind bstream true
if not detectedString bstream (ftell bstream + 4) then
fseek bstream pos #seek_set
)
if slash_detected then
fseek bstream pos #seek_set
)
fn findMesh bstream limitPoint = (
local pos = ftell bstream
local meshPath = ReadFixedString bstream 512
local counter = 0
local output = #()
format "Scanning from % to % for meshes\n" pos limitPoint
try (
while getFilenameType meshPath != ".mesh" do ( --meshPath != "" and
if (ftell bstream) >= limitPoint then exit
while (detectedString bstream (ftell bstream)) == false do (
if (ftell bstream) >= limitPoint then exit
fseek bstream 4 #seek_cur
)
fseek bstream (getAlignedOffset ((ftell bstream) - 2) 4) #seek_set
meshPath = ReadFixedString bstream 512
fseek bstream (getAlignedOffset (ftell bstream) 4) #seek_set
)
if getFilenameType meshPath == ".mesh" and (findString (toLower meshPath) "occ" == undefined) then ( --
local idx = findstring meshPath "/"
while idx != undefined and idx != 0 do (
meshPath = replace meshPath idx 1 "\\"
idx = findstring meshPath "/"
)
meshPath = current_pak_location + meshPath + current_extension
format "Found mesh: %\n\n" meshPath
fseek bstream ((getAlignedOffset (ftell bstream) 4) + 4) #seek_set
local mdfPath = ReadFixedString bstream 512
if getFilenameType mdfPath == ".mdf2" then (
local idx = findstring mdfPath "/"
while idx != undefined and idx != 0 do (
mdfPath = replace mdfPath idx 1 "\\"
idx = findstring mdfPath "/"
)
mdfPath = current_pak_location + mdfPath + (games_to_mdfExts.getK currentItem)
)
output = #(meshPath, mdfPath)
) else format "\n"
) catch ( undefined )
output
)
fn findGameObjects &bstream = (
local GameObjectAddresses = #()
local GameObjects = #()
local pos = 0
fseek bstream 0 #seek_end
local fileSize = ftell bstream
fseek bstream 0 #seek_set
local tester = readlong bstream #unsigned
while tester != 5919570 do ( --find "RSZ"
fseek bstream -2 #seek_cur
tester = readlong bstream #unsigned
if tester == undefined then exit
)
if tester == 5919570 then (
fseek bstream (getAlignedOffset (ftell bstream) 4) #seek_set
while tester != undefined do (
while tester != undefined and tester != 3212836864 do ( -- 00 00 80 BF , timescale -1.0
tester = readlong bstream #unsigned
)
if (pos < fileSize - 16) and (detectedBools bstream ((ftell bstream) - 8)) == true and detectedXform bstream then (
append GameObjectAddresses (ftell bstream)
)
tester = ReadLong bstream
)
if GameObjectAddresses.count > 0 then (
append GameObjectAddresses fileSize
for i=1 to GameObjectAddresses.count-2 do (
fseek bstream GameObjectAddresses[i] #seek_set
local transform = Read_via_Transform bstream
fseek bstream (GameObjectAddresses[i] - 36) #seek_set
local pos2 = ftell bstream
while not detectedString bstream (ftell bstream) and pos2 - (ftell bstream) < 12 do
fseek bstream -2 #seek_cur
if pos2 - (ftell bstream) == 12 then
fseek bstream pos2 #seek_set
if detectedString bstream (ftell bstream) then
redetectStringBehind bstream false
local gameobject = Read_via_GameObject bstream (GameObjectAddresses[i]-4)
local MeshMDF = findMesh bstream GameObjectAddresses[i+1]
local mesh = MeshMDF[1]
local mdf = MeshMDF[2]
if mesh != undefined then (
append GameObjects #(gameobject, transform, mesh, mdf)
--format "%, % \n" (ftell bstream) (GameObjects[GameObjects.count][4] as string)
)
)
)
)
GameObjects
)
fn collectSkinBones node = (
fn findNodesByName list name = (
for node in list where stricmp node.name name == 0 collect node
)
max modify mode
local bones = #()
for sk in node.modifiers where iskindof sk Skin do (
modpanel.setcurrentobject sk
nodes = for n in (refs.dependson sk) where isvalidnode n collect n
for k=1 to skinops.getnumberbones sk do (
name = skinops.getbonename sk k 0
join bones (findNodesByName nodes name)
)
)
bones
)
fn addChildrentToList node nodelist = (
for child in node.children do (
if finditem nodelist child == 0 then (
append nodelist child
addChildrentToList child nodelist
)
)
)
fn collectAllSkinBones node = (
local bones = collectSkinBones node
local root = bones[1]
while root.parent != undefined do
root = root.parent
for bone in bones do (
addChildrentToList bone bones
)
bones
)
fn selectSkinSkeleton nodes = (
local originalSelection = selection as array
for node in nodes do (
local bones = collectSkinBones node
--join originalSelection bones
--select originalSelection
select bones
root = bones[1]
for bone in bones do (
bn = bone
while bn.parent != root and bn.parent != undefined do (
bn = bn.parent
selectmore bn
selectmore bn.children
)
)
join originalSelection selection
)
select originalSelection
)
fn selectSkeleton node = (
local originalSelection = selection as array
local bones = collectSkinBones node
while bones[1].parent != undefined do
bones[1] = bones[1].parent
bones = #(bones[1])
for p in bones where p.children != undefined do join bones p.children
join originalSelection bones
select originalSelection
)
fn findBoneIdx skinMod bnName = (
for i=1 to (skinOps.GetNumberBones skinMod) do (
if bnName == (skinOps.GetBoneName skinMod i 0) then (
return i
)
)
return 0
)
--print current_pak_location
rollout formNoesisCMD "REEM Noesis 0.47 汉化" (
local dist = 1.0
group "导入" (
button btn_import "导入模型/动作" align:#center
checkbox chk_resetScene "导入时重置" checked:false align:#left
checkbox chk_legacyFBX "使用旧版fbx" checked:false align:#left
--checkbox chk_fbxMerge "fbx网格合并" checked:true align:#left tooltip:"将已拆分且名称前带有\"0001_\"的网格合并在一起"
checkbox chk_fbxOptimize "优化FBX" checked:true
--checkbox chk_importMDF "导入材质" checked:false
checkbox chk_folder "导入文件夹" checked:false align:#left
checkbox chk_populateBones "填充骨骼列表" checked:true align:#left
button btn_import_SCN "导入SCN" tooltip:"尝试从 SCN 文件定位加载模型文件"
button BtnImportSkeleton "导入骨骼姿势" tooltip:"将骨骼位置从所选 MESH 文件加载到所选骨骼上(按名称)"
checkbox chk_tPose "T-Pose " offset:[20,0] checked:false tooltip:"以 T 形姿势导入骨骼。 更改阈值数字以调整骨骼与另一骨骼在被 T 姿势旋转忽略之前的距离"
edittext Flddist "" text:(dist as String) offset:[75,-20] fieldWidth:40 labelOnTop:false
)
group "导出" (
button btn_export "导出" align:#center
checkbox chk_flipHandedness "DirectX 翻转" checked:true align:#left
checkbox chk_doVFX "导出特效模型" checked:false align:#left
checkbox chk_manualBoneSelect "手动选择骨骼" checked:false align:#left
checkbox chk_showOptions "显示高级选项" checked:false align:#left
checkbox chk_writeBones "重写骨骼" checked:true align:#left
checkbox chk_reWrite "重写网格" checked:true align:#left
--checkbox chk_ReWrite2 "ReWrite 2nd MESH" checked:false align:#left
--dropdownlist list_gameSelection2 items:gamesList width:110 height:24 align:#center
--label lbl_currentExt2 ".mesh.2109108288" align:#center
)
group "通用" (
button BtnRemoveBoneNumbers "添加/删除骨骼编号" align:#center
--button BtnSkinOnTop "将皮肤移至堆栈顶部,选择带权重的网格" align:#center
button BtnSetScale "x 缩放比例" offset:[-30,0]
edittext FldScale "" text:"1.0" fieldWidth:60 labelOnTop:false offset:[70,-25]
button btn_reimport "重新导入 noesis fbx文件" align:#center
button BtnAnimToBlender "导出fbx网格/动作" align:#center
)
group "配置/汉化:夜曲_flac" (
dropdownlist list_gameSelection items:gamesList width:110 height:24 align:#center
label lbl_currentExt ".mesh.2109108288" align:#center
checkbox chk_showPlugOpt "显示fbx选项" checked:true align:#left
checkbox chk_delFBX "删除fbx文件" checked:true align:#left
checkbox chk_bnNumbers "使用骨骼编号" checked:true align:#left
checkbox chk_showCMD "显示控制台" checked:false align:#left enabled:true
label lbl_noesis "Noesis 路径:" align:#left
edittext edt_noesis "" align:#left
button btn_noesis "选择" align:#center
label lbl_scnpath "解包 Pak 路径:" align:#left
edittext edt_scnpath "" align:#left
button btn_scnpath "选择" align:#center
)
local ScaleValue = 1.0
local cmd = ""
local fbx_path = ""
fn checkDialog = (
local hwnd = dialogMonitorOps.getWindowHandle()
if (uiAccessor.getWindowText hwnd == "Import Name Conflict") then (
uiAccessor.PressButtonByName hwnd "OK"
)
true
)
fn waitForFileUnlock file file_open_limit:30 = (
/*local i = 0
while i < file_open_limit do (
if (try(renameFile file (file + ".tmp"))catch(false)) do (
renameFile (file + ".tmp") file
exit
)
sleep 1
i += 1
)*/
)
fn noesisComponentsFound = (
local state = false
if doesFileExist noesis_path do (
state = true
)
state
)
fn changeCurrentGame listIndex = (
try (
currentItem = gamesList[listIndex]
currentItemIdx = listIndex
lbl_currentExt.caption = case currentItem of
(
"RE2 RT": ".mesh.2109108288"
"RE3 RT": ".mesh.2109108288"
"RE2": ".mesh.1808312334"
"RE3": ".mesh.1902042334"
"RE4": ".mesh.221108797"
"DMC5": ".mesh.1808282334"
"RE7": ".mesh.32"
"RE7 RT": ".mesh.220128762"
"RE8": ".mesh.2101050001"
"MHRise": ".mesh.2008058288"
"MHRSunbreak": ".mesh.2109148288"
"SF6": ".mesh.230110883"
"REVerse": ".mesh.2102020001"
default: ""
)
current_pak_location = case currentItem of
(
"RE2 RT": re2rt_pak_location
"RE3 RT": re3rt_pak_location
"RE2": re2_pak_location
"RE3": re3_pak_location
"RE4": re4_pak_location
"DMC5": dmc5_pak_location
"RE7": re7_pak_location
"RE7 RT": re7rt_pak_location
"RE8": re8_pak_location
"MHRise": mhrise_pak_location
"MHRSunbreak": mhrise_pak_location
"SF6": sf6_pak_location
"REVerse": reve_pak_location
default: ""
)
) catch ( undefined )
list_gameSelection.selection = currentItemIdx
current_extension = replace lbl_currentExt.caption 1 5 ""
edt_scnpath.text = current_pak_location
)
fn Import_MESH cmd setCoords = (
if cmd == undefined then
cmd = "undefined"
if doesFileExist cmd then (
local showFbxOptions = chk_showPlugOpt.checked
local files = #(cmd)
if chk_folder.checked and setCoords == undefined then --sets up multi-mesh folder import (not for SCN files)
files = getFiles (getFilenamePath cmd + "\\*.mesh.*")
local lastExt = lbl_currentExt.caption
for f = 1 to files.count do (
cmd = files[f]
local thisExt = getFilenameType cmd
local orig_path = cmd
local key = getFilenameFile (getFilenameFile cmd)
local old_obj = undefined
local already_imported = false
if setCoords != undefined then (
--format "grabbing value from key %" key
old_obj = names_to_objects.getK key
if old_obj != undefined then
already_imported = true
--format ", found = %\n" already_imported
)
if chk_resetScene.checked do
resetMaxFile #noPrompt
--local old_obj_idx = findItem imported_names cmd
--if old_obj_idx == 0 or imported_objects[old_obj_idx] == undefined then (
if not already_imported then (
fbx_path = (getFilenamePath cmd) + key
outtxt_path = fbx_path + ".txt"
fbx_path = fbx_path + ".fbx"
cmd = (
"\"" + noesis_path + "\" ?cmode \"" + cmd + "\" \"" + fbx_path + "\"" \
+ (if chk_bnNumbers.checked then " -bonenumbers" else "") \
+ (if chk_fbxOptimize.checked then "" else " -fbxnooptimize") \
+ " -fbxmeshmerge" + (if chk_legacyFBX.checked then " -fbxoldexport -fbxexportver FBX201400" else "")
--+ (if chk_importMDF.checked then "" else " -noprompt") \
)
if chk_showCMD.checked then (
DOSCommand ("\"" + cmd + " -logfile \"" + outtxt_path + "\"")
) else (
HiddenDOSCommand ("\"" + cmd + " -logfile \"" + outtxt_path + "\"") startpath:(getFilenamePath noesis_path) donotwait:false
)
format "Import Command:\n%\n" cmd
if doesFileExist outtxt_path then (
local fs = openFile outtxt_path
if fs != undefined then (
local noesisOutput = "\n"
while not eof fs do
noesisOutput = noesisOutput + (readline fs) + "\n"
print noesisOutput
close fs
deletefile outtxt_path
if findstring noesisOutput "Traceback" != undefined then
return false
)
)
waitForFileUnlock(fbx_path)
if showFbxOptions then (--chk_impPrompt
success = importFile fbx_path using:FBXIMP
) else (
success = importFile fbx_path #noPrompt using:FBXIMP
)
if chk_delFBX.checked then
deleteFile fbx_path
if force_backface_culling then
for obj in selection where (classof obj == Editable_mesh) do
obj.backfaceCull = on
) else (
select old_obj
copyNodes = #(); maxOps.cloneNodes selection cloneType:#copy newNodes:©Nodes #nodialog
select copyNodes
success = true
)
if success then (
if thisExt != lastExt then (
lastExt = thisExt
--This list must have the same order as gamesList:
changeCurrentGame ( findItem #(".2102020001", ".2109148288", ".1808312334", ".1902042334", ".221108797", ".1808282334", ".2101050001", ".220128762", ".32", ".2109108288", ".2109108288", ".2008058288", ".230110883") lastExt)
)
local objSelected = selection as array
local meshes = for obj in objSelected where (classof obj == Editable_mesh) collect obj
if (findstring orig_path ".motlist.") != undefined then
delete meshes[1] --delete dummy
else if chk_bnNumbers.checked then (
if setCoords != undefined and not already_imported then
names_to_objects.setK key objSelected
local bones = for obj in objSelected where (superclassof obj == Helper or classof obj == BoneGeometry) collect obj
for bone in bones do hide bone
container = Point size:1.0
local uniqueNames = #(); local mainmeshes = #()
container.name = key
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if setCoords != undefined then (
if container.name != setCoords[1].Name then
container.name = setCoords[1].Name + " (" + container.name + ")"
print ("Loaded " + key + " " + (setCoords[2] as string))
container.rotation = setCoords[2].LocalRotation
container.scale = setCoords[2].LocalScale
container.pos = setCoords[2].LocalPosition
container.transform.controller.value *= (matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,0])
container.pos.controller.value *= 100
)
for mesh in meshes do ( -- create MainMesh containers
fs = filterstring mesh.name "_"
if fs.count >= 3 then (
if appendIfUnique uniqueNames (fs[1] + "_" + fs[2] + "_" + fs[3] + "_" + fs[4]) then (
mainmesh = Point size:1.0
mainmesh.name = (fs[1] + "_" + fs[2] + "_" + fs[3] + "_" + fs[4])
mainmesh.parent = container
mainmesh.transform = container.transform
append mainmeshes mainmesh
)
if setCoords != undefined then
mesh.transform = container.transform
mesh.parent = mainmeshes[mainmeshes.count]
)
)
--skelColor = (random 128 255) (random 128 255) (random 128 255)
for mesh in meshes do (
mesh.material = undefined
mesh.wirecolor = color (random 0 255) (random 0 255) (random 0 255)
if getNumVerts mesh == 3 or mesh.modifiers[#Skin] == undefined or already_imported then continue
select mesh
max modify mode
mesh.modifiers[#Skin].bone_Limit = ( if lastExt==".230110883" then 6 else 8 )
for b = 1 to bones.count do (
if b == 1 and setCoords != undefined then
bones[b].transform = container.transform
bones[b].showLinks = true
bones[b].showLinksOnly = true
bones[b].wirecolor = yellow
fs = filterstring bones[b].name ":"
if fs[2] != undefined then (
if (getuserprop bones[b] "Bone_Number") == undefined do setuserprop bones[b] "Bone_Number" fs[1]
if (getuserprop bones[b] "Bone_Name") == undefined do setuserprop bones[b] "Bone_Name" fs[2]
)
if chk_populateBones.checked then (
bnIdx = findBoneIdx mesh.modifiers[#Skin] bones[b].name
if bnIdx == 0 then ( -- add bones to Skin that have numbers but are not currently in
if fs.count > 1 then
skinOps.addBone mesh.modifiers[#Skin] bones[b] 0
) else if fs.count == 1 then ( -- remove bones from Skin that have no numbers
skinOps.selectbone mesh.modifiers[#Skin] bnIdx
skinOps.removebone mesh.modifiers[#Skin]
)
)
)
)
)
)
chk_showPlugOpt.checked = false
)
) else print("Not found: " + cmd)
)
on Flddist entered num do (
dist = num as float
)
on formNoesisCMD open do (
changeCurrentGame currentItemIdx
if doesFileExist noesis_path do (
edt_noesis.text = noesis_path
)
if doesFileExist current_pak_location do (
edt_scnpath.text = current_pak_location
)
)
on btn_noesis pressed do (
cmd = getOpenFileName types:"Noesis.exe|noesis.exe|All|*.*|"
if cmd != undefined and cmd != "" do (
edt_noesis.text = noesis_path = cmd
)
)
on edt_noesis changed cmd do (
edt_noesis.text = noesis_path = cmd
)
on btn_scnpath pressed do (
cmd = getSavePath types:"re_chunk_000 Folder|Folder|All|*.*|"
if cmd != undefined and cmd != "" do (
edt_scnpath.text = current_pak_location = cmd
)
)
on edt_scnpath changed cmd do (
edt_scnpath.text = current_pak_location = cmd
)
on list_gameSelection selected i do (
changeCurrentGame i
)
on list_gameSelection2 selected i do (
currentItem2 = gamesList[i]
currentItemIdx2 = i
lbl_currentExt2.caption = case currentItem2 of
(
"RE2 RT": ".mesh.2109108288"
"RE3 RT": ".mesh.2109108288"
"RE2": ".mesh.1808312334"
"DMC5": ".mesh.1808282334"
"RE3": ".mesh.1902042334"
"RE4": ".mesh.221108797"
"RE7": ".mesh.32"
"RE7 RT": ".mesh.220128762"
"RE8": ".mesh.2101050001"
"MHRise": ".mesh.2008058288"
"MHRSunbreak": ".mesh.2109148288"
"REVerse": ".mesh.2102020001"
default: ""
)
current_extension2 = replace lbl_currentExt2.caption 1 5 ""
)
on chk_reWrite changed state do (
if chk_reWrite.checked == true and chk_writeBones.checked == false then
chk_writeBones.checked = true
)
on chk_reWrite2 changed state do (
if chk_reWrite2.checked then (
if not chk_writeBones.checked then
chk_writeBones.checked = true
if not chk_reWrite.checked then
chk_reWrite.checked = true
)
)
on chk_writeBones changed state do (
if chk_writeBones.checked == false and chk_reWrite.checked == true then
chk_reWrite.checked = false
)
on btn_import_SCN pressed do (
--if doesFileExist re2_pak_location then (
if noesisComponentsFound() then (
names_to_objects = losDic()
files = #(getOpenFileName types:"All|*.*|")
if files[1] != undefined then (
actionMan.executeAction 0 "40472" --open listener
if chk_folder.checked then
files = getFiles (getFilenamePath files[1] + "\\*.scn.*") --import multiple SCN files from one folder
for scnFile in files do (
format "\n\nImporting % :\n\n" scnFile
local f = fopen scnFile "rb"
local Objects = findGameObjects f
fclose f
if Objects.count > 0 then (
for obj in Objects do (
Import_MESH obj[3] obj
)
) else print "No Meshes detected. Be sure you have set your MESH extension to the one for your game."
)
)
names_to_objects = undefined
gc()
) else (messagebox "Failed to Locate Noesis!")
--) else messagebox "Failed to Locate Extracted Pak!"
)
/*
--Dictionary example
dic = losDic()
--set keys
dic.setK "pappa" 9999
--embeded dictonaries
dic.setK "powers" (losDic())
dic.setK "object" (sphere())
--set key in the embeded dictionary
(dic.getK "powers").setK "lazerEyes" true
(dic.getK "powers").setK "bulletProof" true
--query the available keys
print "------keys------"
print (dic.keys())
print "----------------"
--loop throug a dictionary
print "print keys and values"
for k in dic.keys() do format "%:%\n" k (dic.getK k)
print "preaty print"
--prety print the dictionary
dic.pprint()
*/
on btn_import pressed do (
if noesisComponentsFound() then (
cmd = getOpenFileName types:"RE Engine MESH/MOTLIST|*.1808282334;*.1902042334;*.221108797;*.2010231143;*.2008058288;*.2109148288;*.2109108288;*.2101050001;*.32;*.220128762;*.220721329;*.1808312334;*.2102020001;*.230110883;*.60;*.85;*.99;*.484;*.486;*.524;*.528;*.653;*.663|All|*.*|"
Import_MESH cmd undefined
) else (messagebox "Failed to Locate Noesis!")
)
on btn_export pressed do (
if noesisComponentsFound() then (
cmd = ""
if chk_reWrite.checked then (
cmd = case currentItem of (
"RE2": getSaveFileName types:"RE2(*.1808312334)|*.1808312334|"
"DMC5": getSaveFileName types:"DMC5(*.1808282334)|*.1808282334|"
"RE3": getSaveFileName types:"RE3(*.1902042334)|*.1902042334|"
"RE4": getSaveFileName types:"RE4(*.221108797)|*.221108797|"
"RE7": getSaveFileName types:"RE7(*.32)|*.32|"
"RE7 RT": getSaveFileName types:"RE7 RT(*.220128762)|*.220128762|"
"RE8": getSaveFileName types:"RE8(*.2101050001)|*.2101050001|"
"MHRise": getSaveFileName types:"MHRise(*.2008058288)|*.2008058288|"
"MHRSunbreak": getSaveFileName types:"MHRSunbreak(*.2109148288)|*.2109148288|"
"RE2 RT": getSaveFileName types:"RT(*.2109108288)|*.2109108288|"
"RE3 RT": getSaveFileName types:"RT(*.2109108288)|*.2109108288|"
"SF6" : getSaveFileName types:"RT(*.230110883)|*.230110883|"
"REVerse" : getSaveFileName types:"REVerse(*.2102020001)|*.2102020001"
default: getSaveFileName types:" \
DMC5(*.1808282334)|*.1808282334| \
RE2(*.1808312334)|*.1808312334| \
RE3(*.1902042334)|*.1902042334| \
RE4(*.221108797)|*.221108797| \
RE7(*.32)|*.32| \
RE8(*.2101050001)|*.2101050001| \
RE7 RT(*.220128762)|*.220128762| \
RE2 RT(*.2109108288)|*.2109108288| \
RE3 RT(*.2109108288)|*.2109108288| \
MHRise(*.2008058288)|*.2008058288| \
MHRSunbreak(*.2109148288)|*.2109148288| \
SF6(*.230110883)|*.230110883| \
REVerse(*.2102020001)|*.2102020001| "
)
) else
cmd = getOpenFileName types:"RE Engine Model|*.1808282334;*.1902042334;*.221108797;*.2010231143;*.2008058288;*.2109148288;*.2109108288;*.2101050001;*.32;*.220128762;*.1808312334;*.220721329;*.2102020001;*.230110883|All|*.*|"
if cmd != undefined and cmd != "" then (
local fbx_path = (getFilenamePath cmd) + (getFilenameFile (getFilenameFile cmd))
local outtxt_path = fbx_path + ".txt"
fbx_path = fbx_path + ".fbx"
if chk_reWrite.checked then (
lbl_currentExt.caption = ".mesh" + (getFilenameType cmd)
--out_path = (getFilenamePath cmd) + (getFilenameFile (getFilenameFile cmd)) + lbl_currentExt.caption
out_path = cmd
) else
out_path = (getFilenamePath cmd) + (getFilenameFile (getFilenameFile cmd)) + ".NEW.mesh" + (getFilenameType cmd)
if findString (toLower fbx_path) ".ORIG.fbx" != undefined then (
newExtension = getFilenameType out_path
meshPath = (replace fbx_path (findString (toLower fbx_path) "ORIG.fbx") 8 ("mesh" + newExtension))
format "Changing file output from % to %\n" (getFilenameFile out_path) (getFilenameFile meshPath)
out_path = meshPath
)
for obj in selection as array where superclassof obj == GeometryClass do (
local parent = obj.parent
while parent != undefined do (
if superclassof parent != GeometryClass then
deselect parent
parent = parent.parent
)
)
originalSelection = selection as array
selectedBones = for obj in originalSelection where (superclassof obj == Helper or classof obj == BoneGeometry) collect obj
copyNodes = #()
format "Exporting with % bones selected\n" selectedBones.count
if not chk_manualBoneSelect.checked then ( -- or selectedBones.count == 0 then (
for obj in originalSelection where obj.modifiers[#Skin] != undefined do (
try (
selectSkeleton obj
if chk_writeBones.checked then ( --Create dummy mesh with all bones in skin modifier so that FBX will save all bones
maxOps.cloneNodes obj cloneType:#copy newNodes:©Nodes #nodialog
lastSelection = (selection as array); select copyNodes[1]; copyNodes[1].name = "FBXBoneStorage"
for bn in lastSelection do
if superclassof bn == Helper or classof bn == BoneGeometry then