home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 11459 / CryImport.7z / ui_.ms
Encoding:
Text File  |  2016-08-02  |  82.4 KB  |  2,097 lines

  1. --joqqyhez@gmail.com
  2.  
  3. --/////////////////////////////////////////  Notes /////////////////////////////////////// 
  4.  
  5. -- C:\Program Files (x86)\Crytek\CRYENGINE Launcher\Crytek\CRYENGINE_5.0\Code\CryEngine\CryCommon\CryFile.h:
  6. -- //////////////////////////////////////////////////////////////////////////
  7. -- // Defines for CryEngine filetypes extensions.
  8. -- //////////////////////////////////////////////////////////////////////////
  9. -- #define CRY_GEOMETRY_FILE_EXT                                        "cgf"
  10. -- #define CRY_SKEL_FILE_EXT                                                "chr" //will be a SKEL soon
  11. -- #define CRY_SKIN_FILE_EXT                                                "skin"
  12. -- #define CRY_CHARACTER_ANIMATION_FILE_EXT                     "caf"
  13. -- #define CRY_CHARACTER_DEFINITION_FILE_EXT                    "cdf"
  14. -- #define CRY_CHARACTER_LIST_FILE_EXT                              "cid"
  15. -- #define CRY_ANIM_GEOMETRY_FILE_EXT                               "cga"
  16. -- #define CRY_ANIM_GEOMETRY_ANIMATION_FILE_EXT             "anm"
  17. -- #define CRY_COMPILED_FILE_EXT                                        "(c)"
  18. -- #define CRY_BINARY_XML_FILE_EXT                                      "binxml"
  19. -- #define CRY_XML_FILE_EXT                                                 "xml"
  20. -- #define CRY_CHARACTER_PARAM_FILE_EXT                             "chrparams"
  21. -- #define CRY_GEOM_CACHE_FILE_EXT                                      "cax"
  22.  
  23. --////////////////////////////////////////////////////////////////////////////////////////
  24.  
  25. global g_scriptsDefault         = getdir #scripts
  26. global g_max_version             = ((MaxVersion())[1])/1000
  27.  
  28. fn reset_max =
  29. (
  30.     ----------------------------------------------------------------------
  31.     resetMaxFile #noPrompt
  32.     actionMan.executeAction 0 "40829"             -- show statistics
  33.     actionMan.executeAction -844228238 "12"      -- Viewport Lighting and Shadows: High Quality
  34.     ----------------------------------------------------------------------
  35.     escapeEnable
  36.     ----------------------------------------------------------------------
  37.     
  38.     if GetQuietMode() then
  39.     (
  40.         SetQuietMode false --we want prompts enabled
  41.     )
  42. )
  43.  
  44. if  g_max_version >= 19 then
  45. (
  46.     clearlistener()
  47.     
  48.     Format "Max Version: %\n" g_max_version
  49.  
  50.     reset_max()
  51.  
  52.     --//////////////////////////////// Script Checker (Runs on Startup ////////////////////////////////
  53.     --///////////////////////////////////////////////////////////////////////////////////////////////
  54.     ---------------------------------------- ini Global - hardcoded filename ----------------------------------------
  55.     global g_iniFileName                 = "cryimport_v3.ini"
  56.     global g_iniFile                         = (    pathConfig.ResolvePathSymbols (pathConfig.AppendPath     sysInfo.tempdir     g_iniFileName)    )
  57.     
  58.     --Create the ini file if it does not exist
  59.     if NOT doesfileexist ::g_iniFile then
  60.     (
  61.         try
  62.         (
  63.             global ini = createFile ::g_iniFile
  64.             close ini
  65.         )
  66.         catch
  67.         (
  68.             format "%" (getCurrentException())
  69.         )
  70.     )
  71.     
  72.     if doesfileexist ::g_iniFile then
  73.     (
  74.         -------------------------------------------------------------------------------------------------------------------    
  75.         global g_dirpath                 = "" -- Path to the GameSDK ( WITHOUT the slash \ or / )
  76.         global g_scriptRoot             = ""
  77.         global g_includePath         = ""    
  78.         fn delete_ini =
  79.         (
  80.             if NOT deleteFile ::g_iniFile then
  81.             (
  82.                 delIniSetting     ::g_iniFile     "paths" "scriptRoot"             ::g_scriptRoot
  83.                 delIniSetting     ::g_iniFile     "paths" "g_includePath"     ::g_includePath
  84.             )
  85.         )
  86.         --/////////////////////////////////////////////////////////////////////////////////////////
  87.         try
  88.         (
  89.             g_dirPath                     = getINISetting     ::g_iniFile     "paths"     "g_dirpath"
  90.             g_scriptRoot                 = getINISetting     ::g_iniFile     "paths"     "scriptRoot"
  91.             g_includePath                 = getINISetting     ::g_iniFile     "paths"     "g_includePath"
  92.             
  93.             setINISetting     ::g_iniFile         "paths"         "g_scriptsDefault"         ::g_scriptsDefault
  94.         )
  95.         catch
  96.         (
  97.             format "%" (getCurrentException())
  98.         )
  99.         --/////////////////////////////////////////////////////////////////////////////////////////
  100.         
  101.         
  102.         g_dirpath                         = getINISetting     g_iniFile     "paths" "g_dirpath"    
  103.         if g_dirpath == "" then
  104.         (
  105.             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?"
  106.             
  107.             if set_dirPath then
  108.             (
  109.                 ::g_dirpath         = getSavePath caption:"Choose the Root for the Game (example \GameSDK\Ryse)"                    
  110.                 if ::g_dirpath != undefined AND pathConfig.isLegalPath g_dirpath then
  111.                 (
  112.                     setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath
  113.                 )
  114.                 else
  115.                 (
  116.                     ::g_dirpath             = ""
  117.                 )
  118.             )
  119.             else
  120.             (
  121.                 ::g_dirpath             = ""
  122.             )
  123.         )
  124.         -------------------------------------------------------------------------------------------------------------------
  125.  
  126.         if doesfileexist g_dirpath then
  127.         (
  128.             ::g_scriptRoot                 = getINISetting     ::g_iniFile     "paths"     "scriptRoot"
  129.             ::g_includePath                 = getINISetting     ::g_iniFile     "paths"     "g_includePath"
  130.  
  131.             if ::g_scriptRoot == "" OR ::g_includePath == ""  then
  132.             (
  133.                 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
  134.                 
  135.                 if set_scriptPath then
  136.                 (
  137.                     ::g_scriptRoot             = pathConfig.resolvePathSymbols ((getSavePath caption:"Choose Script Root Directory (the dir where you placed the scripts)" initialDir:sysinfo.currentDir))
  138.                     ::g_includePath             = pathConfig.resolvePathSymbols (::g_scriptRoot + "\\include")
  139.                     
  140.                     if ::g_scriptRoot != undefined AND ::g_includePath != undefined then
  141.                     (    
  142.                         if     doesFileExist ::g_includePath AND \            
  143.                             doesFileExist (    pathConfig.resolvePathSymbols (::g_scriptRoot + "\\ui_.ms")    ) then
  144.                         (
  145.                             setINISetting     ::g_iniFile     "paths" "scriptRoot"             ::g_scriptRoot
  146.                             setINISetting     ::g_iniFile     "paths" "g_includePath"     ::g_includePath
  147.                             
  148.                             messageBox "All set, you are now ready to go - all settings are saved" title:"Success" beep:false
  149.                         )
  150.                     )
  151.                     else
  152.                     (
  153.                         ::g_scriptRoot             = ""
  154.                         ::g_includePath             = ""
  155.                     )
  156.                 )
  157.                 else
  158.                 (
  159.                     ::g_scriptRoot             = ""
  160.                     ::g_includePath             = ""
  161.                 )
  162.             )
  163.         )
  164.         --/////////////////////////////////////////////////////////////////////////////////////////////////
  165.         --/////////////////////////////////////////////////////////////////////////////////////////////////
  166.  
  167.  
  168.         --////////////////////// Preprocessing - Checks that our includes do indeed exist //////////////////////
  169.         fn includes_Exist \
  170.                                 &includeDir: \                        
  171.                                 &include_files: = --we pass a pointer here
  172.         (
  173.             if symbolicPaths.isPathName "$scripts" then
  174.             (
  175.             )
  176.             else
  177.             (
  178.                 return false;
  179.             )
  180.             
  181.             local files = getFiles (includeDir + "*.*")
  182.             
  183.             for f in files do
  184.             (
  185.                 local fname = filenamefrompath f --strip the filename from the path (so we get only the filename + its suffix)
  186.                     
  187.                 for inclF in include_files do
  188.                 (
  189.                     --At least one fail, will be enough to terminate the whole execution of this importer script
  190.                     if (stricmp fname inclF) != 0 then
  191.                     (
  192.                         --//////////// We do a few backup checks, to keep it less rigorous and more tolerant ////////////
  193.                         local deepCheck = findItem files fname
  194.                         if deepCheck != 0 then
  195.                         (
  196.                             continue;
  197.                         )
  198.                         else --even less rigorous
  199.                         (
  200.                             local backupCheck = (matchpattern inclF pattern:"*"+fname+"*")
  201.                             if backupCheck then
  202.                             (
  203.                                 continue;
  204.                             )                        
  205.                         )
  206.                         --Being more tolerant than the above is not desired
  207.                         --///////////////////////////////////////////////////////////////////////////////////////////
  208.                         
  209.                         ------------------------------------------------ *** *** ***--------------------------------------------------
  210.                         --*** *** *** Every check failed and the script will not be able to continue, because reaching this point, will lead to dependencies loading failure! *** *** ***
  211.                         --*** *** *** This is serious, and will lead to a sure failure *** *** ***
  212.                         format "WARNING - We could not confirm the existence of the include files - execution will be aborted\n"                    
  213.                         return false;
  214.                         ------------------------------------------------ *** *** ***--------------------------------------------------
  215.                     )
  216.                 )            
  217.             )
  218.             --if we came here, then all the include files are present, and we can include them
  219.             return true;
  220.         )
  221.         --//////////////////////////////////////////////////////////////////////////////////////////////////
  222.  
  223.  
  224.         if     doesFileExist ::g_includePath AND \
  225.             doesFileExist ( pathConfig.resolvePathSymbols (::g_scriptRoot + "\\ui_.ms") ) AND \
  226.             (isDirectoryWriteable sysInfo.tempdir) then
  227.         (
  228.             try
  229.             (                
  230.                 ----------------------------------------------------
  231.                 --set the system script path to the chosen one (otherwise, the included files will not be found)
  232.                 if (setdir #scripts ::g_includePath)    then
  233.                 (
  234.                     ----------------------------------------------------                
  235.                     format "----------------->::g_includePath: %\n" ::g_includePath
  236.                     format "-----------------> getdir #scripts: %\n" (getdir #scripts)
  237.                     --If we add more includes to our project (see include calls below), we must add them to this array as well
  238.                     local include_files = #(
  239.                                                     "HEADER_.ms", \
  240.                                                     "general_functions_.ms", \
  241.                                                     "build_resource_db_.ms", \                                                    
  242.                                                     "CryMat_XML_headers_.ms", \
  243.                                                     "CryMat_XML_.ms", \
  244.                                                     "CryMat_XMLB_headers_.ms", \
  245.                                                     "CryMat_XMLB_.ms", \
  246.                                                     "cryxmlB_loader_.ms", \
  247.                                                     
  248.                                                     "skinwrap_.ms", \
  249.                                                     "create_bones_.ms", \
  250.                                                     "load_cryHeaders_.ms", \
  251.                                                     "load_cryFile_.ms", \                                            
  252.                                                     "CAF_headers_.ms", \
  253.                                                     "load_CAF_.ms", \
  254.                                                     "cryFile_btn_loader_.ms" \
  255.                                                 )    
  256.                                                 
  257.                     local FOUND_DEPENDENCIES = includes_Exist \
  258.                                                                                     includeDir:        &::g_includePath \
  259.                                                                                     include_files:    &include_files
  260.                         
  261.                     --Preprocessing - Checks that our includes do indeed exist        
  262.                     if FOUND_DEPENDENCIES AND \
  263.                         (getdir #scripts) == ::g_includePath  then
  264.                     (            
  265.                         --////////////////// Include //////////////////                        
  266.                         include "HEADER_.ms"
  267.                         include "general_functions_.ms"
  268.                         include "build_resource_db_.ms"                        
  269.                         include "CryMat_XML_headers_.ms"
  270.                         include "CryMat_XML_.ms"
  271.                         include "CryMat_XMLB_headers_.ms"
  272.                         include "CryMat_XMLB_.ms"
  273.                         include "cryxmlB_loader_.ms"
  274.                         --////////////////////////////////////////////
  275.  
  276.                         try
  277.                         (
  278.                             --/////// Destroy dialogs and rollout clauses if applicable ///////                    
  279.                             if ::cryImport != undefined then
  280.                             (
  281.                                 if iskindof ::cryImport RolloutClass then
  282.                                 (
  283.                                     DestroyDialog             ::cryImport
  284.                                 )
  285.                             )
  286.                             if ::rollout_Tools != undefined then
  287.                             (
  288.                                 if iskindof ::rollout_Tools RolloutClass then
  289.                                 (
  290.                                     DestroyDialog             ::rollout_Tools
  291.                                 )
  292.                             )                            
  293.                             if ::rollout_options != undefined then
  294.                             (
  295.                                 if iskindof ::rollout_options RolloutClass then
  296.                                 (
  297.                                     DestroyDialog             ::rollout_options
  298.                                 )
  299.                             )
  300.                             if ::rollout_Report != undefined then
  301.                             (
  302.                                 if iskindof ::rollout_Report RolloutClass then
  303.                                 (
  304.                                     DestroyDialog             ::rollout_Report
  305.                                 )
  306.                             )
  307.                             if ::rollout_animation != undefined then
  308.                             (
  309.                                 if iskindof ::rollout_animation RolloutClass then
  310.                                 (
  311.                                     DestroyDialog             ::rollout_animation
  312.                                 )
  313.                             )
  314.                             if ::rollout_About != undefined then
  315.                             (
  316.                                 if iskindof ::rollout_About RolloutClass then
  317.                                 (
  318.                                     DestroyDialog             ::rollout_About
  319.                                 )
  320.                             )
  321.                             if ::rollout_Alert != undefined then
  322.                             (
  323.                                 if iskindof ::rollout_Alert RolloutClass then
  324.                                 (
  325.                                     DestroyDialog             ::rollout_Alert
  326.                                 )
  327.                             )
  328.                             ----------------------------The Rollout Floater ----------------------------
  329.                             if ::CRYOP != undefined then
  330.                             (
  331.                                 if iskindof ::CRYOP RolloutFloater then
  332.                                 (
  333.                                     closeRolloutFloater              ::CRYOP
  334.                                 )
  335.                             )
  336.                             --//// End of  Destroy dialogs and rollout clauses if applicable ////                        
  337.                         )
  338.                         catch
  339.                         (
  340.                             format "\n*** *** *** *** *** *** Could not destroy dialogs *** *** *** *** *** ***\n"
  341.                             format "%" (getCurrentException())
  342.                             format "*** *** *** *** *** *** END OF Could not destroy dialogs *** *** *** *** *** *** ***\n"
  343.                         )
  344.  
  345.                         rollout cryImport "Cryengine Importer" width:290 height:170 category:3
  346.                         (
  347.                             button 'btn_view_ini' "View ini" pos:[177,4] width:96 height:25 align:#left
  348.                             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)
  349.                             label 'lbl_version' "Cryengine Importer v 1.0" pos:[20,8] width:130 height:19 align:#left
  350.                             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
  351.                             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
  352.                             label 'lbl_skeletonList_Loaded' "" pos:[11,90] width:260 height:17 align:#left
  353.                             button 'btn_print_SkeletonList' "Print Skeleton List" pos:[165,87] width:108 height:25 align:#left
  354.                             
  355.                             checkbox 'chk_skip_chr' "Don't load .chr" pos:[13,115] width:252 height:19 enabled:true checked:true align:#left
  356.                             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"
  357.                             checkbox 'chk_reset' "Reset before skin load" pos:[13,155] width:120 height:19 enabled:true checked:true align:#left    
  358.                             button 'btn_import' "LOAD CryFile..." pos:[8,118+60] width:265 height:40 toolTip:"Load CryFile (.cgf, .cgfm, .chr, .chrm, .skin, .skinm)" align:#left
  359.                             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                            
  360.                             
  361.                             checkbox 'chk_deleteISOvertices' "Delete Isolated Vertices" pos:[13,265] width:259 height:19 enabled:true checked:false align:#left                            
  362.                             checkbox 'chk_Dont_Load_Skeleton' "Don't Load Skeleton" pos:[13,285] width:259 height:19 enabled:true checked:false align:#left
  363.                             checkbox 'chk_Skip_LOD_Materials' "Skip $Lod Materials" pos:[13,305] width:125 height:19 enabled:true checked:true align:#left
  364.                             checkbox 'chk_Skip_Proxy_Materials' "Skip Proxy Materials" pos:[150,305] width:252 height:19 enabled:false checked:false align:#left visible:false
  365.                             
  366.                             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") align:#left enabled:true selection:8
  367.                             
  368.                             --////////////////// Include //////////////////
  369.                             include "skinwrap_.ms"
  370.                             include "create_bones_.ms"
  371.                             include "load_cryHeaders_.ms"
  372.                             include "load_cryFile_.ms"
  373.                                 
  374.                             include "CAF_headers_.ms"
  375.                             include "load_CAF_.ms"
  376.                             include "cryFile_btn_loader_.ms"
  377.                             --/////////////////////////////////////////////
  378.                             
  379.                             fn db_creation_ask \
  380.                                                         &db_type: =
  381.                             (    
  382.                                 local db_filename = (db_type as string) +"_db.txt"
  383.                                 
  384.                                 local confirm = #no    
  385.                                 if doesfileexist (pathConfig.resolvePathSymbols (pathConfig.AppendPath (pathConfig.AppendPath ::g_scriptRoot "\\db") db_filename)) then
  386.                                 (
  387.                                     confirm = yesNoCancelBox (db_filename + " already exists - continue?") \
  388.                                                                             title:"WARNING" \
  389.                                                                             beep:true
  390.                                 )
  391.                                 else
  392.                                 (
  393.                                     confirm = #yes
  394.                                 )
  395.                                 
  396.                                 if confirm == #yes then
  397.                                 (
  398.                                     ::g_db_type = db_type
  399.                                     inst_build_resource_db             = build_resource_db() --create instance
  400.                                     inst_build_resource_db.builder \
  401.                                                                                 g_db_type: &::g_db_type
  402.                                 )
  403.                             )
  404.                             
  405.                             on cryImport open do
  406.                             (                                
  407.                                 if ::g_auto_resourcelist_array.count == 0 then
  408.                                 (
  409.                                     ::g_auto_resourcelist_array = getFilesRecursive \
  410.                                                                                                     root:            (::g_dirPath) \
  411.                                                                                                     specDir:        "Levels" \
  412.                                                                                                     targetFile:    "auto_resourcelist.txt"
  413.                                 )
  414.                                 
  415.                                 if (setdir #scripts ::g_scriptsDefault) then
  416.                                 (
  417.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  418.                                 )
  419.                                 else
  420.                                 (
  421.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  422.                                 )
  423.                                 
  424.                                 format "-----------------------------::g_scriptRoot: % -----------------------------\n" ::g_scriptRoot
  425.                                 
  426.                                 ::g_CryGame_dropDown_selection     = ddl_CryGame.items[ddl_CryGame.selection]
  427.                                 ::g_skip_Lod_Materials                    = chk_skip_Lod_Materials.state
  428.                                 ::g_Dont_Load_Skeleton                = chk_Dont_Load_Skeleton.state
  429.                                 ::g_dirpath                                     = getINISetting ::g_iniFile "paths" "g_dirpath"
  430.                                 
  431.                                 local skeleton_xml_path                 = ""
  432.                                 
  433.                                 --////////////////////////// Set SkeletonList.xml and also attempt to read it into an array ///////////////////////////
  434.                                 if pathConfig.isLegalPath ::g_dirpath then
  435.                                 (
  436.                                     local skeleton_xml_path         = pathConfig.appendPath     ::g_dirpath         ::g_SkeletonList_xml_NAME                        
  437.                                     
  438.                                     if skeleton_xml_path != undefined then
  439.                                     (
  440.                                         format "Will try to find and read: %\n" skeleton_xml_path
  441.                                         
  442.                                         if doesfileexist skeleton_xml_path then
  443.                                         (
  444.                                             setINISetting     ::g_iniFile     "paths" "SkeletonList"     skeleton_xml_path                    
  445.                                             
  446.                                             inst_xmlB_PROCESSOR = xmlB_PROCESSOR()
  447.                                             --XML
  448.                                             if (stricmp (getFilenameType skeleton_xml_path) ".xml") == 0 then
  449.                                             (
  450.                                                 if Binary_XML_check skeleton_xml_path then
  451.                                                 (
  452.                                                     global g_inst_stored_SkeletonList_XML    = stored_SkeletonList_XML ()    
  453.                                                     format "Attempting to read: %\n" (getFilenameType skeleton_xml_path)
  454.                                                     inst_xmlB_PROCESSOR.cry_general_xmlB_ReaderV \
  455.                                                                                                                         xmlBFile:                    skeleton_xml_path \
  456.                                                                                                                         inst_s_OPTIONS:        inst_s_OPTIONS \
  457.                                                                                                                         type:                        ".xml"
  458.                                                     
  459.                                                     skeleton_xml_path = ""
  460.                                                     ::cryImport.lbl_skeletonList_Loaded.text = "Skeleton List has been loaded"
  461.                                                 )
  462.                                                 else
  463.                                                 (
  464.                                                     format "This is not a valid xmlB file, aborting!: %\n" skeleton_xml_path
  465.                                                     ::cryImport.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
  466.                                                 )
  467.                                             )
  468.                                             else
  469.                                             (
  470.                                                 format "The suffix of the SkeletonList is not .xml: %\n" skeleton_xml_path
  471.                                                 ::cryImport.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
  472.                                             )
  473.                                         )
  474.                                         else
  475.                                         (
  476.                                             format "Cannot find: %\n" skeleton_xml_path
  477.                                             ::cryImport.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
  478.                                         )
  479.                                     )
  480.                                     else
  481.                                     (
  482.                                         format "Could not find: %\n" skeleton_xml_path
  483.                                         ::cryImport.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
  484.                                     )            
  485.                                 )
  486.                                 --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////        
  487.                                 
  488.                                 format "g_skip_Lod_Materials: %\n"                             ::g_skip_Lod_Materials
  489.                                 format "\nGame selected: --------- % ---------\n"         ::g_CryGame_dropDown_selection
  490.                                 format "Skeleton List Path: %\n"                                 (pathConfig.appendPath ::g_dirpath ::g_SkeletonList_xml_NAME)
  491.                                 format "g_Dont_Load_Skeleton: %\n"                             ::g_Dont_Load_Skeleton
  492.                                 format "======= GameSDK path: % =======\n"             ::g_dirpath
  493.                             )
  494.                             on cryImport close do
  495.                             (
  496.                                 if (setdir #scripts ::g_scriptsDefault) then
  497.                                 (
  498.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  499.                                 )
  500.                                 else
  501.                                 (
  502.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  503.                                 )
  504.                                 gc()
  505.                             )
  506.                             on cryImport rolledUp state do
  507.                             (
  508.                                 if NOT state then
  509.                                 (
  510.                                     --closed
  511.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-cryImport.height]
  512.                                 )
  513.                                 else
  514.                                 (
  515.                                     --open
  516.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+cryImport.height]
  517.                                 )
  518.                             )                
  519.                             on btn_delete_ini pressed do
  520.                             (
  521.                                 if (queryBox "This will delete your settings, are you sure you want to continue?") then
  522.                                 (
  523.                                     if (deleteFile ::g_iniFile) then
  524.                                     (
  525.                                         format "% deleted!\n" ::g_iniFile
  526.                                     )
  527.                                     else
  528.                                     (
  529.                                         format "Could not delete % \n" ::g_iniFile
  530.                                     )
  531.                                 )
  532.                             )
  533.                             on btn_gameDir pressed do
  534.                             (
  535.                                 startDir = undefined                            
  536.                                 g_dirpath             = getINISetting ::g_iniFile "paths" "g_dirpath"
  537.                             
  538.                                 if pathConfig.isLegalPath g_dirpath then
  539.                                 (
  540.                                     startDir = g_dirpath
  541.                                     ::g_dirpath         = getSavePath caption:"Choose Game directory" initialDir:startDir
  542.                                 )
  543.                                 else
  544.                                 (
  545.                                     ::g_dirpath         = getSavePath caption:"Choose Game directory"
  546.                                 )
  547.                                 --Reread Skeleton List
  548.                                 if ::g_dirpath != undefined then
  549.                                 (
  550.                                     if pathConfig.isLegalPath g_dirpath  then
  551.                                     (
  552.                                         setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath
  553.                                         
  554.                                         --Set the gamedir for the currently selected game
  555.                                         setINISetting     ::g_iniFile     "gameDirs"     ::g_CryGame_dropDown_selection     ::g_dirpath
  556.                                         
  557.                                         local skeleton_xml_path         = pathConfig.appendPath     ::g_dirpath         ::g_SkeletonList_xml_NAME
  558.                                         
  559.                                         if skeleton_xml_path != undefined then
  560.                                         (
  561.                                             format "Will try to find and read: %\n" skeleton_xml_path
  562.                                             
  563.                                             if doesfileexist skeleton_xml_path then
  564.                                             (
  565.                                                 setINISetting     ::g_iniFile     "paths" "SkeletonList"     skeleton_xml_path                    
  566.                                                 
  567.                                                 inst_xmlB_PROCESSOR = xmlB_PROCESSOR()
  568.                                                 --XML
  569.                                                 if (stricmp (getFilenameType skeleton_xml_path) ".xml") == 0 then
  570.                                                 (
  571.                                                     if Binary_XML_check skeleton_xml_path then
  572.                                                     (
  573.                                                         ::g_inst_stored_SkeletonList_XML    = stored_SkeletonList_XML ()    
  574.                                                         format "Attempting to read: %\n" (getFilenameType skeleton_xml_path)
  575.                                                         inst_xmlB_PROCESSOR.cry_general_xmlB_ReaderV \
  576.                                                                                                                             xmlBFile:                    skeleton_xml_path \
  577.                                                                                                                             inst_s_OPTIONS:        inst_s_OPTIONS \
  578.                                                                                                                             type:                        ".xml"
  579.                                                         
  580.                                                         skeleton_xml_path = ""
  581.                                                         ::cryImport.lbl_skeletonList_Loaded.text = "Skeleton List has been loaded"
  582.                                                     )    
  583.                                                 )            
  584.                                             )
  585.                                             else
  586.                                             (
  587.                                                 ::cryImport.lbl_skeletonList_Loaded.text = "Skeleton List could not be found"
  588.                                             )
  589.                                         )
  590.                                     )
  591.                                 )
  592.                                 
  593.                             )
  594.                             on btn_Set_SkeletonListXML pressed do
  595.                             (
  596.                                 startDir = undefined
  597.                                 ::g_dirpath = getINISetting ::g_iniFile "paths" "g_dirpath"
  598.                             
  599.                                 if pathConfig.isLegalPath ::g_dirpath then
  600.                                 (
  601.                                     startDir = ::g_dirpath
  602.                                     
  603.                                     SkeletonList_xml_PATH = getOpenFileName \
  604.                                     caption:"cgf/chr/cgfm Model File" \
  605.                                     types:"CryTek Model File (*.xml)|*.xml" historyCategory:"CryTek ObjectPresets" initialDir:startDir
  606.                                     
  607.                                     if SkeletonList_xml_PATH != undefined then
  608.                                     (
  609.                                         if doesfileexist SkeletonList_xml_PATH then
  610.                                         (
  611.                                             setINISetting     ::g_iniFile     "paths" "SkeletonList"     SkeletonList_xml_PATH                        
  612.                                             ::g_SkeletonList_xml_NAME = filenameFromPath SkeletonList_xml_PATH
  613.                                         )
  614.                                     )
  615.                                 )
  616.                                 else
  617.                                 (
  618.                                     ::g_dirpath = getSavePath caption:"Choose Game directory"
  619.                                     
  620.                                     if ::g_dirpath != undefined AND pathConfig.isLegalPath g_dirpath then
  621.                                     (
  622.                                         setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath
  623.                                         
  624.                                         startDir = ::g_dirpath
  625.                                         
  626.                                         SkeletonList_xml_PATH = getOpenFileName \
  627.                                         caption:"cgf/chr/cgfm Model File" \
  628.                                         types:"CryTek Model File (*.xml)|*.xml" historyCategory:"CryTek ObjectPresets" initialDir:startDir
  629.                                         
  630.                                         if SkeletonList_xml_PATH != undefined then
  631.                                         (
  632.                                             if doesfileexist SkeletonList_xml_PATH then
  633.                                             (
  634.                                                 setINISetting     ::g_iniFile     "paths" "SkeletonList"     SkeletonList_xml_PATH                        
  635.                                                 ::g_SkeletonList_xml_NAME = filenameFromPath SkeletonList_xml_PATH
  636.                                             )                    
  637.                                         )
  638.                                     )
  639.                                 )
  640.                             )
  641.                             on btn_print_SkeletonList pressed do
  642.                             (
  643.                                 print_SkeletonList()
  644.                             )
  645.                             on btn_import pressed do
  646.                             (
  647.                                 if GetQuietMode() == false then
  648.                                 (
  649.                                     SetQuietMode true --we want prompts enabled
  650.                                 )
  651.                                 
  652.                                 get_game_dirPath()
  653.                                 
  654.                                 if NOT (doesfileexist g_dirpath) then
  655.                                 (
  656.                                     confirm = yesNoCancelBox "You must choose a root game directory, do you want to do it now?" \
  657.                                                                         title:"WARNING" \
  658.                                                                         beep:true        
  659.                                     if confirm == #yes then
  660.                                     (
  661.                                         ::g_dirpath = getSavePath caption:"Choose Game directory"
  662.                                         
  663.                                         if ::g_dirpath != undefined AND pathConfig.isLegalPath g_dirpath then
  664.                                         (
  665.                                             setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath
  666.                                             
  667.                                             --Set the gamedir for the default selected game
  668.                                             setINISetting ::g_iniFile "gameDirs" g_cryFile ddl_CryGame.items[ddl_CryGame.selection]
  669.                                         )
  670.                                     )
  671.                                 )                    
  672.                                 else
  673.                                 (
  674.                                     g_cryFile = getOpenFileName \
  675.                                     caption:"cgf/chr/cgfm Model File" \
  676.                                     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 (*.*)|*.*" \
  677.                                     historyCategory:"CryTek ObjectPresets"
  678.                                     
  679.                                     if ddl_CryGame.selected == "Ryse" then
  680.                                     (
  681.                                         if g_cryFile != undefined then
  682.                                         (
  683.                                             if doesfileexist g_cryFile then
  684.                                             (
  685.                                                 if ((getFilenameType g_cryFile) == ".cgf") OR ((getFilenameType g_cryFile) == ".cgfm") then
  686.                                                 (
  687.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  688.                                                     (
  689.                                                         format "This is not a valid CryTek file, aborting!\n"
  690.                                                     )
  691.                                                     else
  692.                                                     (
  693.                                                         ---------------------------- Create Instance Structs ----------------------------
  694.                                                         --We start this storage here
  695.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  696.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  697.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  698.                                                         local inst_CDF_Model                = CDF_Model()
  699.                                                         --------------------------------------------------------------------------------------    
  700.                                                         
  701.                                                         setINISetting     ::g_iniFile     "boneinfo" "has_bones"     "0"
  702.                                                         
  703.                                                         cryFile_loader \
  704.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  705.                                                                             g_cryFile:                        &g_cryFile \
  706.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  707.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  708.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  709.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  710.                                                     )                    
  711.                                                 )
  712.                                                 if ((getFilenameType g_cryFile) == ".cga") OR ((getFilenameType g_cryFile) == ".cgam") then
  713.                                                 (
  714.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  715.                                                     (
  716.                                                         format "This is not a valid CryTek file, aborting!\n"
  717.                                                     )
  718.                                                     else
  719.                                                     (
  720.                                                         ---------------------------- Create Instance Structs ----------------------------
  721.                                                         --We start this storage here
  722.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  723.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  724.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  725.                                                         local inst_CDF_Model                = CDF_Model()
  726.                                                         --------------------------------------------------------------------------------------    
  727.                                                         
  728.                                                         cryFile_loader \
  729.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  730.                                                                             g_cryFile:                        &g_cryFile \
  731.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  732.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  733.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  734.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  735.                                                     )    
  736.                                                 )    
  737.                                                 else if ((getFilenameType g_cryFile) == ".skin") OR ((getFilenameType g_cryFile) == ".skinm") then
  738.                                                 (
  739.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  740.                                                     (
  741.                                                         format "This is not a valid CryTek file, aborting!\n"
  742.                                                     )
  743.                                                     else
  744.                                                     (
  745.                                                         if chk_reset.state then
  746.                                                         (
  747.                                                             reset_max()
  748.                                                         )
  749.                                                                     
  750.                                                         Reset_Arrays()                                
  751.                                                         Reset_BoneNodes_arrays()
  752.                                                         
  753.                                                         ---------------------------- Create Instance Structs ----------------------------
  754.                                                         --We start this storage here
  755.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  756.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  757.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  758.                                                         local inst_CDF_Model                = CDF_Model()
  759.                                                         --------------------------------------------------------------------------------------    
  760.                                                         
  761.                                                         cryFile_loader \
  762.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  763.                                                                             g_cryFile:                        &g_cryFile \
  764.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  765.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  766.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  767.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  768.                                                     )                            
  769.                                                 )
  770.                                                 else if ((getFilenameType g_cryFile) == ".chr") OR ((getFilenameType g_cryFile) == ".chrm") then
  771.                                                 (
  772.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  773.                                                     (
  774.                                                         format "This is not a valid CryTek file, aborting!\n"
  775.                                                     )
  776.                                                     else
  777.                                                     (
  778.                                                         if chk_reset.state then
  779.                                                         (
  780.                                                             reset_max()
  781.                                                         )
  782.                                                                     
  783.                                                         Reset_Arrays()                                
  784.                                                         Reset_BoneNodes_arrays()
  785.                                                         
  786.                                                         ---------------------------- Create Instance Structs ----------------------------
  787.                                                         --We start this storage here
  788.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  789.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  790.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  791.                                                         local inst_CDF_Model                = CDF_Model()
  792.                                                         --------------------------------------------------------------------------------------    
  793.                                                         
  794.                                                         cryFile_loader \
  795.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  796.                                                                             g_cryFile:                        &g_cryFile \
  797.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  798.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  799.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  800.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  801.                                                     )
  802.                                                 )
  803.                                                 else if ((getFilenameType g_cryFile) == ".caf") then
  804.                                                 (
  805.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  806.                                                     (
  807.                                                         format "This is not a valid CryTek file, aborting!\n"
  808.                                                     )
  809.                                                     else
  810.                                                     (
  811.                                                         cryFile_loader \
  812.                                                                             g_cryFile:    &g_cryFile \
  813.                                                                             caller:        (getFilenameType g_cryFile)
  814.                                                     )
  815.                                                 )
  816.                                                 else if ((getFilenameType g_cryFile) == ".img") then
  817.                                                 (
  818.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  819.                                                     (
  820.                                                         format "This is not a valid CryTek file, aborting!\n"
  821.                                                     )
  822.                                                     else
  823.                                                     (
  824.                                                         cryFile_loader \
  825.                                                                             g_cryFile:    &g_cryFile \
  826.                                                                             caller:        (getFilenameType g_cryFile)
  827.                                                     )
  828.                                                 )
  829.                                                 else if (getFilenameType g_cryFile) == ".cdf" then
  830.                                                 (
  831.                                                     if  NOT (Binary_XML_check g_cryFile) then --if the xml file is not Crytek Binary XML
  832.                                                     (
  833.                                                         format "This is not a valid CryXmlB file, aborting!\n"
  834.                                                     )
  835.                                                     else
  836.                                                     (
  837.                                                         if chk_reset.state then
  838.                                                         (
  839.                                                             reset_max()
  840.                                                         )
  841.                                                                     
  842.                                                         Reset_Arrays()                                
  843.                                                         Reset_BoneNodes_arrays()
  844.                                                         
  845.                                                         cryxmlB_loader \
  846.                                                                                 g_MaterialRef_Bool: &g_MaterialRef_Bool
  847.                                                     )                
  848.                                                 )
  849.                                             )
  850.                                         )
  851.                                     )
  852.                                     else if ddl_CryGame.selected == "Crysis" then
  853.                                     (
  854.                                         if g_cryFile != undefined then
  855.                                         (
  856.                                             if doesfileexist g_cryFile then
  857.                                             (
  858.                                                 if ((getFilenameType g_cryFile) == ".cgf") then
  859.                                                 (
  860.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  861.                                                     (
  862.                                                         format "This is not a valid CryTek file, aborting!\n"
  863.                                                     )
  864.                                                     else
  865.                                                     (            
  866.                                                         ---------------------------- Create Instance Structs ----------------------------
  867.                                                         --We start this storage here
  868.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  869.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  870.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  871.                                                         local inst_CDF_Model                = CDF_Model()
  872.                                                         --------------------------------------------------------------------------------------    
  873.                                                         
  874.                                                         cryFile_loader \
  875.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  876.                                                                             g_cryFile:                        &g_cryFile \
  877.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  878.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  879.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  880.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  881.                                                     )                    
  882.                                                 )
  883.                                             )
  884.                                         )
  885.                                     )
  886.                                     else if ddl_CryGame.selected == "HFR" then
  887.                                     (
  888.                                         if g_cryFile != undefined then
  889.                                         (
  890.                                             if doesfileexist g_cryFile then
  891.                                             (
  892.                                                 if ((getFilenameType g_cryFile) == ".cgf") OR ((getFilenameType g_cryFile) == ".cgfm") then
  893.                                                 (
  894.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  895.                                                     (
  896.                                                         format "This is not a valid CryTek file, aborting!\n"
  897.                                                     )
  898.                                                     else
  899.                                                     (
  900.                                                         ---------------------------- Create Instance Structs ----------------------------
  901.                                                         --We start this storage here
  902.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  903.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  904.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  905.                                                         local inst_CDF_Model                = CDF_Model()
  906.                                                         --------------------------------------------------------------------------------------    
  907.                                                         
  908.                                                         cryFile_loader \
  909.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  910.                                                                             g_cryFile:                        &g_cryFile \
  911.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  912.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  913.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  914.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  915.                                                     )    
  916.                                                 )
  917.                                                 if ((getFilenameType g_cryFile) == ".cga") OR ((getFilenameType g_cryFile) == ".cgam") then
  918.                                                 (
  919.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  920.                                                     (
  921.                                                         format "This is not a valid CryTek file, aborting!\n"
  922.                                                     )
  923.                                                     else
  924.                                                     (
  925.                                                         ---------------------------- Create Instance Structs ----------------------------
  926.                                                         --We start this storage here
  927.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  928.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  929.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  930.                                                         local inst_CDF_Model                = CDF_Model()
  931.                                                         --------------------------------------------------------------------------------------    
  932.                                                         
  933.                                                         cryFile_loader \
  934.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  935.                                                                             g_cryFile:                        &g_cryFile \
  936.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  937.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  938.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  939.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  940.                                                     )    
  941.                                                 )    
  942.                                                 else if ((getFilenameType g_cryFile) == ".skin") OR ((getFilenameType g_cryFile) == ".skinm") then
  943.                                                 (
  944.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  945.                                                     (
  946.                                                         format "This is not a valid CryTek file, aborting!\n"
  947.                                                     )
  948.                                                     else
  949.                                                     (
  950.                                                         if chk_reset.state then
  951.                                                         (
  952.                                                             reset_max()
  953.                                                         )
  954.                                                                     
  955.                                                         Reset_Arrays()                                
  956.                                                         Reset_BoneNodes_arrays()
  957.                                                         
  958.                                                         ---------------------------- Create Instance Structs ----------------------------
  959.                                                         --We start this storage here
  960.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  961.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  962.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  963.                                                         local inst_CDF_Model                = CDF_Model()
  964.                                                         --------------------------------------------------------------------------------------    
  965.                                                         
  966.                                                         cryFile_loader \
  967.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  968.                                                                             g_cryFile:                        &g_cryFile \
  969.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  970.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  971.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  972.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  973.                                                     )                            
  974.                                                 )
  975.                                                 else if ((getFilenameType g_cryFile) == ".chr") OR ((getFilenameType g_cryFile) == ".chrm") then
  976.                                                 (
  977.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  978.                                                     (
  979.                                                         format "This is not a valid CryTek file, aborting!\n"
  980.                                                     )
  981.                                                     else
  982.                                                     (
  983.                                                         if chk_reset.state then
  984.                                                         (
  985.                                                             reset_max()
  986.                                                         )
  987.                                                                     
  988.                                                         Reset_Arrays()                                
  989.                                                         Reset_BoneNodes_arrays()
  990.                                                         
  991.                                                         ---------------------------- Create Instance Structs ----------------------------
  992.                                                         --We start this storage here
  993.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  994.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  995.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  996.                                                         local inst_CDF_Model                = CDF_Model()
  997.                                                         --------------------------------------------------------------------------------------    
  998.                                                         
  999.                                                         cryFile_loader \
  1000.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  1001.                                                                             g_cryFile:                        &g_cryFile \
  1002.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  1003.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  1004.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  1005.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  1006.                                                     )
  1007.                                                 )
  1008.                                                 else if ((getFilenameType g_cryFile) == ".caf") then
  1009.                                                 (
  1010.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  1011.                                                     (
  1012.                                                         format "This is not a valid CryTek file, aborting!\n"
  1013.                                                     )
  1014.                                                     else
  1015.                                                     (
  1016.                                                         cryFile_loader \
  1017.                                                                             g_cryFile:    &g_cryFile \
  1018.                                                                             caller:        (getFilenameType g_cryFile)
  1019.                                                     )
  1020.                                                 )
  1021.                                                 else if ((getFilenameType g_cryFile) == ".img") then
  1022.                                                 (
  1023.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  1024.                                                     (
  1025.                                                         format "This is not a valid CryTek file, aborting!\n"
  1026.                                                     )
  1027.                                                     else
  1028.                                                     (
  1029.                                                         cryFile_loader \
  1030.                                                                             g_cryFile:    &g_cryFile \
  1031.                                                                             caller:        (getFilenameType g_cryFile)
  1032.                                                     )
  1033.                                                 )
  1034.                                                 else if (getFilenameType g_cryFile) == ".cdf" then
  1035.                                                 (
  1036.                                                     if  NOT (Binary_XML_check g_cryFile) then --if the xml file is not Crytek Binary XML
  1037.                                                     (
  1038.                                                         format "This is not a valid CryXmlB file, aborting!\n"
  1039.                                                     )
  1040.                                                     else
  1041.                                                     (
  1042.                                                         if chk_reset.state then
  1043.                                                         (
  1044.                                                             reset_max()
  1045.                                                         )
  1046.                                                                     
  1047.                                                         Reset_Arrays()                                
  1048.                                                         Reset_BoneNodes_arrays()
  1049.                                                         
  1050.                                                         cryxmlB_loader \
  1051.                                                                                 g_MaterialRef_Bool: &g_MaterialRef_Bool
  1052.                                                     )                
  1053.                                                 )
  1054.                                             )    
  1055.                                         )
  1056.                                     )
  1057.                                     else if ddl_CryGame.selected == "Armored Warfare" then
  1058.                                     (
  1059.                                         if g_cryFile != undefined then
  1060.                                         (
  1061.                                             if doesfileexist g_cryFile then
  1062.                                             (
  1063.                                                 if ((getFilenameType g_cryFile) == ".cgf") OR ((getFilenameType g_cryFile) == ".cgfm") then
  1064.                                                 (
  1065.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  1066.                                                     (
  1067.                                                         format "This is not a valid CryTek file, aborting!\n"
  1068.                                                     )
  1069.                                                     else
  1070.                                                     (
  1071.                                                         ---------------------------- Create Instance Structs ----------------------------
  1072.                                                         --We start this storage here
  1073.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  1074.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  1075.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  1076.                                                         local inst_CDF_Model                = CDF_Model()
  1077.                                                         --------------------------------------------------------------------------------------    
  1078.                                                         
  1079.                                                         cryFile_loader \
  1080.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  1081.                                                                             g_cryFile:                        &g_cryFile \
  1082.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  1083.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  1084.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  1085.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  1086.                                                     )    
  1087.                                                 )    
  1088.                                                 if ((getFilenameType g_cryFile) == ".cga") OR ((getFilenameType g_cryFile) == ".cgam") then
  1089.                                                 (
  1090.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  1091.                                                     (
  1092.                                                         format "This is not a valid CryTek file, aborting!\n"
  1093.                                                     )
  1094.                                                     else
  1095.                                                     (
  1096.                                                         ---------------------------- Create Instance Structs ----------------------------
  1097.                                                         --We start this storage here
  1098.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  1099.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  1100.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  1101.                                                         local inst_CDF_Model                = CDF_Model()
  1102.                                                         --------------------------------------------------------------------------------------    
  1103.                                                         
  1104.                                                         cryFile_loader \
  1105.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  1106.                                                                             g_cryFile:                        &g_cryFile \
  1107.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  1108.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  1109.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  1110.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  1111.                                                     )    
  1112.                                                 )    
  1113.                                                 else if ((getFilenameType g_cryFile) == ".skin") OR ((getFilenameType g_cryFile) == ".skinm") then
  1114.                                                 (
  1115.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  1116.                                                     (
  1117.                                                         format "This is not a valid CryTek file, aborting!\n"
  1118.                                                     )
  1119.                                                     else
  1120.                                                     (
  1121.                                                         if chk_reset.state then
  1122.                                                         (
  1123.                                                             reset_max()
  1124.                                                         )
  1125.                                                         
  1126.                                                         Reset_Arrays()                                
  1127.                                                         Reset_BoneNodes_arrays()
  1128.  
  1129.                                                         ---------------------------- Create Instance Structs ----------------------------
  1130.                                                         --We start this storage here
  1131.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  1132.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  1133.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  1134.                                                         local inst_CDF_Model                = CDF_Model()
  1135.                                                         --------------------------------------------------------------------------------------    
  1136.                                                         
  1137.                                                         cryFile_loader \
  1138.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  1139.                                                                             g_cryFile:                        &g_cryFile \
  1140.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  1141.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  1142.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  1143.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  1144.                                                     )                            
  1145.                                                 )
  1146.                                                 else if ((getFilenameType g_cryFile) == ".chr") OR ((getFilenameType g_cryFile) == ".chrm") then
  1147.                                                 (
  1148.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  1149.                                                     (
  1150.                                                         format "This is not a valid CryTek file, aborting!\n"
  1151.                                                     )
  1152.                                                     else
  1153.                                                     (
  1154.                                                         if chk_reset.state then
  1155.                                                         (
  1156.                                                             reset_max()
  1157.                                                         )
  1158.                                                                     
  1159.                                                         Reset_Arrays()                                
  1160.                                                         Reset_BoneNodes_arrays()
  1161.                                                         
  1162.                                                         ---------------------------- Create Instance Structs ----------------------------
  1163.                                                         --We start this storage here
  1164.                                                         local inst_Sub_Meshes             = Sub_Meshes()
  1165.                                                         local inst_CDF_Attachment         = CDF_Attachment()     --create instance of Attachment nodes
  1166.                                                         local inst_CDF_Modifiers            = CDF_Modifiers()         --create instance of Modifiers nodes
  1167.                                                         local inst_CDF_Model                = CDF_Model()
  1168.                                                         --------------------------------------------------------------------------------------    
  1169.                                                         
  1170.                                                         cryFile_loader \
  1171.                                                                             inst_Sub_Meshes:             &inst_Sub_Meshes \
  1172.                                                                             g_cryFile:                        &g_cryFile \
  1173.                                                                             inst_Sub_Meshes:            &inst_Sub_Meshes \
  1174.                                                                             inst_CDF_Model:                &inst_CDF_Model \
  1175.                                                                             inst_CDF_Attachment:        &inst_CDF_Attachment \
  1176.                                                                             inst_CDF_Modifiers:            &inst_CDF_Modifiers
  1177.                                                     )
  1178.                                                 )
  1179.                                                 else if ((getFilenameType g_cryFile) == ".caf") then
  1180.                                                 (
  1181.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  1182.                                                     (
  1183.                                                         format "This is not a valid CryTek file, aborting!\n"
  1184.                                                     )
  1185.                                                     else
  1186.                                                     (
  1187.                                                         cryFile_loader \
  1188.                                                                             g_cryFile:    &g_cryFile \
  1189.                                                                             caller:        (getFilenameType g_cryFile)
  1190.                                                     )
  1191.                                                 )
  1192.                                                 else if ((getFilenameType g_cryFile) == ".img") then
  1193.                                                 (
  1194.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  1195.                                                     (
  1196.                                                         format "This is not a valid CryTek file, aborting!\n"
  1197.                                                     )
  1198.                                                     else
  1199.                                                     (
  1200.                                                         cryFile_loader \
  1201.                                                                             g_cryFile:    &g_cryFile \
  1202.                                                                             caller:        (getFilenameType g_cryFile)
  1203.                                                     )
  1204.                                                 )
  1205.                                                 else if (getFilenameType g_cryFile) == ".cdf" then
  1206.                                                 (
  1207.                                                     if  NOT (Binary_XML_check g_cryFile) then --if the xml file is not Crytek Binary XML
  1208.                                                     (
  1209.                                                         format "This is not a valid CryXmlB file, aborting!\n"
  1210.                                                     )
  1211.                                                     else
  1212.                                                     (
  1213.                                                         if chk_reset.state then
  1214.                                                         (
  1215.                                                             reset_max()
  1216.                                                         )
  1217.                                                                     
  1218.                                                         Reset_Arrays()                                
  1219.                                                         Reset_BoneNodes_arrays()
  1220.                                                         
  1221.                                                         cryxmlB_loader \
  1222.                                                                                 g_MaterialRef_Bool: &g_MaterialRef_Bool
  1223.                                                     )                
  1224.                                                 )
  1225.                                             )    
  1226.                                         )
  1227.                                     )
  1228.                                 )
  1229.                             )
  1230.                             on btn_view_ini pressed do
  1231.                             (
  1232.                                 try
  1233.                                 (
  1234.                                     ShellLaunch "notepad.exe" ::g_iniFile
  1235.                                 )
  1236.                                 catch()
  1237.                             )
  1238.                             on chk_reset changed arg do
  1239.                             (
  1240.                                 format "% chk_reset\n" arg
  1241.                             )
  1242.                             on btn_Load_CDF pressed do
  1243.                             (
  1244.                                 if GetQuietMode() == false then
  1245.                                 (
  1246.                                     SetQuietMode true --we want prompts enabled
  1247.                                 )
  1248.                                 
  1249.                                 ::g_db_type = "mtl" --we set the default mtl library
  1250.                             
  1251.                                 get_game_dirPath()                        
  1252.  
  1253.                                 if doesfileexist g_dirpath then
  1254.                                 (
  1255.                                     g_cryFile = getOpenFileName \
  1256.                                     caption:"cgf/chr/cgfm Model File" \
  1257.                                     types:"CryTek Character Definition File (*.cdf)|*.cdf|(*.chrparams)|*.chrparams|(*.xml)|*.xml|All (*.*)|*.*" \
  1258.                                     historyCategory:"CryTek ObjectPresets"
  1259.                                     
  1260.                                     if g_cryFile != undefined then
  1261.                                     (            
  1262.                                         if doesfileexist g_cryFile then
  1263.                                         (
  1264.                                             if chk_reset.state then
  1265.                                             (
  1266.                                                 reset_max()
  1267.                                             )
  1268.                                             
  1269.                                             Reset_Arrays()
  1270.                                             Reset_BoneNodes_arrays
  1271.                                             
  1272.                                             if (stricmp (getFilenameType g_cryFile) ".cdf" ) == 0 OR \
  1273.                                                 (stricmp (getFilenameType g_cryFile) ".chrparams" ) == 0 then
  1274.                                             (
  1275.                                                 if  (Binary_XML_custom_check file:g_cryFile type:"CryXmlB") then --if the xml file is not Crytek Binary XML                
  1276.                                                 (
  1277.                                                     cryFile_CDF_loader g_cryFile:    &g_cryFile
  1278.                                                 )
  1279.                                                 else
  1280.                                                 (
  1281.                                                     format "This is not a valid CryXmlB file, aborting!\n"
  1282.                                                 )
  1283.                                             )
  1284.                                             else
  1285.                                             (
  1286.                                                 format "Seem that this is not a valid CDF file, aborting! \nIf you are trying to read an xmlB file, then use the button \"xmlB Reader...\" instead.\n"
  1287.                                             )
  1288.                                         )
  1289.                                     )
  1290.                                 )
  1291.                             )
  1292.                             on chk_deleteISOvertices changed arg do
  1293.                             (
  1294.                                 format "% chk_deleteISOvertices\n" arg
  1295.                             )
  1296.                             on chk_Dont_Load_Skeleton changed arg do
  1297.                             (
  1298.                                 ::g_Dont_Load_Skeleton = chk_Dont_Load_Skeleton.state
  1299.                                 
  1300.                                 format "% g_Dont_Load_Skeleton\n"             ::g_Dont_Load_Skeleton
  1301.                             )
  1302.                             on chk_Skip_LOD_Materials changed arg do
  1303.                             (
  1304.                                 ::g_skip_Lod_Materials = chk_Skip_LOD_Materials.state
  1305.                                 
  1306.                                 format "% g_skip_Lod_Materials\n"             ::g_skip_Lod_Materials
  1307.                             )
  1308.                             on ddl_CryGame selected arg do
  1309.                             (
  1310.                                 ::g_CryGame_dropDown_selection = ddl_CryGame.items[arg]
  1311.                                 
  1312.                                 if (getINISetting ::g_iniFile "gameDirs" ddl_CryGame.items[ddl_CryGame.selection]) != "" then --try to get the gamedir
  1313.                                 (
  1314.                                     ::g_dirpath = getINISetting ::g_iniFile "gameDirs" ddl_CryGame.items[ddl_CryGame.selection]
  1315.                                 )
  1316.                                 
  1317.                                 format "% selected\n" ::g_CryGame_dropDown_selection
  1318.                                 format "% gameDir path: %\n" ::g_CryGame_dropDown_selection ::g_dirpath
  1319.                             )
  1320.                         )                        
  1321.                         rollout rollout_Tools "Tools" width:290 height:95 category:4
  1322.                         (
  1323.                             button 'btn_xmlB_Reader' "xmlB Reader..." pos:[8,10] width:133 height:25 toolTip:"Examine an xmlB file" align:#left
  1324.                             button 'btn_CAF_reader' "CAF Reader..." pos:[142,35] width:133 height:25 enabled:false toolTip:"Not implemented yet" align:#left
  1325.                             button 'btn_xml_Reader' "xml Reader..." pos:[8,35] width:133 height:25 toolTip:"Examine an xml file" align:#left    
  1326.                             
  1327.                             GroupBox 'grp_db_builder' "Database Builder" pos:[9,88] width:265 height:110 align:#left
  1328.                             button 'btn_build_mtl_db' "Build .mtl db" pos:[20,110] width:121 height:25 toolTip:"Build an .mtl database" align:#left
  1329.                             button 'btn_build_tif_db' "Build .tif db" pos:[142,110] width:121 height:25 toolTip:"Build a .tif database" align:#left
  1330.                             button 'btn_build_dds_db' "Build .dds db" pos:[20,135] width:121 height:25 toolTip:"Build a .dds0 database" align:#left
  1331.                             
  1332.                             button 'btn_set_ResourceList' "Set Custom Resource List" pos:[20,160] width:217 height:25 align:#left
  1333.                             checkButton 'ckb_use_custom_ResourceList' "" pos:[237,160] width:25 height:25 align:#left tooltip:"Check to use the custom Resource List" \
  1334.                             images:#((    (getdir #maxSysIcons) + "Dark\\Grips\\Check_off_18.png"    ), undefined, 1, 1, 1, 1, 1, false) highlightColor:[100, 100, 100]
  1335.                             
  1336.                             fn ckb_resourceList_control \
  1337.                                                                     state: =
  1338.                             (
  1339.                                 local image_off_arr = #((    (getdir #maxSysIcons) + "Dark\\Grips\\Check_off_18.png" ), undefined, 1, 1, 1, 1, 1, false)
  1340.                                 local image_on_arr = #((    (getdir #maxSysIcons) + "Dark\\Grips\\Check_18.png" ), undefined, 1, 1, 1, 1, 1, false)
  1341.                                         
  1342.                                 if state == off then
  1343.                                 (
  1344.                                     ckb_use_custom_ResourceList.images = image_off_arr
  1345.                                     ckb_use_custom_ResourceList.images = image_off_arr
  1346.                                 )
  1347.                                 else
  1348.                                 (
  1349.                                     ckb_use_custom_ResourceList.images = image_on_arr
  1350.                                     ckb_use_custom_ResourceList.images = image_on_arr
  1351.                                 )
  1352.                             )
  1353.                             
  1354.                             on rollout_Tools open do
  1355.                             (                                
  1356.                                 if (setdir #scripts ::g_scriptsDefault) then
  1357.                                 (
  1358.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1359.                                 )
  1360.                                 else
  1361.                                 (
  1362.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1363.                                 )
  1364.                             )
  1365.                             on rollout_Tools close do
  1366.                             (
  1367.                                 if (setdir #scripts ::g_scriptsDefault) then
  1368.                                 (
  1369.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1370.                                 )
  1371.                                 else
  1372.                                 (
  1373.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1374.                                 )
  1375.                             )
  1376.                             on rollout_Tools rolledUp state do
  1377.                             (
  1378.                                 if NOT state then
  1379.                                 (
  1380.                                     --closed
  1381.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_Tools.height]
  1382.                                 )
  1383.                                 else
  1384.                                 (
  1385.                                     --open
  1386.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_Tools.height]
  1387.                                 )
  1388.                             )
  1389.                             
  1390.                             on btn_xmlB_Reader pressed do
  1391.                             (
  1392.                                 g_dirpath = getINISetting ::g_iniFile "paths" "g_dirpath"
  1393.                                 
  1394.                                 if NOT (doesfileexist g_dirpath) then
  1395.                                 (
  1396.                                     confirm = yesNoCancelBox "You must choose a root game directory, do you want to do it now?" \
  1397.                                                                         title:"WARNING" \
  1398.                                                                         beep:true
  1399.                                 
  1400.                                     if confirm == #yes then
  1401.                                     (
  1402.                                         ::g_dirpath = getSavePath caption:"Choose Game directory"
  1403.                                     )
  1404.                                 )
  1405.                                 
  1406.                                 g_cryFile = getOpenFileName \
  1407.                                 caption:"cgf/chr/cgfm Model File" \
  1408.                                 types:"CryTek MTL (*.mtl)|*.mtl|(*.xml)|*.xml|(*.cdf)|*.cdf|(*.chrparams)|*.chrparams| \
  1409.                                 All (*.*)|*.*" \
  1410.                                 historyCategory:"CryTek ObjectPresets"
  1411.                                 
  1412.                                 if ::g_cryFile != undefined AND doesfileexist g_cryFile then
  1413.                                 (                                
  1414.                                     ::g_xmlB_Report_v2 = true --override report setting
  1415.                                     -----------------------------------------------
  1416.                                     
  1417.                                     setINISetting ::g_iniFile "paths" "last_loaded" g_cryFile
  1418.                                     
  1419.                                     cryxmlB_loader \
  1420.                                                         g_MaterialRef_Bool:        &g_MaterialRef_Bool \
  1421.                                     
  1422.                                     ------------------------------------------------
  1423.                                     ::g_xmlB_Report_v2 = true = false
  1424.                                 )                                
  1425.                             )
  1426.                             on btn_xml_Reader pressed do
  1427.                             (
  1428.                                 g_dirpath = getINISetting ::g_iniFile "paths" "g_dirpath"
  1429.                                 
  1430.                                 if NOT (doesfileexist g_dirpath) then
  1431.                                 (
  1432.                                     confirm = yesNoCancelBox "You must choose a root game directory, do you want to do it now?" \
  1433.                                                                         title:"WARNING" \
  1434.                                                                         beep:true
  1435.                                 
  1436.                                     if confirm == #yes then
  1437.                                     (
  1438.                                         ::g_dirpath = getSavePath caption:"Choose Game directory"
  1439.                                     )
  1440.                                 )
  1441.                                 
  1442.                                 g_cryFile = getOpenFileName \
  1443.                                 caption:"cgf/chr/cgfm Model File" \
  1444.                                 types:"CryTek MTL (*.mtl)|*.mtl|(*.xml)|*.xml|(*.cdf)|*.cdf|(*.chrparams)|*.chrparams| \
  1445.                                 All (*.*)|*.*" \
  1446.                                 historyCategory:"CryTek ObjectPresets"
  1447.                                 
  1448.                                 if ::g_cryFile != undefined AND doesfileexist g_cryFile then
  1449.                                 (
  1450.                                     setINISetting         ::g_iniFile         "paths" "last_loaded"         g_cryFile
  1451.                                     setINISetting         ::g_iniFile         "xml_paths" ".mtl"             g_cryFile
  1452.                                     
  1453.                                     --///////////////////////////// Read XML ////////////////////////////////
  1454.                                     str_read_xml = read_xml()
  1455.                                     str_read_xml.report = true --for formatting the print arr -- just for readability
  1456.                                     
  1457.                                     --Parsing the xml (.mtl)
  1458.                                     local xml_arr =  str_read_xml.main \
  1459.                                                                     xmlPath:     &g_cryFile \
  1460.                                                                     xml_arr:     &str_read_xml._xml
  1461.                                     
  1462.                                     --Processing/analysing the parsed xml
  1463.                                     inst_xml_PROCESSOR = xml_PROCESSOR()
  1464.                                     inst_xml_PROCESSOR.printNodes \
  1465.                                                                                 xml_arr: &xml_arr
  1466.                                     --////////////////////////////////////////////////////////////////////////
  1467.                                 )                                
  1468.                             )
  1469.                             on btn_CAF_reader pressed do
  1470.                             (
  1471.                                 --Not implemented yet
  1472.                             )                            
  1473.                             on btn_build_mtl_db pressed do
  1474.                             (
  1475.                                 ::g_db_type = "mtl"
  1476.                                 db_creation_ask \
  1477.                                                         db_type: &::g_db_type
  1478.                             )
  1479.                             on btn_build_tif_db pressed do
  1480.                             (
  1481.                                 ::g_db_type = "tif"                                
  1482.                                 db_creation_ask \
  1483.                                                         db_type: &::g_db_type
  1484.                             )
  1485.                             on btn_build_dds_db pressed do
  1486.                             (
  1487.                                 ::g_db_type = "dds.0"
  1488.                                 db_creation_ask \
  1489.                                                         db_type: &::g_db_type
  1490.                             )    
  1491.                             on btn_set_ResourceList pressed do
  1492.                             (
  1493.                                 local list = getOpenFileName \
  1494.                                 caption:"Resource File" \
  1495.                                 types:"CryTek Resource List (*.txt)|*.txt|All (*.*)|*.*" \
  1496.                                 historyCategory:"CryTek ObjectPresets"
  1497.                                 
  1498.                                 if list != undefined then
  1499.                                 (
  1500.                                     if doesFileExist list then
  1501.                                     (
  1502.                                         if matchpattern list pattern:"*perlayer*" then
  1503.                                         (
  1504.                                             Appendifunique         ::inst_ResourceLists.perLayer             list
  1505.                                         )
  1506.                                         else if matchpattern list pattern:"auto_*" then
  1507.                                         (
  1508.                                             Appendifunique         ::inst_ResourceLists.auto                     list
  1509.                                         )
  1510.                                         else if matchpattern list pattern:"*resourcelist*" then
  1511.                                         (
  1512.                                             Appendifunique        ::inst_ResourceLists.resourceList         list
  1513.                                         )
  1514.                                         
  1515.                                         --Report
  1516.                                         print inst_ResourceLists
  1517.                                         
  1518.                                         ----------------------Activate the check button----------------------
  1519.                                         ckb_use_custom_ResourceList.checked = true
  1520.                                         
  1521.                                         ckb_resourceList_control \
  1522.                                                                             state:ckb_use_custom_ResourceList.state
  1523.                                         ----------------------------------------------------------------------------
  1524.                                     )
  1525.                                 )                                
  1526.                             )
  1527.                         on ckb_use_custom_ResourceList changed state do
  1528.                         (
  1529.                             ckb_resourceList_control \
  1530.                                                                 state:ckb_use_custom_ResourceList.state
  1531.                         )
  1532.                         )                        
  1533.                         rollout rollout_options "Material Options" width:290 height:100 category:1
  1534.                         (
  1535.                             checkbox 'chk_BuildMaterial' "Build Material" pos:[15,5] width:265 height:16 checked:true align:#left
  1536.                             checkbox 'chk_Physical_Material' "Physical Material" pos:[15,35] width:248 height:22 checked:true enabled:false toolTip:"If unchecked, Standard Material is used instead (NOT recommended, because it is still highly VIP - Keep it physical)" align:#left
  1537.                             checkbox 'chk_UVW_Flip_V' "UVW - Flip V" pos:[15,55] width:107 height:16 checked:true align:#left        
  1538.                             GroupBox 'grp_Options' "Texture Rename" pos:[9,85] width:265 height:55 align:#left
  1539.                             checkbox 'chk_dds' "Rename .tif* to .dds" pos:[17,105] width:114 height:21 enabled:true checked:true align:#left
  1540.                             spinner 'spn_Spec_Map_Amount' "Specular Map Output Amount: " pos:[15,155] width:112 height:16 enabled:false range:[-100,100,-17] type:#float scale:0.1 align:#left
  1541.                             spinner 'spn_displacement_map_amt' "Displacement Map Amount: " pos:[15,175] width:112 height:16 enabled:false range:[-100,100,0.1] type:#float scale:0.1 align:#left
  1542.                             checkbox 'chk_PhysMat_SSS' "Use Subsurface Scattering / Skin Shader" pos:[15,210] width:265 height:16 checked:false align:#left
  1543.                             checkbox 'chk_deepSearch' "Use Deep Search" pos:[15,230] width:265 height:16 checked:false align:#left
  1544.                             checkbox 'chk_quickMTL_Match' "Use Quick .mtl Match" pos:[15,250] width:265 height:16 checked:true align:#left
  1545.                             checkbox 'chk_MaterialRef' "MaterialRef" pos:[15,270] width:265 height:16 checked:true align:#left
  1546.                             
  1547.                             on rollout_options open do
  1548.                             (                                
  1549.                                 if (setdir #scripts ::g_scriptsDefault) then
  1550.                                 (
  1551.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1552.                                 )
  1553.                                 else
  1554.                                 (
  1555.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1556.                                 )
  1557.                                 
  1558.                                 ::g_dds                         = chk_dds.state
  1559.                                 ::g_Physical_Material    = chk_Physical_Material.state
  1560.                                 ::g_UVW_Flip_V            = chk_UVW_Flip_V.state
  1561.                                 
  1562.                                 format "\n-----Material Options: -----\n"
  1563.                                 format "g_dds % \n"                                         ::g_dds
  1564.                                 format "g_Physical_Material % \n"                         ::g_Physical_Material
  1565.                                 format "chk_UVW_Flip_V % \n"                             ::g_UVW_Flip_V
  1566.                                 
  1567.                                 format "chk_PhysMat_SSS % \n"                         chk_PhysMat_SSS.state
  1568.                                 format "chk_deepSearch % \n"                             chk_deepSearch.state
  1569.                                 format "chk_quickMTL_Match % \n"                     chk_quickMTL_Match.state
  1570.                                 format "chk_MaterialRef % \n"                             chk_MaterialRef.state
  1571.                                 format "chk_BuildMaterial % \n"                             chk_BuildMaterial.state                                
  1572.                                 
  1573.                                 if ::g_Physical_Material then
  1574.                                 (
  1575.                                     spn_Spec_Map_Amount.enabled         = true
  1576.                                     spn_displacement_map_amt.enabled     = true
  1577.                                 )
  1578.                                 else
  1579.                                 (
  1580.                                     spn_Spec_Map_Amount.enabled         = false
  1581.                                     spn_displacement_map_amt.enabled     = false
  1582.                                 )
  1583.                                 ::inst_PHYS_MAT_ADJUST.spec_output_amount = spn_Spec_Map_Amount.value
  1584.                                 
  1585.                                 if chk_BuildMaterial.state then
  1586.                                 (
  1587. --                                     chk_Physical_Material.enabled     = true
  1588.                                     grp_Options.enabled                    = true
  1589.                                     chk_UVW_Flip_V.enabled             = true
  1590.                                     chk_PhysMat_SSS.enabled         = true
  1591.                                     chk_deepSearch.enabled             = true
  1592.                                     chk_quickMTL_Match.enabled     = true
  1593.                                     chk_dds.enabled                        = true
  1594.                                     chk_MaterialRef.enabled            = true
  1595.                                     
  1596.                                     spn_Spec_Map_Amount .enabled         = true
  1597.                                     spn_displacement_map_amt.enabled     = true
  1598.                                 )
  1599.                                 else
  1600.                                 (
  1601.                                     chk_Physical_Material.enabled     = false
  1602.                                     grp_Options.enabled                    = false
  1603.                                     chk_UVW_Flip_V.enabled             = false
  1604.                                     chk_PhysMat_SSS.enabled         = false
  1605.                                     chk_deepSearch.enabled             = false
  1606.                                     chk_quickMTL_Match.enabled     = false
  1607.                                     chk_dds.enabled                        = false
  1608.                                     chk_MaterialRef.enabled            = false
  1609.                                     
  1610.                                     spn_Spec_Map_Amount .enabled         = false
  1611.                                     spn_displacement_map_amt.enabled     = false
  1612.                                 )
  1613.                             )
  1614.                             on rollout_options close do
  1615.                             (
  1616.                                 if (setdir #scripts ::g_scriptsDefault) then
  1617.                                 (
  1618.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1619.                                 )
  1620.                                 else
  1621.                                 (
  1622.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1623.                                 )
  1624.                             )
  1625.                             on rollout_options rolledUp state do
  1626.                             (
  1627.                                 if NOT state then
  1628.                                 (
  1629.                                     --closed
  1630.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_options.height]
  1631.                                 )
  1632.                                 else
  1633.                                 (
  1634.                                     --open
  1635.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_options.height]
  1636.                                 )
  1637.                             )
  1638.                             on chk_Physical_Material changed arg do
  1639.                             (
  1640.                                 ::g_Physical_Material                                         = chk_Physical_Material.state        
  1641.                                 format "Physical Material: %\n"                             ::g_Physical_Material 
  1642.                                 
  1643.                                 if ::g_Physical_Material then
  1644.                                 (
  1645.                                     spn_Spec_Map_Amount.enabled         = true
  1646.                                     chk_PhysMat_SSS.enabled                 = true
  1647.                                     spn_displacement_map_amt.enabled     = true
  1648.                                 )
  1649.                                 else
  1650.                                 (
  1651.                                     spn_Spec_Map_Amount.enabled         = false
  1652.                                     chk_PhysMat_SSS.enabled                 = false
  1653.                                     spn_displacement_map_amt.enabled     = false
  1654.                                 )
  1655.                                 ::inst_PHYS_MAT_ADJUST.spec_output_amount = spn_Spec_Map_Amount.value
  1656.                             )
  1657.                             on spn_Spec_Map_Amount changed arg do
  1658.                             (
  1659.                                 ::inst_PHYS_MAT_ADJUST.spec_output_amount = spn_Spec_Map_Amount.value
  1660.                             )
  1661.                             on chk_dds changed arg do
  1662.                             (
  1663.                                 ::g_dds                                             = chk_dds.state        
  1664.                                 format "Treat .tiff as .dds: %\n"         ::g_dds
  1665.                             )
  1666.                             on chk_PhysMat_SSS changed arg do
  1667.                             (
  1668.                                 format "chk_PhysMat_SSS: %\n"         chk_PhysMat_SSS.state
  1669.                             )
  1670.                             on chk_UVW_Flip_V changed arg do
  1671.                             (
  1672.                                 ::g_UVW_Flip_V                                 = chk_UVW_Flip_V.state        
  1673.                                 format "chk_UVW_Flip_V % \n"             ::g_UVW_Flip_V
  1674.                             )
  1675.                             on chk_deepSearch changed arg do
  1676.                             (    
  1677.                                 format "chk_deepSearch % \n" arg
  1678.                             )
  1679.                             on chk_quickMTL_Match changed arg do
  1680.                             (    
  1681.                                 format "chk_quickMTL_Match % \n" arg
  1682.                             )
  1683.                             on chk_MaterialRef changed arg do
  1684.                             (    
  1685.                                 format "chk_MaterialRef % \n" arg
  1686.                             )
  1687.                             on chk_BuildMaterial changed arg do
  1688.                             (
  1689.                                 format "chk_BuildMaterial % \n" arg
  1690.                                 
  1691.                                 if arg then
  1692.                                 (
  1693. --                                     chk_Physical_Material.enabled     = true
  1694.                                     grp_Options.enabled                    = true
  1695.                                     chk_UVW_Flip_V.enabled             = true
  1696.                                     chk_PhysMat_SSS.enabled         = true
  1697.                                     chk_deepSearch.enabled             = true
  1698.                                     chk_quickMTL_Match.enabled     = true
  1699.                                     chk_dds.enabled                        = true
  1700.                                     chk_MaterialRef.enabled            = true
  1701.                                     
  1702.                                     spn_Spec_Map_Amount .enabled         = true
  1703.                                     spn_displacement_map_amt.enabled     = true
  1704.  
  1705.                                 )
  1706.                                 else
  1707.                                 (
  1708.                                     chk_Physical_Material.enabled     = false
  1709.                                     grp_Options.enabled                    = false
  1710.                                     chk_UVW_Flip_V.enabled             = false
  1711.                                     chk_PhysMat_SSS.enabled         = false
  1712.                                     chk_deepSearch.enabled             = false
  1713.                                     chk_quickMTL_Match.enabled     = false
  1714.                                     chk_dds.enabled                        = false
  1715.                                     chk_MaterialRef.enabled            = false
  1716.                                     
  1717.                                     spn_Spec_Map_Amount .enabled         = false
  1718.                                     spn_displacement_map_amt.enabled     = false
  1719.                                 )    
  1720.                             )
  1721.                         )
  1722.  
  1723.                         rollout rollout_Report "Report" width:290 height:150 category:9
  1724.                         (
  1725.                             checkbox 'chk_Mesh_Report' "Mesh Report" pos:[17,11] width:80 height:20 align:#left
  1726.                             checkbox 'chk_xmlB_Report' "xmlB Report" pos:[17,31] width:78 height:20 checked:false align:#left
  1727.                             checkbox 'chk_xmlB_Report_v2' "xmlB Report v2" pos:[17,50] width:110 height:20 checked:false align:#left
  1728.                             checkbox 'chk_xmlB_Debug_Report' "xmlB Debug Report" pos:[17,69] width:113 height:20 align:#left
  1729.                             checkbox 'chk_Build_Material_Report' "Build Material Report" pos:[17,89] width:122 height:18 enabled:true checked:false align:#left                        
  1730.                             checkbox 'chk_Read_Comp_cryBones_Report' "Read Compiled Crybones Report" pos:[17,107] width:175 height:20 align:#left
  1731.                             checkbox 'chk_Create_Bones_Report' "Create Bones Report" pos:[17,127] width:175 height:20 checked:false align:#left    
  1732.                             checkbox 'chk_CDF_Report' "CDF Report" pos:[17,147] width:175 height:20 checked:false align:#left
  1733.                             checkbox 'chk_Anim_Report' "Animation Report" pos:[17,167] width:175 height:20 checked:false align:#left
  1734.                             checkbox 'chk_Heuristic_Report' "Heuristic Report" pos:[17,187] width:175 height:20 checked:false align:#left
  1735.                             checkbox 'chk_MaterialRef_Report' "MaterialRef Report" pos:[17,207] width:175 height:20 checked:false align:#left
  1736.                             checkbox 'chk_NameMTLRef_Report' "MTLRef Report" pos:[17,227] width:175 height:20 checked:false align:#left
  1737.                             checkbox 'chk_NametexRef_Report' "TEXRef Report" pos:[17,247] width:175 height:20 checked:false align:#left
  1738.                             checkbox 'chk_BUILDER_Report' "BUILDER Report" pos:[17,267] width:175 height:20 checked:false align:#left
  1739.                             checkbox 'chk_XML_Report' "XML Report" pos:[17,287] width:175 height:20 checked:false align:#left
  1740.                             
  1741.                             on rollout_Report open do
  1742.                             (
  1743.                                 if (setdir #scripts ::g_scriptsDefault) then
  1744.                                 (
  1745.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1746.                                 )
  1747.                                 else
  1748.                                 (
  1749.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1750.                                 )
  1751.                                 
  1752.                                 ::g_xmlB_Report_v2                             = chk_xmlB_Report_v2.state        
  1753.                                 ::g_xmlB_Debug_Report                     = chk_xmlB_Debug_Report.state
  1754.                                 ::g_Build_Material_Report                     = chk_Build_Material_Report.state
  1755.                                 ::g_xmlB_Report                                 = chk_xmlB_Report.state
  1756.                                 ::g_Mesh_Report                                 = chk_Mesh_Report.state
  1757.                                 ::g_Read_Comp_cryBones_Report         = chk_Read_Comp_cryBones_Report.state
  1758.                                 ::g_Read_Create_Bones_Report             = chk_Create_Bones_Report.state
  1759.                                 ::g_CDF_Report                                 = chk_CDF_Report.state            
  1760.                                 
  1761.                                 format "\n-----Report Options: -----\n"        
  1762.                                 format "g_xmlB_Report_v2 % \n"                         ::g_xmlB_Report_v2
  1763.                                 format "g_xmlB_Debug_Report % \n"                     ::g_xmlB_Debug_Report
  1764.                                 format "g_Build_Material_Report % \n"                     ::g_Build_Material_Report
  1765.                                 format "g_xmlB_Report % \n"                                 ::g_xmlB_Report
  1766.                                 format "g_Mesh_Report % \n"                             ::g_Mesh_Report
  1767.                                 format "g_Read_Comp_cryBones_Report % \n"         ::g_Read_Comp_cryBones_Report
  1768.                                 format "g_Read_Create_Bones_Report % \n"         ::g_Read_Create_Bones_Report
  1769.                                 format "g_CDF_Report % \n"                                 ::g_CDF_Report
  1770.                                 
  1771.                                 format "chk_Anim_Report % \n"                             chk_Anim_Report.state
  1772.                                 format "chk_Anim_Report % \n"                             chk_Heuristic_Report.state
  1773.                                 format "chk_MaterialRef_Report % \n"                     chk_MaterialRef_Report.state
  1774.                                 format "chk_NameMTLRef_Report % \n"                 chk_NameMTLRef_Report.state
  1775.                                 format "chk_NametexRef_Report % \n"                 chk_NametexRef_Report.state                            
  1776.                             )
  1777.                             on rollout_Report close do
  1778.                             (
  1779.                                 if (setdir #scripts ::g_scriptsDefault) then
  1780.                                 (
  1781.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1782.                                 )
  1783.                                 else
  1784.                                 (
  1785.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1786.                                 )
  1787.                             )
  1788.                             on rollout_Report rolledUp state do
  1789.                             (
  1790.                                 if NOT state then
  1791.                                 (
  1792.                                     --closed
  1793.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_Report.height]
  1794.                                 )
  1795.                                 else
  1796.                                 (
  1797.                                     --open
  1798.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_Report.height]
  1799.                                 )
  1800.                             )
  1801.                             on chk_xmlB_Report_v2 changed arg do
  1802.                             (
  1803.                                 ::g_xmlB_Report_v2 = chk_xmlB_Report_v2.state        
  1804.                                 format "chk_xmlB_Report_v2: %\n" ::g_xmlB_Report_v2
  1805.                             )
  1806.                             on chk_xmlB_Debug_Report changed arg do
  1807.                             (
  1808.                                 ::g_xmlB_Debug_Report = chk_xmlB_Debug_Report.state        
  1809.                                 format "chk_xmlB_Debug_Report: %\n" ::g_xmlB_Debug_Report
  1810.                             )
  1811.                             on chk_Build_Material_Report changed arg do
  1812.                             (
  1813.                                 ::g_Build_Material_Report = chk_Build_Material_Report.state        
  1814.                                 format "chk_Build_Material_Report: %\n" ::g_Build_Material_Report
  1815.                             )
  1816.                             on chk_xmlB_Report changed arg do
  1817.                             (
  1818.                                 ::g_xmlB_Report = chk_xmlB_Report.state        
  1819.                                 format "chk_xmlB_Report: %\n" ::g_xmlB_Report
  1820.                             )
  1821.                             on chk_Mesh_Report changed arg do
  1822.                             (
  1823.                                 ::g_Mesh_Report = chk_Mesh_Report.state        
  1824.                                 format "chk_Mesh_Report: %\n" ::g_Mesh_Report
  1825.                             )
  1826.                             on chk_Read_Comp_cryBones_Report changed arg do
  1827.                             (
  1828.                                 ::g_chk_Comp_cryBones_Report = chk_Read_Comp_cryBones_Report.state        
  1829.                                 format "chk_Read_Comp_cryBones_Report: %\n" ::g_chk_Comp_cryBones_Report
  1830.                             )
  1831.                             on chk_Create_Bones_Report changed arg do
  1832.                             (
  1833.                                 ::g_Create_Bones_Report = chk_Create_Bones_Report.state        
  1834.                                 format "chk_Create_Bones_Report: %\n" ::g_Create_Bones_Report
  1835.                             )
  1836.                             on chk_CDF_Report changed arg do
  1837.                             (
  1838.                                 ::g_Create_Bones_Report = chk_Create_Bones_Report.state        
  1839.                                 format "chk_Create_Bones_Report: %\n" ::g_Create_Bones_Report
  1840.                             )
  1841.                             on chk_CDF_Report changed arg do
  1842.                             (
  1843.                                 ::g_CDF_Report = chk_CDF_Report.state        
  1844.                                 format "chk_Create_Bones_Report: %\n" ::g_CDF_Report
  1845.                             )
  1846.                             on chk_Anim_Report changed arg do
  1847.                             (                        
  1848.                                 format "chk_Anim_Report: %\n" arg
  1849.                             )
  1850.                             on chk_Heuristic_Report changed arg do
  1851.                             (                        
  1852.                                 format "chk_Heuristic_Report: %\n" arg
  1853.                             )
  1854.                             on chk_MaterialRef_Report changed arg do
  1855.                             (                        
  1856.                                 format "chk_MaterialRef_Report: %\n" arg
  1857.                             )
  1858.                             on chk_NameMTLRef_Report changed arg do
  1859.                             (                        
  1860.                                 format "chk_NameMTLRef_Report: %\n" arg
  1861.                             )    
  1862.                             on chk_NametexRef_Report changed arg do
  1863.                             (                        
  1864.                                 format "chk_NametexRef_Report: %\n" arg
  1865.                             )    
  1866.                             on chk_BUILDER_Report changed arg do
  1867.                             (                        
  1868.                                 format "chk_BUILDER_Report: %\n" arg
  1869.                             )    
  1870.                             on chk_XML_Report changed arg do
  1871.                             (                        
  1872.                                 format "chk_XML_Report: %\n" arg
  1873.                             )
  1874.                         )
  1875.  
  1876.                         rollout rollout_animation "Animation" width:290 height:95 category:5
  1877.                         (
  1878.                             checkbox 'chk_Use_Skin_Wrap' "Use Skin_Wrap" pos:[16,17] width:255 height:21 align:#left checked:false enabled:false
  1879.                             checkbox 'chk_Force_Skin_Translation' "Force Skin Translation" pos:[16,37] width:255 height:21 align:#left checked:false enabled:true    
  1880.                             
  1881.                             on rollout_animation open do
  1882.                             (
  1883.                                 if (setdir #scripts ::g_scriptsDefault) then
  1884.                                 (
  1885.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1886.                                 )
  1887.                                 else
  1888.                                 (
  1889.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1890.                                 )
  1891.                             )
  1892.                             on rollout_animation close do
  1893.                             (
  1894.                                 if (setdir #scripts ::g_scriptsDefault) then
  1895.                                 (
  1896.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1897.                                 )
  1898.                                 else
  1899.                                 (
  1900.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1901.                                 )
  1902.                             )
  1903.                             on chk_Use_Skin_Wrap changed arg do
  1904.                             (
  1905.                                 ::g_Use_Skin_Wrap = chk_Use_Skin_Wrap.state        
  1906.                                 format "chk_Use_Skin_Wrap: %\n" ::g_Use_Skin_Wrap
  1907.                             )
  1908.                             on rollout_animation rolledUp state do
  1909.                             (
  1910.                                 if NOT state then
  1911.                                 (
  1912.                                     --closed
  1913.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_animation.height]
  1914.                                 )
  1915.                                 else
  1916.                                 (
  1917.                                     --open
  1918.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_animation.height]
  1919.                                 )
  1920.                             )
  1921.                         )
  1922.  
  1923.                         rollout rollout_About "About" width:290 height:50 category:10
  1924.                         (
  1925.                             label 'lbl_About' "joqqyhez@gmail.com  2016" pos:[14,13] width:263 height:19 align:#left
  1926.                             label 'lbl_trademark' "CRYENGINE is a Trademark of Crytek GmbH" pos:[13,35] width:266 height:20 align:#left                        
  1927.                             
  1928.                             on rollout_About open do
  1929.                             (
  1930.                                 if (setdir #scripts ::g_scriptsDefault) then
  1931.                                 (
  1932.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1933.                                 )
  1934.                                 else
  1935.                                 (
  1936.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1937.                                 )
  1938.                             )    
  1939.                             on rollout_About close do
  1940.                             (
  1941.                                 if (setdir #scripts ::g_scriptsDefault) then
  1942.                                 (
  1943.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1944.                                 )
  1945.                                 else
  1946.                                 (
  1947.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1948.                                 )
  1949.                             )                        
  1950.                             on rollout_About rolledUp state do
  1951.                             (                            
  1952.                                 if NOT state then
  1953.                                 (
  1954.                                     --closed
  1955.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_About.height]
  1956.                                 )
  1957.                                 else
  1958.                                 (
  1959.                                     --open
  1960.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_About.height]
  1961.                                 )
  1962.                             )
  1963.                         )
  1964.  
  1965.                         rollout rollout_Alert "Alert" width:290 height:85 category:8
  1966.                         (
  1967.                             listBox 'lbx_Message_Alert' "Message Alert" pos:[12,20] width:267 height:7 align:#left                        
  1968.                             
  1969.                             on rollout_Alert open do
  1970.                             (
  1971.                                 if (setdir #scripts ::g_scriptsDefault) then
  1972.                                 (
  1973.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1974.                                 )
  1975.                                 else
  1976.                                 (
  1977.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1978.                                 )
  1979.                             )    
  1980.                             on rollout_Alert close do
  1981.                             (
  1982.                                 if (setdir #scripts ::g_scriptsDefault) then
  1983.                                 (
  1984.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1985.                                 )
  1986.                                 else
  1987.                                 (
  1988.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1989.                                 )
  1990.                             )    
  1991.                             on rollout_Alert rolledUp state do
  1992.                             (
  1993.                                 if NOT state then
  1994.                                 (
  1995.                                     --closed
  1996.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_Alert.height]
  1997.                                 )
  1998.                                 else
  1999.                                 (
  2000.                                     --open
  2001.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_Alert.height]
  2002.                                 )
  2003.                             )
  2004.                         )
  2005.                         
  2006.                         rollout rollout_AnimationTracks "Animation Tracks" width:100 height:20 category:6
  2007.                         (
  2008.                             dropdownList 'ddl_Animation_Tracks' "Animation Tracks" pos:[8,20] width:265 height:30 items:#() align:#left
  2009.                             
  2010.                             on rollout_AnimationTracks open do
  2011.                             (
  2012.                                 if (setdir #scripts ::g_scriptsDefault) then
  2013.                                 (
  2014.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  2015.                                 )
  2016.                                 else
  2017.                                 (
  2018.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  2019.                                 )
  2020.                             )
  2021.                             on rollout_AnimationTracks close do
  2022.                             (
  2023.                                 if (setdir #scripts ::g_scriptsDefault) then
  2024.                                 (
  2025.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  2026.                                 )
  2027.                                 else
  2028.                                 (
  2029.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  2030.                                 )
  2031.                             )    
  2032.                             on rollout_AnimationTracks rolledUp state do
  2033.                             (
  2034.                                 if NOT state then
  2035.                                 (
  2036.                                     --closed
  2037.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_AnimationTracks.height]
  2038.                                 )
  2039.                                 else
  2040.                                 (
  2041.                                     --open
  2042.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_AnimationTracks.height]
  2043.                                 )
  2044.                             )
  2045.                         )                        
  2046.  
  2047.                         --/////////////////////////////// Instanciate the rollouts ///////////////////////////////
  2048.                         CRYOP = newRolloutFloater "CryEngine Importer v 1.0" 290 1080
  2049.  
  2050.                         addRollout             ::rollout_options         ::CRYOP  rolledUp:true
  2051.                         addRollout             ::rollout_Report         ::CRYOP rolledUp:true
  2052.                         addRollout             ::cryImport             ::CRYOP rolledUp:false
  2053.                         addRollout             ::rollout_Tools             ::CRYOP rolledUp:true
  2054.                         addRollout             ::rollout_animation     ::CRYOP rolledUp:true
  2055.                         -- addRollout             ::rollout_Alert             ::CRYOP rolledUp:false --set runtime instead inside CryMat_XML_.ms
  2056.                         addRollout             ::rollout_About         ::CRYOP rolledUp:true                    
  2057.  
  2058.                         CreateDialog         ::cryImport     rolledUp:false width:120 height:200        
  2059.                         --//////////////////////////////////////////////////////////////////////////////////////
  2060.                     )
  2061.                     else
  2062.                     (
  2063. --                         delete_ini()
  2064.                         MessageBox "Cannot find or load the include files, cannot continue, aborting!" title:"Startup Error" beep:false
  2065.                     )
  2066.                 )
  2067.                 else
  2068.                 (
  2069. --                     delete_ini()
  2070.                     format "Could not set the #scripts path - include files will not load - aborting!\n"
  2071.                 )    
  2072.             )
  2073.             catch
  2074.             (
  2075. --                 delete_ini()
  2076.                 format "\n\n\n\n*** *** *** *** *** ***  Could not load include files ***  *** *** *** *** *** ***\n"
  2077.                 format "%" (getCurrentException())
  2078.                 format "\n*** *** *** *** *** *** END OF Could not load include files *** *** *** *** *** *** ***\n\n\n\n"
  2079.             )
  2080.         )
  2081.         else
  2082.         (
  2083.             delete_ini()
  2084.             MessageBox "Cannot find scriptpath, cannot continue, aborting!" title:"Startup Error" beep:false    
  2085.         )
  2086.  
  2087.         gc()
  2088.     )
  2089.     else
  2090.     (
  2091.         format "No ini file ( % ) found - aborting! (Make sure your user temp\n" ::g_iniFile
  2092.     )
  2093. )
  2094. else
  2095. (
  2096.     MessageBox "This script requires 3DS Max 2017 or higher!" title:"Startup Error" beep:true
  2097. )