-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui_.ms
2568 lines (2361 loc) · 101 KB
/
ui_.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
--///////////////////////////////////////// Notes ///////////////////////////////////////
-- C:\Program Files (x86)\Crytek\CRYENGINE Launcher\Crytek\CRYENGINE_5.0\Code\CryEngine\CryCommon\CryFile.h:
-- //////////////////////////////////////////////////////////////////////////
-- // Defines for CryEngine filetypes extensions.
-- //////////////////////////////////////////////////////////////////////////
-- #define CRY_GEOMETRY_FILE_EXT "cgf"
-- #define CRY_SKEL_FILE_EXT "chr" //will be a SKEL soon
-- #define CRY_SKIN_FILE_EXT "skin"
-- #define CRY_CHARACTER_ANIMATION_FILE_EXT "caf"
-- #define CRY_CHARACTER_DEFINITION_FILE_EXT "cdf"
-- #define CRY_CHARACTER_LIST_FILE_EXT "cid"
-- #define CRY_ANIM_GEOMETRY_FILE_EXT "cga"
-- #define CRY_ANIM_GEOMETRY_ANIMATION_FILE_EXT "anm"
-- #define CRY_COMPILED_FILE_EXT "(c)"
-- #define CRY_BINARY_XML_FILE_EXT "binxml"
-- #define CRY_XML_FILE_EXT "xml"
-- #define CRY_CHARACTER_PARAM_FILE_EXT "chrparams"
-- #define CRY_GEOM_CACHE_FILE_EXT "cax"
--////////////////////////////////////////////////////////////////////////////////////////
global g_scriptsDefault = getdir #scripts
global g_max_version = ((MaxVersion())[1])/1000
fn reset_max =
(
----------------------------------------------------------------------
resetMaxFile #noPrompt
actionMan.executeAction 0 "40829" -- show statistics
actionMan.executeAction -844228238 "12" -- Viewport Lighting and Shadows: High Quality
-- actionMan.executeAction -844228238 "15" -- DX Mode
----------------------------------------------------------------------
escapeEnable
----------------------------------------------------------------------
if GetQuietMode() then
(
SetQuietMode false --we want prompts enabled
)
)
if g_max_version >= 19 then --MAX 2017 or higher required
(
clearlistener()
Format "Max Version: %\n" g_max_version
-- TEST V2 We test turning this off, why really should we reset max? I think this is wrong
-- reset_max()
--//////////////////////////////// Script Checker (Runs on Startup ////////////////////////////////
--///////////////////////////////////////////////////////////////////////////////////////////////
---------------------------------------- ini Global - hardcoded filename ----------------------------------------
global g_iniFileName = "cryImporter_v3.ini"
global g_iniFile = ( pathConfig.ResolvePathSymbols (pathConfig.AppendPath sysInfo.tempdir g_iniFileName) )
--Create the ini file if it does not exist
if NOT doesfileexist ::g_iniFile then
(
try
(
global ini = createFile ::g_iniFile
close ini
)
catch
(
format "%" (getCurrentException())
)
)
if doesfileexist ::g_iniFile then
(
-------------------------------------------------------------------------------------------------------------------
global g_dirpath = "" -- Path to the GameSDK ( WITHOUT the slash \ or / )
global g_scriptRoot = ""
global g_includePath = ""
fn delete_ini =
(
if NOT deleteFile ::g_iniFile then
(
delIniSetting ::g_iniFile "paths" "scriptRoot" ::g_scriptRoot
delIniSetting ::g_iniFile "paths" "g_includePath" ::g_includePath
)
)
--/////////////////////////////////////////////////////////////////////////////////////////
try
(
g_dirPath = getINISetting ::g_iniFile "paths" "g_dirpath"
g_scriptRoot = getINISetting ::g_iniFile "paths" "scriptRoot"
g_includePath = getINISetting ::g_iniFile "paths" "g_includePath"
setINISetting ::g_iniFile "paths" "g_scriptsDefault" ::g_scriptsDefault
)
catch
(
format "%" (getCurrentException())
)
--/////////////////////////////////////////////////////////////////////////////////////////
g_dirpath = getINISetting g_iniFile "paths" "g_dirpath"
if g_dirpath == "" then
(
local set_dirPath = queryBox "You will now be asked to navigate to the root of your game folder (you will only do this once)...continue?"
if set_dirPath then
(
::g_dirpath = getSavePath caption:"Choose the Root for the Game (example \GameSDK\Ryse)"
if ::g_dirpath != undefined AND pathConfig.isLegalPath g_dirpath then
(
setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath
)
else
(
::g_dirpath = ""
)
)
else
(
::g_dirpath = ""
)
)
-------------------------------------------------------------------------------------------------------------------
if doesfileexist g_dirpath then
(
::g_scriptRoot = getINISetting ::g_iniFile "paths" "scriptRoot"
::g_includePath = getINISetting ::g_iniFile "paths" "g_includePath"
if ::g_scriptRoot == "" OR ::g_includePath == "" then
(
local set_scriptPath = queryBox "Navigate to the folder which contains this script that you are just running(you will only do this once)...continue?" beep:true
if set_scriptPath then
(
::g_scriptRoot = pathConfig.resolvePathSymbols ((getSavePath caption:"Choose Script Root Directory (the dir where you placed the scripts)" initialDir:sysinfo.currentDir))
::g_includePath = pathConfig.resolvePathSymbols (::g_scriptRoot + "\\include")
if ::g_scriptRoot != undefined AND ::g_includePath != undefined then
(
if doesFileExist ::g_includePath AND \
doesFileExist ( pathConfig.resolvePathSymbols (::g_scriptRoot + "\\ui_.ms") ) then
(
setINISetting ::g_iniFile "paths" "scriptRoot" ::g_scriptRoot
setINISetting ::g_iniFile "paths" "g_includePath" ::g_includePath
messageBox "All set, you are now ready to go - all settings are saved" title:"Success" beep:false
)
)
else
(
::g_scriptRoot = ""
::g_includePath = ""
)
)
else
(
::g_scriptRoot = ""
::g_includePath = ""
)
)
)
--/////////////////////////////////////////////////////////////////////////////////////////////////
--/////////////////////////////////////////////////////////////////////////////////////////////////
--////////////////////// Preprocessing - Checks that our includes do indeed exist //////////////////////
fn includes_Exist \
&includeDir: \
&include_files: = --we pass a pointer here
(
if symbolicPaths.isPathName "$scripts" then
(
)
else
(
return false;
)
local files = getFiles (includeDir + "*.*")
for f in files do
(
local fname = filenamefrompath f --strip the filename from the path (so we get only the filename + its suffix)
for inclF in include_files do
(
--At least one fail, will be enough to terminate the whole execution of this importer script
if (stricmp fname inclF) != 0 then
(
--//////////// We do a few backup checks, to keep it less rigorous and more tolerant ////////////
local deepCheck = findItem files fname
if deepCheck != 0 then
(
continue;
)
else --even less rigorous
(
local backupCheck = (matchpattern inclF pattern:"*"+fname+"*")
if backupCheck then
(
continue;
)
)
--Being more tolerant than the above is not desired
--///////////////////////////////////////////////////////////////////////////////////////////
------------------------------------------------ *** *** ***--------------------------------------------------
--*** *** *** Every check failed and the script will not be able to continue, because reaching this point, will lead to dependencies loading failure! *** *** ***
--*** *** *** This is serious, and will lead to a sure failure *** *** ***
format "WARNING - We could not confirm the existence of the include files - execution will be aborted\n"
return false;
------------------------------------------------ *** *** ***--------------------------------------------------
)
)
)
--if we came here, then all the include files are present, and we can include them
return true;
)
--//////////////////////////////////////////////////////////////////////////////////////////////////
if doesFileExist ::g_includePath AND \
doesFileExist ( pathConfig.resolvePathSymbols (::g_scriptRoot + "\\ui_.ms") ) AND \
(isDirectoryWriteable sysInfo.tempdir) then
(
try
(
----------------------------------------------------
--set the system script path to the chosen one (otherwise, the included files will not be found)
if (setdir #scripts ::g_includePath) then
(
----------------------------------------------------
format "----------------->::g_includePath: %\n" ::g_includePath
format "-----------------> getdir #scripts: %\n" (getdir #scripts)
--If we add more includes to our project (see include calls below), we must add them to this array as well
local include_files = #(
"HEADER_.ms", \
"Constants.ms", \
"general_functions_.ms", \
"build_resource_db_.ms", \
"CryMat_XMLB_headers_.ms", \
"CryMat_XMLB_.ms", \
"CryMat_XML_headers_.ms", \
"CryMat_XML_.ms", \
"store_reports_.ms", \
"cryxmlB_loader_.ms", \
"skinwrap_.ms", \
"create_bones_.ms", \
"BUILDERS_.ms", \
"init_Builders_.ms", \
"load_cryHeaders_.ms", \
"load_cryFile_.ms", \
"CAF_headers_.ms", \
"load_CAF_.ms", \
"load_chrparams_.ms", \
"cryFile_btn_loader_.ms" \
)
local FOUND_DEPENDENCIES = includes_Exist \
includeDir: &::g_includePath \
include_files: &include_files
--Preprocessing - Checks that our includes do indeed exist
if FOUND_DEPENDENCIES AND (getdir #scripts) == ::g_includePath then
(
--////////////////// Include //////////////////
include "include\\Constants.ms"
include "include\\HEADER_.ms"
include "include\\general_functions_.ms"
include "include\\build_resource_db_.ms"
include "include\\CryMat_XMLB_headers_.ms"
include "include\\CryMat_XML_headers_.ms"
include "include\\CryMat_XML_.ms"
include "include\\CryMat_XMLB_.ms"
include "include\\store_reports_.ms"
include "include\\cryxmlB_loader_.ms"
--////////////////////////////////////////////
try
(
--/////// Destroy dialogs and rollout clauses if applicable ///////
if ::cryImporter != undefined then
(
if iskindof ::cryImporter RolloutClass then
(
DestroyDialog ::cryImporter
)
)
if ::rollout_Tools != undefined then
(
if iskindof ::rollout_Tools RolloutClass then
(
DestroyDialog ::rollout_Tools
)
)
if ::rollout_options != undefined then
(
if iskindof ::rollout_options RolloutClass then
(
DestroyDialog ::rollout_options
)
)
if ::rollout_Mesh_Options != undefined then
(
if iskindof ::rollout_Mesh_Options RolloutClass then
(
DestroyDialog ::rollout_Mesh_Options
)
)
if ::rollout_Report != undefined then
(
if iskindof ::rollout_Report RolloutClass then
(
DestroyDialog ::rollout_Report
)
)
if ::rollout_animation != undefined then
(
if iskindof ::rollout_animation RolloutClass then
(
DestroyDialog ::rollout_animation
)
)
if ::rollout_About != undefined then
(
if iskindof ::rollout_About RolloutClass then
(
DestroyDialog ::rollout_About
)
)
if ::rollout_Alert != undefined then
(
if iskindof ::rollout_Alert RolloutClass then
(
DestroyDialog ::rollout_Alert
)
)
----------------------------The Rollout Floater ----------------------------
if ::CRYOP != undefined then
(
if iskindof ::CRYOP RolloutFloater then
(
closeRolloutFloater ::CRYOP
)
)
--//// End of Destroy dialogs and rollout clauses if applicable ////
)
catch
(
format "\n*** *** *** *** *** *** Could not destroy dialogs *** *** *** *** *** ***\n"
format "%" (getCurrentException())
format "*** *** *** *** *** *** END OF Could not destroy dialogs *** *** *** *** *** *** ***\n"
)
rollout cryImporter "Cryengine Importer" width:290 height:170 category:3
(
button 'btn_view_ini' "View ini" pos:[177,4] width:96 height:25 align:#left
button 'btn_delete_ini' "del" pos:[152,4] width:25 height:25 align:#left tooltip:"Delete ini file" images:#(( (getdir #maxSysIcons) + "Dark\\Grips\\Cancel_24.png" ), ( (getdir #maxSysIcons) + "Dark\\Grips\\Cancel_24.png" ), 1, 1, 1, 1, 1, false)
label 'lbl_version' "Cryengine Importer v 1.0" pos:[20,8] width:130 height:19 align:#left
button 'btn_gameDir' "Set Game Directory (GameSDK)..." pos:[8,37] width:265 height:25 toolTip:"This must be the root of your GameSDK for example ...\GameSDK\Ryse (note - do this only if you want to change the dir, this should be set correctly already" align:#left
button 'btn_Set_SkeletonListXML' "Set SkeletonList.xml..." pos:[8,62] width:265 height:25 toolTip:"This is done automatically - Default for example is ...\GameSDK\Ryse\Animations\SkeletonList.xml" align:#left
label 'lbl_skeletonList_Loaded' "" pos:[11,90] width:150 height:17 align:#left
button 'btn_print_SkeletonList' "Print Skeleton List" pos:[165,87] width:108 height:25 align:#left
button 'btn_clearConsole' "Clear Console" pos:[165,112] width:108 height:25 align:#left
checkbox 'chk_skip_chr' "Don't load .chr" pos:[13,115] width:120 height:19 enabled:true checked:true align:#left
checkbox 'chk_Force_2_Base_Skeleton' "Force to Base Skeleton" pos:[13,135] width:150 height:19 enabled:true checked:true align:#left tooltip:"Recommended ON - but if you want to load multiple skeletons into a scene, then turn this off"
checkbox 'chk_reset' "Reset before skin load" pos:[13,155] width:120 height:19 enabled:true checked:false align:#left
button 'btn_import' "LOAD CryFile..." pos:[8,118+60] width:265 height:40 toolTip:"Load CryFile (.cgf, .cgfm, .cga, .cgam, .chr, .chrm, .skin, .skinm)" align:#left
button 'btn_Load_CDF' "LOAD Character Definition..." pos:[8,158+60] width:265 height:40 toolTip:"This loads the Character Definition File ( .cdf )" align:#left
checkbox 'chk_deleteISOvertices' "Delete Isolated Vertices" pos:[13,265] width:259 height:19 enabled:true checked:true align:#left
checkbox 'chk_Dont_Load_Skeleton' "Don't Load Skeleton" pos:[13,285] width:259 height:19 enabled:true checked:false align:#left
checkbox 'chk_Skip_LOD_Materials' "Skip $Lod Materials" pos:[13,305] width:125 height:19 enabled:true checked:false align:#left
checkbox 'chk_Skip_Proxy_Materials' "Skip Proxy Materials" pos:[150,305] width:252 height:19 enabled:false checked:false align:#left visible:false
dropdownList 'ddl_CryGame' "CryEngine Game" pos:[8,340] width:265 height:40 items:#("Ryse", "Crysis(wip)", "Crysis 2(wip)", "Crysis 3(wip)", "Crysis Warhead(wip)", "Crysis Wars(wip)", "State of Decay(wip)", "HFR", "Armored Warfare", "KCD") align:#left enabled:true selection:1
--////////////////// Include //////////////////
include "include\\skinwrap_.ms"
include "include\\create_bones_.ms"
include "include\\BUILDERS_.ms"
include "include\\init_Builders_.ms"
include "include\\load_cryHeaders_.ms"
include "include\\load_cryFile_.ms"
include "include\\CAF_headers_.ms"
include "include\\load_CAF_.ms"
include "include\\load_chrparams_.ms"
include "include\\cryFile_btn_loader_.ms"
--/////////////////////////////////////////////
on cryImporter open do
(
update_dirPath \
context:"global"
if ::g_auto_resourcelist_array.count == 0 then
(
::g_auto_resourcelist_array = getFilesRecursive \
root: (::g_dirPath) \
specDir: "Levels" \
targetFile: "auto_resourcelist.txt"
)
if (setdir #scripts ::g_scriptsDefault) then
(
format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
)
else
(
format "Current #scripts dir: %\n" (getdir #scripts)
)
format "-----------------------------::g_scriptRoot: % -----------------------------\n" ::g_scriptRoot
::g_CryGame_dropDown_selection = ddl_CryGame.items[ddl_CryGame.selection]
::g_skip_Lod_Materials = chk_skip_Lod_Materials.state
::g_Dont_Load_Skeleton = chk_Dont_Load_Skeleton.state
::g_dirpath = getINISetting ::g_iniFile "paths" "g_dirpath"
local skeleton_xml_path = ""
--////////////////////////// Set SkeletonList.xml and also attempt to read it into an array ///////////////////////////
if pathConfig.isLegalPath ::g_dirpath then
(
local skeleton_xml_path = pathConfig.appendPath ::g_dirpath ::g_SkeletonList_xml_NAME
if skeleton_xml_path != undefined then
(
format "Will try to find and read: %\n" skeleton_xml_path
if doesfileexist skeleton_xml_path then
(
setINISetting ::g_iniFile "paths" "SkeletonList" skeleton_xml_path
inst_xmlB_PROCESSOR = xmlB_PROCESSOR()
--XML
if (stricmp (getFilenameType skeleton_xml_path) ".xml") == 0 then
(
if Binary_XML_check skeleton_xml_path then
(
global g_inst_stored_SkeletonList_XML = stored_SkeletonList_XML ()
format "Attempting to read: %\n" (getFilenameType skeleton_xml_path)
inst_xmlB_PROCESSOR.cry_general_xmlB_ReaderV \
xmlBFile: skeleton_xml_path \
inst_s_OPTIONS: inst_s_OPTIONS \
type: ".xml"
btn_print_SkeletonList.enabled = true
skeleton_xml_path = ""
::cryImporter.lbl_skeletonList_Loaded.text = "Skeleton List has been loaded"
)
else
(
btn_print_SkeletonList.enabled = false
format "This is not a valid xmlB file, aborting!: %\n" skeleton_xml_path
::cryImporter.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
)
)
else
(
btn_print_SkeletonList.enabled = false
format "The suffix of the SkeletonList is not .xml: %\n" skeleton_xml_path
::cryImporter.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
)
)
else
(
btn_print_SkeletonList.enabled = false
format "Cannot find: %\n" skeleton_xml_path
::cryImporter.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
)
)
else
(
btn_print_SkeletonList.enabled = false
format "Could not find: %\n" skeleton_xml_path
::cryImporter.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
)
)
--///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
format "g_skip_Lod_Materials: %\n" ::g_skip_Lod_Materials
format "\nGame selected: --------- % ---------\n" ::g_CryGame_dropDown_selection
format "Skeleton List Path: %\n" (pathConfig.appendPath ::g_dirpath ::g_SkeletonList_xml_NAME)
format "g_Dont_Load_Skeleton: %\n" ::g_Dont_Load_Skeleton
format "======= GameSDK path: % =======\n" ::g_dirpath
)
on cryImporter close do
(
if (setdir #scripts ::g_scriptsDefault) then
(
format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
)
else
(
format "Current #scripts dir: %\n" (getdir #scripts)
)
gc()
)
on cryImporter rolledUp state do
(
if NOT state then
(
--closed
CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-cryImporter.height]
)
else
(
--open
CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+cryImporter.height]
)
)
on btn_delete_ini pressed do
(
if (queryBox "This will delete your settings, are you sure you want to continue?") then
(
if (deleteFile ::g_iniFile) then
(
format "% deleted!\n" ::g_iniFile
)
else
(
format "Could not delete % \n" ::g_iniFile
)
)
)
on btn_gameDir pressed do
(
startDir = undefined
g_dirpath = getINISetting ::g_iniFile "paths" "g_dirpath"
if pathConfig.isLegalPath g_dirpath then
(
startDir = g_dirpath
::g_dirpath = getSavePath caption:"Choose Game directory" initialDir:startDir
)
else
(
::g_dirpath = getSavePath caption:"Choose Game directory"
)
--Reread Skeleton List
if ::g_dirpath != undefined then
(
if pathConfig.isLegalPath g_dirpath then
(
setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath
--Set the gamedir for the currently selected game
setINISetting ::g_iniFile "gameDirs" ::g_CryGame_dropDown_selection ::g_dirpath
local skeleton_xml_path = pathConfig.appendPath ::g_dirpath ::g_SkeletonList_xml_NAME
if skeleton_xml_path != undefined then
(
format "Will try to find and read: %\n" skeleton_xml_path
if doesfileexist skeleton_xml_path then
(
setINISetting ::g_iniFile "paths" "SkeletonList" skeleton_xml_path
inst_xmlB_PROCESSOR = xmlB_PROCESSOR()
--XML
if (stricmp (getFilenameType skeleton_xml_path) ".xml") == 0 then
(
if Binary_XML_check skeleton_xml_path then
(
::g_inst_stored_SkeletonList_XML = stored_SkeletonList_XML ()
format "Attempting to read: %\n" (getFilenameType skeleton_xml_path)
inst_xmlB_PROCESSOR.cry_general_xmlB_ReaderV \
xmlBFile: skeleton_xml_path \
inst_s_OPTIONS: inst_s_OPTIONS \
type: ".xml"
btn_print_SkeletonList.enabled = true
skeleton_xml_path = ""
::cryImporter.lbl_skeletonList_Loaded.text = "Skeleton List has been loaded"
)
)
)
else
(
btn_print_SkeletonList.enabled = false
::cryImporter.lbl_skeletonList_Loaded.text = "Skeleton List could not be found"
)
)
)
)
)
on btn_Set_SkeletonListXML pressed do
(
startDir = undefined
::g_dirpath = getINISetting ::g_iniFile "paths" "g_dirpath"
if pathConfig.isLegalPath ::g_dirpath then
(
startDir = ::g_dirpath
SkeletonList_xml_PATH = getOpenFileName \
caption:"cgf/chr/cgfm Model File" \
types:"CryTek Model File (*.xml)|*.xml" historyCategory:"CryTek ObjectPresets" initialDir:startDir
if SkeletonList_xml_PATH != undefined then
(
if doesfileexist SkeletonList_xml_PATH then
(
setINISetting ::g_iniFile "paths" "SkeletonList" SkeletonList_xml_PATH
::g_SkeletonList_xml_NAME = filenameFromPath SkeletonList_xml_PATH
)
)
)
else
(
::g_dirpath = getSavePath caption:"Choose Game directory"
if ::g_dirpath != undefined AND pathConfig.isLegalPath g_dirpath then
(
setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath
startDir = ::g_dirpath
SkeletonList_xml_PATH = getOpenFileName \
caption:"cgf/chr/cgfm Model File" \
types:"CryTek Model File (*.xml)|*.xml" historyCategory:"CryTek ObjectPresets" initialDir:startDir
if SkeletonList_xml_PATH != undefined then
(
if doesfileexist SkeletonList_xml_PATH then
(
setINISetting ::g_iniFile "paths" "SkeletonList" SkeletonList_xml_PATH
::g_SkeletonList_xml_NAME = filenameFromPath SkeletonList_xml_PATH
)
)
)
)
)
on btn_print_SkeletonList pressed do
(
print_SkeletonList \
SkeletonList:&::g_inst_stored_SkeletonList_XML
)
on btn_clearConsole pressed do
(
clearlistener()
)
on btn_import pressed do --kcd
(
if GetQuietMode() == false then
(
SetQuietMode true --we want prompts enabled
)
get_game_dirPath()
update_dirPath()
if NOT (doesfileexist g_dirpath) then
(
confirm = yesNoCancelBox "You must choose a root game directory, do you want to do it now?" \
title:"WARNING" \
beep:true
if confirm == #yes then
(
::g_dirpath = getSavePath caption:"Choose Game directory"
if ::g_dirpath != undefined AND pathConfig.isLegalPath g_dirpath then
(
setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath
--Set the gamedir for the default selected game
setINISetting ::g_iniFile "gameDirs" g_cryFile ddl_CryGame.items[ddl_CryGame.selection]
)
)
)
else
(
g_cryFile = getOpenFileName \
caption:"cgf/chr/cgfm Model File" \
types:"CryTek Model File (*.cgf)|*.cgf|(*.cga)|*.cga|(*.cgam)|*.cgam|(*.cgfm)|*.cgfm|(*.chr)|*.chr|(*.cdf)|*.cdf|(*.skin)|*.skin|(*.skinm)|*.skinm|(*.chrm)|*.chrm|(*.caf)|*.caf|(*.img)|*.img|All (*.*)|*.*" \
historyCategory:"CryTek ObjectPresets"
if ddl_CryGame.selected == "Ryse" then
(
if g_cryFile != undefined then
(
if doesfileexist g_cryFile then
(
--Set the gamedir to the global as well -- See function in HEADER_.ms
get_game_dirPath()
if ((getFilenameType g_cryFile) == ".cgf") OR ((getFilenameType g_cryFile) == ".cgfm") then
(
if NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
(
format "This is not a valid CryTek file, aborting!\n"
)
else
(
---------------------------- Create Instance Structs ----------------------------
--We start this storage here
local inst_Sub_Meshes = Sub_Meshes()
local inst_CDF_Attachment = CDF_Attachment() --create instance of Attachment nodes
local inst_CDF_Modifiers = CDF_Modifiers() --create instance of Modifiers nodes
local inst_CDF_Model = CDF_Model()
--------------------------------------------------------------------------------------
setINISetting ::g_iniFile "boneinfo" "has_bones" "0"
cryFile_loader inst_Sub_Meshes: &inst_Sub_Meshes \
g_cryFile: &g_cryFile \
inst_Sub_Meshes: &inst_Sub_Meshes \
inst_CDF_Model: &inst_CDF_Model \
inst_CDF_Attachment: &inst_CDF_Attachment \
inst_CDF_Modifiers: &inst_CDF_Modifiers
)
)
if ((getFilenameType g_cryFile) == ".cga") OR ((getFilenameType g_cryFile) == ".cgam") then
(
if NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
(
format "This is not a valid CryTek file, aborting!\n"
)
else
(
---------------------------- Create Instance Structs ----------------------------
--We start this storage here
local inst_Sub_Meshes = Sub_Meshes()
local inst_CDF_Attachment = CDF_Attachment() --create instance of Attachment nodes
local inst_CDF_Modifiers = CDF_Modifiers() --create instance of Modifiers nodes
local inst_CDF_Model = CDF_Model()
--------------------------------------------------------------------------------------
cryFile_loader \
inst_Sub_Meshes: &inst_Sub_Meshes \
g_cryFile: &g_cryFile \
inst_Sub_Meshes: &inst_Sub_Meshes \
inst_CDF_Model: &inst_CDF_Model \
inst_CDF_Attachment: &inst_CDF_Attachment \
inst_CDF_Modifiers: &inst_CDF_Modifiers
)
)
else if ((getFilenameType g_cryFile) == ".skin") OR ((getFilenameType g_cryFile) == ".skinm") then
(
if NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
(
format "This is not a valid CryTek file, aborting!\n"
)
else
(
if chk_reset.state then
(
reset_max()
)
Reset_Arrays()
Reset_BoneNodes_arrays()
---------------------------- Create Instance Structs ----------------------------
--We start this storage here
local inst_Sub_Meshes = Sub_Meshes()
local inst_CDF_Attachment = CDF_Attachment() --create instance of Attachment nodes
local inst_CDF_Modifiers = CDF_Modifiers() --create instance of Modifiers nodes
local inst_CDF_Model = CDF_Model()
--------------------------------------------------------------------------------------
cryFile_loader \
inst_Sub_Meshes: &inst_Sub_Meshes \
g_cryFile: &g_cryFile \
inst_Sub_Meshes: &inst_Sub_Meshes \
inst_CDF_Model: &inst_CDF_Model \
inst_CDF_Attachment: &inst_CDF_Attachment \
inst_CDF_Modifiers: &inst_CDF_Modifiers
)
)
else if ((getFilenameType g_cryFile) == ".chr") OR ((getFilenameType g_cryFile) == ".chrm") then
(
if NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
(
format "This is not a valid CryTek file, aborting!\n"
)
else
(
if chk_reset.state then
(
reset_max()
)
Reset_Arrays()
Reset_BoneNodes_arrays()
---------------------------- Create Instance Structs ----------------------------
--We start this storage here
local inst_Sub_Meshes = Sub_Meshes()
local inst_CDF_Attachment = CDF_Attachment() --create instance of Attachment nodes
local inst_CDF_Modifiers = CDF_Modifiers() --create instance of Modifiers nodes
local inst_CDF_Model = CDF_Model()
--------------------------------------------------------------------------------------
cryFile_loader \
inst_Sub_Meshes: &inst_Sub_Meshes \
g_cryFile: &g_cryFile \
inst_Sub_Meshes: &inst_Sub_Meshes \
inst_CDF_Model: &inst_CDF_Model \
inst_CDF_Attachment: &inst_CDF_Attachment \
inst_CDF_Modifiers: &inst_CDF_Modifiers
)
)
else if ((getFilenameType g_cryFile) == ".skel") OR ((getFilenameType g_cryFile) == ".skelm") then
(
if NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
(
format "This is not a valid CryTek file, aborting!\n"
)
else
(
if chk_reset.state then
(
reset_max()
)
Reset_Arrays()
Reset_BoneNodes_arrays()
---------------------------- Create Instance Structs ----------------------------
--We start this storage here
local inst_Sub_Meshes = Sub_Meshes()
local inst_CDF_Attachment = CDF_Attachment() --create instance of Attachment nodes
local inst_CDF_Modifiers = CDF_Modifiers() --create instance of Modifiers nodes
local inst_CDF_Model = CDF_Model()
--------------------------------------------------------------------------------------
cryFile_loader \
inst_Sub_Meshes: &inst_Sub_Meshes \
g_cryFile: &g_cryFile \
inst_Sub_Meshes: &inst_Sub_Meshes \
inst_CDF_Model: &inst_CDF_Model \
inst_CDF_Attachment: &inst_CDF_Attachment \
inst_CDF_Modifiers: &inst_CDF_Modifiers
)
)
else if ((getFilenameType g_cryFile) == ".caf") then
(
if NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
(
format "This is not a valid CryTek file, aborting!\n"
)
else
(
cryFile_loader \
g_cryFile: &g_cryFile \
caller: (getFilenameType g_cryFile)
)
)
else if ((getFilenameType g_cryFile) == ".img") then
(
if NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
(
format "This is not a valid CryTek file, aborting!\n"
)
else
(
cryFile_loader \
g_cryFile: &g_cryFile \
caller: (getFilenameType g_cryFile)
)
)
else if (getFilenameType g_cryFile) == ".cdf" then
(
if NOT (Binary_XML_check g_cryFile) then --if the xml file is not Crytek Binary XML
(
format "This is not a valid CryXmlB file, aborting!\n"
)
else
(
if chk_reset.state then
(
reset_max()
)
Reset_Arrays()
Reset_BoneNodes_arrays()
---------------------------- Create Instance Structs ----------------------------
--We start this storage here
local inst_Sub_Meshes = Sub_Meshes()
local inst_CDF_Attachment = CDF_Attachment() --create instance of Attachment nodes
local inst_CDF_Modifiers = CDF_Modifiers() --create instance of Modifiers nodes
local inst_CDF_Model = CDF_Model()
--------------------------------------------------------------------------------------
cryxmlB_loader \
g_MaterialRef_Bool: &g_MaterialRef_Bool
)
)
)
)
)
else if ddl_CryGame.selected == "Crysis" then
(
if g_cryFile != undefined then
(
if doesfileexist g_cryFile then
(
--Set the gamedir to the global as well -- See function in HEADER_.ms
get_game_dirPath()
if ((getFilenameType g_cryFile) == ".cgf") then
(
if NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
(
format "This is not a valid CryTek file, aborting!\n"
)
else
(
---------------------------- Create Instance Structs ----------------------------
--We start this storage here
local inst_Sub_Meshes = Sub_Meshes()
local inst_CDF_Attachment = CDF_Attachment() --create instance of Attachment nodes
local inst_CDF_Modifiers = CDF_Modifiers() --create instance of Modifiers nodes
local inst_CDF_Model = CDF_Model()
--------------------------------------------------------------------------------------
cryFile_loader \
inst_Sub_Meshes: &inst_Sub_Meshes \
g_cryFile: &g_cryFile \
inst_Sub_Meshes: &inst_Sub_Meshes \
inst_CDF_Model: &inst_CDF_Model \
inst_CDF_Attachment: &inst_CDF_Attachment \
inst_CDF_Modifiers: &inst_CDF_Modifiers
)
)
)
)
)
else if ddl_CryGame.selected == "HFR" then
(
if g_cryFile != undefined then
(
if doesfileexist g_cryFile then
(
--Set the gamedir to the global as well -- See function in HEADER_.ms
get_game_dirPath()
if ((getFilenameType g_cryFile) == ".cgf") OR ((getFilenameType g_cryFile) == ".cgfm") then
(
if NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
(
format "This is not a valid CryTek file, aborting!\n"
)
else
(
---------------------------- Create Instance Structs ----------------------------
--We start this storage here
local inst_Sub_Meshes = Sub_Meshes()
local inst_CDF_Attachment = CDF_Attachment() --create instance of Attachment nodes
local inst_CDF_Modifiers = CDF_Modifiers() --create instance of Modifiers nodes
local inst_CDF_Model = CDF_Model()
--------------------------------------------------------------------------------------
cryFile_loader \
inst_Sub_Meshes: &inst_Sub_Meshes \
g_cryFile: &g_cryFile \
inst_Sub_Meshes: &inst_Sub_Meshes \
inst_CDF_Model: &inst_CDF_Model \
inst_CDF_Attachment: &inst_CDF_Attachment \
inst_CDF_Modifiers: &inst_CDF_Modifiers
)
)
if ((getFilenameType g_cryFile) == ".cga") OR ((getFilenameType g_cryFile) == ".cgam") then
(
if NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
(
format "This is not a valid CryTek file, aborting!\n"
)
else
(
---------------------------- Create Instance Structs ----------------------------
--We start this storage here
local inst_Sub_Meshes = Sub_Meshes()
local inst_CDF_Attachment = CDF_Attachment() --create instance of Attachment nodes
local inst_CDF_Modifiers = CDF_Modifiers() --create instance of Modifiers nodes
local inst_CDF_Model = CDF_Model()
--------------------------------------------------------------------------------------
cryFile_loader \
inst_Sub_Meshes: &inst_Sub_Meshes \
g_cryFile: &g_cryFile \
inst_Sub_Meshes: &inst_Sub_Meshes \
inst_CDF_Model: &inst_CDF_Model \
inst_CDF_Attachment: &inst_CDF_Attachment \
inst_CDF_Modifiers: &inst_CDF_Modifiers
)
)