home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 11288 / CryRyseImport.7z / ui_.ms
Encoding:
Text File  |  2016-07-12  |  50.4 KB  |  1,348 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. if  g_max_version >= 19 then
  29. (
  30.     clearlistener()
  31.     
  32.     Format "Max Version: %\n" g_max_version
  33.     
  34.     ----------------------------------------------------------------------
  35.     resetMaxFile #noPrompt
  36.     actionMan.executeAction 0 "40829"             -- show statistics
  37.     actionMan.executeAction -844228238 "12"      -- Viewport Lighting and Shadows: High Quality
  38.     ----------------------------------------------------------------------
  39.     escapeEnable
  40.     ----------------------------------------------------------------------
  41.  
  42.     if GetQuietMode() then
  43.     (
  44.         SetQuietMode false --we want prompts enabled
  45.     )
  46.  
  47.     --//////////////////////////////// Script Checker (Runs on Startup ////////////////////////////////
  48.     --///////////////////////////////////////////////////////////////////////////////////////////////
  49.     ---------------------------------------- ini Global - hardcoded filename ----------------------------------------
  50.     global g_iniFileName                 = "cryimport_v3.ini"
  51.     global g_iniFile                         = (    pathConfig.ResolvePathSymbols (pathConfig.AppendPath     sysInfo.tempdir     g_iniFileName)    )
  52.     
  53.     --Create the ini file if it does not exist
  54.     if NOT doesfileexist ::g_iniFile then
  55.     (
  56.         try
  57.         (
  58.             global ini = createFile ::g_iniFile
  59.             close ini
  60.         )
  61.         catch
  62.         (
  63.             format "%" (getCurrentException())
  64.         )
  65.     )
  66.     
  67.     if doesfileexist ::g_iniFile then
  68.     (
  69.         -------------------------------------------------------------------------------------------------------------------    
  70.         global g_dirpath                 = "" -- Path to the GameSDK ( WITHOUT the slash \ or / )
  71.         global g_scriptRoot             = ""
  72.         global g_includePath         = ""    
  73.         fn delete_ini =
  74.         (
  75.             if NOT deleteFile ::g_iniFile then
  76.             (
  77.                 delIniSetting     ::g_iniFile     "paths" "scriptRoot"             ::g_scriptRoot
  78.                 delIniSetting     ::g_iniFile     "paths" "g_includePath"     ::g_includePath
  79.             )
  80.         )
  81.         --/////////////////////////////////////////////////////////////////////////////////////////
  82.         try
  83.         (
  84.             g_dirPath                     = getINISetting     ::g_iniFile     "paths"     "g_dirpath"
  85.             g_scriptRoot                 = getINISetting     ::g_iniFile     "paths"     "scriptRoot"
  86.             g_includePath                 = getINISetting     ::g_iniFile     "paths"     "g_includePath"
  87.             
  88.             setINISetting     ::g_iniFile         "paths"         "g_scriptsDefault"         ::g_scriptsDefault
  89.         )
  90.         catch
  91.         (
  92.             format "%" (getCurrentException())
  93.         )
  94.         --/////////////////////////////////////////////////////////////////////////////////////////
  95.         
  96.         
  97.         g_dirpath                         = getINISetting     g_iniFile     "paths" "g_dirpath"    
  98.         if g_dirpath == "" then
  99.         (
  100.             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?"
  101.             
  102.             if set_dirPath then
  103.             (
  104.                 ::g_dirpath         = getSavePath caption:"Choose the Root for the Game (example \GameSDK\Ryse)"                    
  105.                 if ::g_dirpath != undefined AND pathConfig.isLegalPath g_dirpath then
  106.                 (
  107.                     setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath
  108.                 )
  109.                 else
  110.                 (
  111.                     ::g_dirpath             = ""
  112.                 )
  113.             )
  114.             else
  115.             (
  116.                 ::g_dirpath             = ""
  117.             )
  118.         )
  119.         -------------------------------------------------------------------------------------------------------------------
  120.  
  121.         if doesfileexist g_dirpath then
  122.         (
  123.             ::g_scriptRoot                 = getINISetting     ::g_iniFile     "paths"     "scriptRoot"
  124.             ::g_includePath                 = getINISetting     ::g_iniFile     "paths"     "g_includePath"
  125.  
  126.             if ::g_scriptRoot == "" OR ::g_includePath == ""  then
  127.             (
  128.                 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
  129.                 
  130.                 if set_scriptPath then
  131.                 (
  132.                     ::g_scriptRoot             = pathConfig.resolvePathSymbols ((getSavePath caption:"Choose Script Root Directory (the dir where you placed the scripts)" initialDir:sysinfo.currentDir))
  133.                     ::g_includePath             = pathConfig.resolvePathSymbols (::g_scriptRoot + "\\include")
  134.                     
  135.                     if ::g_scriptRoot != undefined AND ::g_includePath != undefined then
  136.                     (    
  137.                         if     doesFileExist ::g_includePath AND \            
  138.                             doesFileExist (    pathConfig.resolvePathSymbols (::g_scriptRoot + "\\ui_.ms")    ) then
  139.                         (
  140.                             setINISetting     ::g_iniFile     "paths" "scriptRoot"             ::g_scriptRoot
  141.                             setINISetting     ::g_iniFile     "paths" "g_includePath"     ::g_includePath
  142.                             
  143.                             messageBox "All set, you are now ready to go - all settings are saved" title:"Success" beep:false
  144.                         )
  145.                     )
  146.                     else
  147.                     (
  148.                         ::g_scriptRoot             = ""
  149.                         ::g_includePath             = ""
  150.                     )
  151.                 )
  152.                 else
  153.                 (
  154.                     ::g_scriptRoot             = ""
  155.                     ::g_includePath             = ""
  156.                 )
  157.             )
  158.         )
  159.         --/////////////////////////////////////////////////////////////////////////////////////////////////
  160.         --/////////////////////////////////////////////////////////////////////////////////////////////////
  161.  
  162.  
  163.         --////////////////////// Preprocessing - Checks that our includes do indeed exist //////////////////////
  164.         fn includes_Exist \
  165.                                 &includeDir: \                        
  166.                                 &include_files: = --we pass a pointer here
  167.         (
  168.             if symbolicPaths.isPathName "$scripts" then
  169.             (
  170.             )
  171.             else
  172.             (
  173.                 return false;
  174.             )
  175.             
  176.             local files = getFiles (includeDir + "*.*")
  177.             
  178.             for f in files do
  179.             (
  180.                 local fname = filenamefrompath f --strip the filename from the path (so we get only the filename + its suffix)
  181.                     
  182.                 for inclF in include_files do
  183.                 (
  184.                     --At least one fail, will be enough to terminate the whole execution of this importer script
  185.                     if (stricmp fname inclF) != 0 then
  186.                     (
  187.                         --//////////// We do a few backup checks, to keep it less rigorous and more tolerant ////////////
  188.                         local deepCheck = findItem files fname
  189.                         if deepCheck != 0 then
  190.                         (
  191.                             continue;
  192.                         )
  193.                         else --even less rigorous
  194.                         (
  195.                             local backupCheck = (matchpattern inclF pattern:"*"+fname+"*")
  196.                             if backupCheck then
  197.                             (
  198.                                 continue;
  199.                             )                        
  200.                         )
  201.                         --Being more tolerant than the above is not desired
  202.                         --///////////////////////////////////////////////////////////////////////////////////////////
  203.                         
  204.                         ------------------------------------------------ *** *** ***--------------------------------------------------
  205.                         --*** *** *** Every check failed and the script will not be able to continue, because reaching this point, will lead to dependencies loading failure! *** *** ***
  206.                         --*** *** *** This is serious, and will lead to a sure failure *** *** ***
  207.                         format "WARNING - We could not confirm the existence of the include files - execution will be aborted\n"                    
  208.                         return false;
  209.                         ------------------------------------------------ *** *** ***--------------------------------------------------
  210.                     )
  211.                 )            
  212.             )
  213.             --if we came here, then all the include files are present, and we can include them
  214.             return true;
  215.         )
  216.         --//////////////////////////////////////////////////////////////////////////////////////////////////
  217.  
  218.  
  219.         if     doesFileExist ::g_includePath AND \
  220.             doesFileExist ( pathConfig.resolvePathSymbols (::g_scriptRoot + "\\ui_.ms") ) AND \
  221.             (isDirectoryWriteable sysInfo.tempdir) then
  222.         (
  223.             try
  224.             (                
  225.                 ----------------------------------------------------
  226.                 --set the system script path to the chosen one (otherwise, the included files will not be found)
  227.                 if (setdir #scripts ::g_includePath)    then
  228.                 (
  229.                     ----------------------------------------------------                
  230.                     format "----------------- >::g_includePath: %\n" ::g_includePath
  231.                     format "----------------- > getdir #scripts: %\n" (getdir #scripts)
  232.                     --If we add more includes to our project (see include calls below), we must add them to this array as well
  233.                     local include_files = #(
  234.                                                     "HEADER_.ms", \
  235.                                                     "general_functions_.ms", \
  236.                                                     "build_resource_db_.ms", \
  237.                                                     "CryMat_XML_headers_.ms", \
  238.                                                     "CryMat_XML_.ms", \
  239.                                                             
  240.                                                     "create_bones_.ms", \
  241.                                                     "load_cryHeaders_.ms", \
  242.                                                     "load_cryFile_.ms", \                                            
  243.                                                     "CAF_headers_.ms", \
  244.                                                     "load_CAF_.ms", \
  245.                                                     "cryFile_btn_loader_.ms" \
  246.                                                 )    
  247.                                                 
  248.                     local FOUND_DEPENDENCIES = includes_Exist \
  249.                                                                                     includeDir:        &::g_includePath \
  250.                                                                                     include_files:    &include_files
  251.                         
  252.                     --Preprocessing - Checks that our includes do indeed exist        
  253.                     if FOUND_DEPENDENCIES AND \
  254.                         (getdir #scripts) == ::g_includePath  then
  255.                     (            
  256.                         --////////////////// Include //////////////////                        
  257.                         include "HEADER_.ms"
  258.                         include "general_functions_.ms"
  259.                         include "build_resource_db_.ms"
  260.                         include "CryMat_XML_headers_.ms"
  261.                         include "CryMat_XML_.ms"
  262.                         --////////////////////////////////////////////
  263.  
  264.                         try
  265.                         (
  266.                             --/////// Destroy dialogs and rollout clauses if applicable ///////                    
  267.                             if ::cryImport != undefined then
  268.                             (
  269.                                 if iskindof ::cryImport RolloutClass then
  270.                                 (
  271.                                     DestroyDialog             ::cryImport
  272.                                 )
  273.                             )
  274.                             if ::rollout_options != undefined then
  275.                             (
  276.                                 if iskindof ::rollout_options RolloutClass then
  277.                                 (
  278.                                     DestroyDialog             ::rollout_options
  279.                                 )
  280.                             )
  281.                             if ::rollout_Report != undefined then
  282.                             (
  283.                                 if iskindof ::rollout_Report RolloutClass then
  284.                                 (
  285.                                     DestroyDialog             ::rollout_Report
  286.                                 )
  287.                             )
  288.                             if ::rollout_animation != undefined then
  289.                             (
  290.                                 if iskindof ::rollout_animation RolloutClass then
  291.                                 (
  292.                                     DestroyDialog             ::rollout_animation
  293.                                 )
  294.                             )
  295.                             if ::rollout_About != undefined then
  296.                             (
  297.                                 if iskindof ::rollout_About RolloutClass then
  298.                                 (
  299.                                     DestroyDialog             ::rollout_About
  300.                                 )
  301.                             )
  302.                             if ::rollout_Alert != undefined then
  303.                             (
  304.                                 if iskindof ::rollout_Alert RolloutClass then
  305.                                 (
  306.                                     DestroyDialog             ::rollout_Alert
  307.                                 )
  308.                             )
  309.                             ----------------------------The Rollout Floater ----------------------------
  310.                             if ::CRYOP != undefined then
  311.                             (
  312.                                 if iskindof ::CRYOP RolloutFloater then
  313.                                 (
  314.                                     closeRolloutFloater              ::CRYOP
  315.                                 )
  316.                             )
  317.                             --//// End of  Destroy dialogs and rollout clauses if applicable ////                        
  318.                         )
  319.                         catch
  320.                         (
  321.                             format "\n*** *** *** *** *** *** Could not destroy dialogs *** *** *** *** *** ***\n"
  322.                             format "%" (getCurrentException())
  323.                             format "*** *** *** *** *** *** END OF Could not destroy dialogs *** *** *** *** *** *** ***\n"
  324.                         )
  325.  
  326.                         rollout cryImport "Cryengine Importer" width:290 height:170 category:3
  327.                         (
  328.                             label 'lbl_version' "Cryengine Importer v 1.0" pos:[20,8] width:130 height:19 align:#left
  329.                             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
  330.                             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
  331.                             label 'lbl_skeletonList_Loaded' "" pos:[11,89] width:260 height:17 align:#left
  332.                             button 'btn_import' "LOAD CryFile..." pos:[8,118] width:265 height:40 toolTip:"Load CryFile (.cgf, .cgfm, .chr, .chrm, .skin, .skinm)" align:#left
  333.                             button 'btn_view_ini' "View ini" pos:[177,4] width:96 height:25 align:#left
  334.                             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)
  335.                             button 'btn_Load_CDF' "LOAD Character Definition..." pos:[8,158] width:265 height:40 toolTip:"This loads the Character Definition File ( .cdf )" align:#left
  336.                             checkbox 'chk_Dont_Load_Skeleton' "Don't Load Skeleton" pos:[13,199] width:259 height:19 enabled:true checked:false align:#left
  337.                             checkbox 'chk_Skip_LOD_Materials' "Skip $Lod Materials" pos:[13,217] width:252 height:19 enabled:true checked:true align:#left                
  338.                             button 'btn_xmlB_Reader' "xmlB Reader..." pos:[8,250] width:133 height:25 toolTip:"Examine an xmlB file" align:#left
  339.                             button 'btn_CAF_reader' "CAF Reader..." pos:[142,250] width:133 height:25 enabled:false toolTip:"Not implemented yet" align:#left
  340.                             GroupBox 'grp_db_builder' "Database Builder" pos:[9,283] width:265 height:75 align:#left
  341.                             button 'btn_build_mtl_db' "Build .mtl db" pos:[20,300] width:121 height:25 toolTip:"Build an .mtl database" align:#left
  342.                             button 'btn_build_tif_db' "Build .tif db" pos:[142,300] width:121 height:25 toolTip:"Build a .tif database" align:#left
  343.                             button 'btn_build_dds_db' "Build .dds db" pos:[20,325] width:121 height:25 toolTip:"Build a .dds0 database" align:#left
  344.                             dropdownList 'ddl_CryGame' "CryEngine Game" pos:[8,370] width:265 height:40 items:#("Ryse", "Crysis", "Crysis 2", "Crysis 3", "Crysis Warhead", "Crysis Wars", "State of Decay") align:#left enabled:false    
  345.                                 
  346.                                 
  347.                             --////////////////// Include //////////////////
  348.                             include "create_bones_.ms"
  349.                             include "load_cryHeaders_.ms"
  350.                             include "load_cryFile_.ms"
  351.                                 
  352.                             include "CAF_headers_.ms"
  353.                             include "load_CAF_.ms"
  354.                             include "cryFile_btn_loader_.ms"
  355.                             --/////////////////////////////////////////////
  356.                             
  357.                             fn db_creation_ask \
  358.                                                         &db_type: =
  359.                             (    
  360.                                 local db_filename = (db_type as string) +"_db.txt"
  361.                                 
  362.                                 local confirm = #no    
  363.                                 if doesfileexist (pathConfig.resolvePathSymbols (pathConfig.AppendPath (pathConfig.AppendPath ::g_scriptRoot "\\db") db_filename)) then
  364.                                 (
  365.                                     confirm = yesNoCancelBox (db_filename + " already exists - continue?") \
  366.                                                                             title:"WARNING" \
  367.                                                                             beep:true
  368.                                 )
  369.                                 else
  370.                                 (
  371.                                     confirm = #yes
  372.                                 )
  373.                                 
  374.                                 if confirm == #yes then
  375.                                 (
  376.                                     ::g_db_type = db_type
  377.                                     inst_build_resource_db             = build_resource_db() --create instance
  378.                                     inst_build_resource_db.builder \
  379.                                                                                 g_db_type: &::g_db_type
  380.                                 )
  381.                             )
  382.                             
  383.                             on cryImport open do
  384.                             (
  385.                                 if ::g_auto_resourcelist_array.count == 0 then
  386.                                 (
  387.                                     ::g_auto_resourcelist_array = getFilesRecursive \
  388.                                                                                                     root:            (::g_dirPath) \
  389.                                                                                                     specDir:        "Levels" \
  390.                                                                                                     targetFile:    "auto_resourcelist.txt"
  391.                                 )
  392.                                 
  393.                                 if (setdir #scripts ::g_scriptsDefault) then
  394.                                 (
  395.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  396.                                 )
  397.                                 else
  398.                                 (
  399.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  400.                                 )
  401.                                 
  402.                                 format "-----------------------------::g_scriptRoot: % -----------------------------\n" ::g_scriptRoot
  403.                                 
  404.                                 ::g_CryGame_dropDown_selection     = ddl_CryGame.items[ddl_CryGame.selection]
  405.                                 ::g_skip_Lod_Materials                    = chk_skip_Lod_Materials.state
  406.                                 ::g_Dont_Load_Skeleton                = chk_Dont_Load_Skeleton.state
  407.                                 ::g_dirpath                                     = getINISetting ::g_iniFile "paths" "g_dirpath"
  408.                                 
  409.                                 local skeleton_xml_path = ""                    
  410.                                 
  411.                                 --////////////////////////// Set SkeletonList.xml and also attempt to read it into an array ///////////////////////////
  412.                                 if pathConfig.isLegalPath ::g_dirpath then
  413.                                 (
  414.                                     local skeleton_xml_path         = pathConfig.appendPath     ::g_dirpath         ::g_SkeletonList_xml_NAME                        
  415.                                     
  416.                                     if skeleton_xml_path != undefined then
  417.                                     (
  418.                                         format "Will try to find and read: %\n" skeleton_xml_path
  419.                                         
  420.                                         if doesfileexist skeleton_xml_path then
  421.                                         (
  422.                                             setINISetting     ::g_iniFile     "paths" "SkeletonList"     skeleton_xml_path                    
  423.                                             
  424.                                             inst_xmlB_PROCESSOR = xmlB_PROCESSOR()
  425.                                             --XML
  426.                                             if (stricmp (getFilenameType skeleton_xml_path) ".xml") == 0 then
  427.                                             (
  428.                                                 if Binary_XML_check skeleton_xml_path then
  429.                                                 (
  430.                                                     global g_inst_stored_SkeletonList_XML    = stored_SkeletonList_XML ()    
  431.                                                     format "Attempting to read: %\n" (getFilenameType skeleton_xml_path)
  432.                                                     inst_xmlB_PROCESSOR.cry_general_xmlB_ReaderV \
  433.                                                                                                                         xmlBFile:                    skeleton_xml_path \
  434.                                                                                                                         inst_s_OPTIONS:        inst_s_OPTIONS \
  435.                                                                                                                         type:                        ".xml"
  436.                                                     
  437.                                                     skeleton_xml_path = ""
  438.                                                     ::cryImport.lbl_skeletonList_Loaded.text = "Skeleton List has been loaded"
  439.                                                 )
  440.                                                 else
  441.                                                 (
  442.                                                     format "This is not a valid xmlB file, aborting!: %\n" skeleton_xml_path
  443.                                                     ::cryImport.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
  444.                                                 )
  445.                                             )
  446.                                             else
  447.                                             (
  448.                                                 format "The suffix of the SkeletonList is not .xml: %\n" skeleton_xml_path
  449.                                                 ::cryImport.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
  450.                                             )
  451.                                         )
  452.                                         else
  453.                                         (
  454.                                             format "Cannot find: %\n" skeleton_xml_path
  455.                                             ::cryImport.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
  456.                                         )
  457.                                     )
  458.                                     else
  459.                                     (
  460.                                         format "Could not find: %\n" skeleton_xml_path
  461.                                         ::cryImport.lbl_skeletonList_Loaded.text = "Could not locate the Skeleton List"
  462.                                     )            
  463.                                 )
  464.                                 --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////        
  465.                                 
  466.                                 format "g_skip_Lod_Materials: %\n"                             ::g_skip_Lod_Materials
  467.                                 format "\nGame selected: --------- % ---------\n"         ::g_CryGame_dropDown_selection
  468.                                 format "Skeleton List Path: %\n"                                 (pathConfig.appendPath ::g_dirpath ::g_SkeletonList_xml_NAME)
  469.                                 format "g_Dont_Load_Skeleton: %\n"                             ::g_Dont_Load_Skeleton
  470.                                 format "======= GameSDK path: % =======\n"             ::g_dirpath
  471.                             )
  472.                             on cryImport close do
  473.                             (
  474.                                 if (setdir #scripts ::g_scriptsDefault) then
  475.                                 (
  476.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  477.                                 )
  478.                                 else
  479.                                 (
  480.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  481.                                 )
  482.                             )
  483.                             on cryImport rolledUp state do
  484.                             (
  485.                                 if NOT state then
  486.                                 (
  487.                                     --closed
  488.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-cryImport.height]
  489.                                 )
  490.                                 else
  491.                                 (
  492.                                     --open
  493.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+cryImport.height]
  494.                                 )
  495.                             )                        
  496.                             on btn_delete_ini pressed do
  497.                             (
  498.                                 if (queryBox "This will delete your settings, are you sure you want to continue?") then
  499.                                 (
  500.                                     if (deleteFile ::g_iniFile) then
  501.                                     (
  502.                                         format "% deleted!\n" ::g_iniFile
  503.                                     )
  504.                                     else
  505.                                     (
  506.                                         format "Could not delete % \n" ::g_iniFile
  507.                                     )
  508.                                 )
  509.                             )
  510.                             on btn_gameDir pressed do
  511.                             (
  512.                                 startDir = undefined
  513.                             
  514.                                 g_dirpath             = getINISetting ::g_iniFile "paths" "g_dirpath"
  515.                             
  516.                                 if pathConfig.isLegalPath g_dirpath then
  517.                                 (
  518.                                     startDir = g_dirpath
  519.                                     ::g_dirpath         = getSavePath caption:"Choose Game directory" initialDir:startDir
  520.                                 )
  521.                                 else
  522.                                 (
  523.                                     ::g_dirpath         = getSavePath caption:"Choose Game directory"
  524.                                 )
  525.                                 
  526.                                 --Reread Skeleton List
  527.                                 if ::g_dirpath != undefined then
  528.                                 (
  529.                                     if pathConfig.isLegalPath g_dirpath  then
  530.                                     (
  531.                                         setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath                                    
  532.                                         local skeleton_xml_path         = pathConfig.appendPath     ::g_dirpath         ::g_SkeletonList_xml_NAME                        
  533.                                         
  534.                                         if skeleton_xml_path != undefined then
  535.                                         (
  536.                                             format "Will try to find and read: %\n" skeleton_xml_path
  537.                                             
  538.                                             if doesfileexist skeleton_xml_path then
  539.                                             (
  540.                                                 setINISetting     ::g_iniFile     "paths" "SkeletonList"     skeleton_xml_path                    
  541.                                                 
  542.                                                 inst_xmlB_PROCESSOR = xmlB_PROCESSOR()
  543.                                                 --XML
  544.                                                 if (stricmp (getFilenameType skeleton_xml_path) ".xml") == 0 then
  545.                                                 (
  546.                                                     if Binary_XML_check skeleton_xml_path then
  547.                                                     (
  548.                                                         ::g_inst_stored_SkeletonList_XML    = stored_SkeletonList_XML ()    
  549.                                                         format "Attempting to read: %\n" (getFilenameType skeleton_xml_path)
  550.                                                         inst_xmlB_PROCESSOR.cry_general_xmlB_ReaderV \
  551.                                                                                                                             xmlBFile:                    skeleton_xml_path \
  552.                                                                                                                             inst_s_OPTIONS:        inst_s_OPTIONS \
  553.                                                                                                                             type:                        ".xml"
  554.                                                         
  555.                                                         skeleton_xml_path = ""
  556.                                                         ::cryImport.lbl_skeletonList_Loaded.text = "Skeleton List has been loaded"
  557.                                                     )    
  558.                                                 )            
  559.                                             )
  560.                                         )
  561.                                     )
  562.                                 )
  563.                                 
  564.                             )
  565.                             on btn_Set_SkeletonListXML pressed do
  566.                             (
  567.                                 startDir = undefined
  568.                                 ::g_dirpath = getINISetting ::g_iniFile "paths" "g_dirpath"
  569.                             
  570.                                 if pathConfig.isLegalPath ::g_dirpath then
  571.                                 (
  572.                                     startDir = ::g_dirpath
  573.                                     
  574.                                     SkeletonList_xml_PATH = getOpenFileName \
  575.                                     caption:"cgf/chr/cgfm Model File" \
  576.                                     types:"CryTek Model File (*.xml)|*.xml" historyCategory:"CryTek ObjectPresets" initialDir:startDir
  577.                                     
  578.                                     if SkeletonList_xml_PATH != undefined then
  579.                                     (
  580.                                         if doesfileexist SkeletonList_xml_PATH then
  581.                                         (
  582.                                             setINISetting     ::g_iniFile     "paths" "SkeletonList"     SkeletonList_xml_PATH                        
  583.                                             ::g_SkeletonList_xml_NAME = filenameFromPath SkeletonList_xml_PATH
  584.                                         )
  585.                                     )
  586.                                 )
  587.                                 else
  588.                                 (
  589.                                     ::g_dirpath = getSavePath caption:"Choose Game directory"
  590.                                     
  591.                                     if ::g_dirpath != undefined AND pathConfig.isLegalPath g_dirpath then
  592.                                     (
  593.                                         setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath
  594.                                         
  595.                                         startDir = ::g_dirpath
  596.                                         
  597.                                         SkeletonList_xml_PATH = getOpenFileName \
  598.                                         caption:"cgf/chr/cgfm Model File" \
  599.                                         types:"CryTek Model File (*.xml)|*.xml" historyCategory:"CryTek ObjectPresets" initialDir:startDir
  600.                                         
  601.                                         if SkeletonList_xml_PATH != undefined then
  602.                                         (
  603.                                             if doesfileexist SkeletonList_xml_PATH then
  604.                                             (
  605.                                                 setINISetting     ::g_iniFile     "paths" "SkeletonList"     SkeletonList_xml_PATH                        
  606.                                                 ::g_SkeletonList_xml_NAME = filenameFromPath SkeletonList_xml_PATH
  607.                                             )                    
  608.                                         )
  609.                                     )
  610.                                 )
  611.                             )
  612.                             on btn_import pressed do
  613.                             (
  614.                                 Reset_Arrays()
  615.                                 
  616.                                 g_dirpath = getINISetting ::g_iniFile "paths" "g_dirpath"
  617.                                 
  618.                                 if NOT (doesfileexist g_dirpath) then
  619.                                 (
  620.                                     confirm = yesNoCancelBox "You must choose a root game directory, do you want to do it now?" \
  621.                                                                         title:"WARNING" \
  622.                                                                         beep:true        
  623.                                     if confirm == #yes then
  624.                                     (
  625.                                         g_dirpath = getSavePath caption:"Choose Game directory"
  626.                                         
  627.                                         if g_dirpath != undefined AND pathConfig.isLegalPath g_dirpath then
  628.                                         (
  629.                                             setINISetting ::g_iniFile "paths" "g_dirpath" ::g_dirpath
  630.                                         )
  631.                                     )
  632.                                 )                    
  633.                                 else
  634.                                 (
  635.                                     g_cryFile = getOpenFileName \
  636.                                     caption:"cgf/chr/cgfm Model File" \
  637.                                     types:"CryTek Model File (*.cgf)|*.cgf|(*.cgfm)|*.cgfm|(*.chr)|*.chr|(*.cdf)|*.cdf| \
  638.                                     (*.skin)|*.skin|(*.skinm)|*.skinm|(*.chrm)|*.chrm|(*.caf)|*.caf|(*.img)|*.img|All (*.*)|*.*" \
  639.                                     historyCategory:"CryTek ObjectPresets"
  640.                                     
  641.                                     if ddl_CryGame.selected == "Ryse" then
  642.                                     (
  643.                                         if g_cryFile != undefined then
  644.                                         (
  645.                                             if doesfileexist g_cryFile then
  646.                                             (
  647.                                                 if ((getFilenameType g_cryFile) == ".cgf") OR ((getFilenameType g_cryFile) == ".cgfm") then
  648.                                                 (
  649.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  650.                                                     (
  651.                                                         format "This is not a valid CryTek file, aborting!\n"
  652.                                                     )
  653.                                                     else
  654.                                                     (
  655.                                                         setINISetting     ::g_iniFile     "boneinfo" "has_bones"     "0"                    
  656.                                                         cryFile_loader g_cryFile:g_cryFile
  657.                                                     )                    
  658.                                                 )
  659.                                                 else if ((getFilenameType g_cryFile) == ".skin") OR ((getFilenameType g_cryFile) == ".skinm") then
  660.                                                 (
  661.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  662.                                                     (
  663.                                                         format "This is not a valid CryTek file, aborting!\n"
  664.                                                     )
  665.                                                     else
  666.                                                     (
  667.                                                         cryFile_loader g_cryFile:g_cryFile
  668.                                                     )                            
  669.                                                 )
  670.                                                 else if ((getFilenameType g_cryFile) == ".chr") OR ((getFilenameType g_cryFile) == ".chrm") then
  671.                                                 (
  672.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  673.                                                     (
  674.                                                         format "This is not a valid CryTek file, aborting!\n"
  675.                                                     )
  676.                                                     else
  677.                                                     (
  678.                                                         cryFile_loader g_cryFile:g_cryFile
  679.                                                     )
  680.                                                 )
  681.                                                 else if ((getFilenameType g_cryFile) == ".caf") then
  682.                                                 (
  683.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  684.                                                     (
  685.                                                         format "This is not a valid CryTek file, aborting!\n"
  686.                                                     )
  687.                                                     else
  688.                                                     (
  689.                                                         cryFile_loader \
  690.                                                                             g_cryFile:    g_cryFile \
  691.                                                                             caller:        (getFilenameType g_cryFile)
  692.                                                     )
  693.                                                 )
  694.                                                 else if ((getFilenameType g_cryFile) == ".img") then
  695.                                                 (
  696.                                                     if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  697.                                                     (
  698.                                                         format "This is not a valid CryTek file, aborting!\n"
  699.                                                     )
  700.                                                     else
  701.                                                     (
  702.                                                         cryFile_loader \
  703.                                                                             g_cryFile:    g_cryFile \
  704.                                                                             caller:        (getFilenameType g_cryFile)
  705.                                                     )
  706.                                                 )
  707.                                                 else if (getFilenameType g_cryFile) == ".cdf" then
  708.                                                 (
  709.                                                     if  NOT (Binary_XML_check g_cryFile) then --if the xml file is not Crytek Binary XML
  710.                                                     (
  711.                                                         format "This is not a valid CryXmlB file, aborting!\n"
  712.                                                     )
  713.                                                     else
  714.                                                     (
  715.                                                         cryxmlB_loader \
  716.                                                                                 g_MaterialRef_Bool: &g_MaterialRef_Bool
  717.                                                     )                
  718.                                                 )
  719.                                             )
  720.                                         )
  721.                                     )
  722.                                     else if ddl_CryGame.selected == "Crysis" then
  723.                                     (
  724.                                         if doesfileexist g_cryFile then
  725.                                         (
  726.                                             if ((getFilenameType g_cryFile) == ".cgf") then
  727.                                             (
  728.                                                 if  NOT (Binary_CryTek_check File:g_cryFile) then --if the xml file is not Crytek Binary XML
  729.                                                 (
  730.                                                     format "This is not a valid CryTek file, aborting!\n"
  731.                                                 )
  732.                                                 else
  733.                                                 (            
  734.                                                     cryFile_Crysis_loader g_cryFile:g_cryFile
  735.                                                 )                    
  736.                                             )
  737.                                         )
  738.                                         
  739.                                     )
  740.                                 )
  741.                             )
  742.                             on btn_view_ini pressed do
  743.                             (
  744.                                 try
  745.                                 (
  746.                                     ShellLaunch "notepad.exe" ::g_iniFile
  747.                                 )
  748.                                 catch()
  749.                             )
  750.                             on btn_Load_CDF pressed do
  751.                             (
  752.                                 g_dirpath = getINISetting ::g_iniFile "paths" "g_dirpath"
  753.                                 
  754.                                 if NOT (doesfileexist g_dirpath) then
  755.                                 (
  756.                                     confirm = yesNoCancelBox "You must choose a root game directory, do you want to do it now?" \
  757.                                                                         title:"WARNING" \
  758.                                                                         beep:true        
  759.                                     if confirm == #yes then
  760.                                     (
  761.                                         ::g_dirpath = getSavePath caption:"Choose Game directory"
  762.                                     )
  763.                                 )                    
  764.                                 else
  765.                                 (
  766.                                     g_cryFile = getOpenFileName \
  767.                                     caption:"cgf/chr/cgfm Model File" \
  768.                                     types:"CryTek Character Definition File (*.cdf)|*.cdf|(*.chrparams)|*.chrparams|(*.xml)|*.xml|All (*.*)|*.*" \
  769.                                     historyCategory:"CryTek ObjectPresets"
  770.                                     
  771.                                     if g_cryFile != undefined then
  772.                                     (            
  773.                                         if doesfileexist g_cryFile then
  774.                                         (
  775.                                             if (stricmp (getFilenameType g_cryFile) ".cdf" ) == 0 OR \
  776.                                                 (stricmp (getFilenameType g_cryFile) ".chrparams" ) == 0 then
  777.                                             (
  778.                                                 if  (Binary_XML_custom_check file:g_cryFile type:"CryXmlB") then --if the xml file is not Crytek Binary XML                
  779.                                                 (
  780.                                                     cryFile_CDF_loader g_cryFile:g_cryFile                                                
  781.                                                 )
  782.                                                 else
  783.                                                 (
  784.                                                     format "This is not a valid CryXmlB file, aborting!\n"
  785.                                                 )
  786.                                             )
  787.                                             else
  788.                                             (
  789.                                                 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"
  790.                                             )
  791.                                         )
  792.                                     )
  793.                                 )
  794.                             )
  795.                             on chk_Dont_Load_Skeleton changed arg do
  796.                             (
  797.                                 ::g_Dont_Load_Skeleton = chk_Dont_Load_Skeleton.state
  798.                                 
  799.                                 format "% g_Dont_Load_Skeleton\n"             ::g_Dont_Load_Skeleton
  800.                             )
  801.                             on chk_Skip_LOD_Materials changed arg do
  802.                             (
  803.                                 ::g_skip_Lod_Materials = chk_Skip_LOD_Materials.state
  804.                                 
  805.                                 format "% g_skip_Lod_Materials\n"             ::g_skip_Lod_Materials
  806.                             )
  807.                             on btn_xmlB_Reader pressed do
  808.                             (
  809.                                 g_dirpath = getINISetting ::g_iniFile "paths" "g_dirpath"
  810.                                 
  811.                                 if NOT (doesfileexist g_dirpath) then
  812.                                 (
  813.                                     confirm = yesNoCancelBox "You must choose a root game directory, do you want to do it now?" \
  814.                                                                         title:"WARNING" \
  815.                                                                         beep:true
  816.                                 
  817.                                     if confirm == #yes then
  818.                                     (
  819.                                         ::g_dirpath = getSavePath caption:"Choose Game directory"
  820.                                     )
  821.                                 )
  822.                                 
  823.                                 g_cryFile = getOpenFileName \
  824.                                 caption:"cgf/chr/cgfm Model File" \
  825.                                 types:"CryTek MTL (*.mtl)|*.mtl|(*.xml)|*.xml|(*.cdf)|*.cdf|(*.chrparams)|*.chrparams| \
  826.                                 All (*.*)|*.*" \
  827.                                 historyCategory:"CryTek ObjectPresets"
  828.                                 
  829.                                 if ::g_cryFile != undefined AND doesfileexist g_cryFile then
  830.                                 (
  831.                                     setINISetting ::g_iniFile "paths" "last_loaded" g_cryFile
  832.                                     
  833.                                     cryxmlB_loader \
  834.                                                         g_MaterialRef_Bool:        &g_MaterialRef_Bool \
  835.                                 )
  836.                             )
  837.                             on btn_CAF_reader pressed do
  838.                             (
  839.                                 --Not implemented yet
  840.                             )
  841.                             on btn_build_mtl_db pressed do
  842.                             (
  843.                                 ::g_db_type = "mtl"
  844.                                 db_creation_ask \
  845.                                                         db_type: &::g_db_type
  846.                             )
  847.                             on btn_build_tif_db pressed do
  848.                             (
  849.                                 ::g_db_type = "tif"                                
  850.                                 db_creation_ask \
  851.                                                         db_type: &::g_db_type
  852.                             )
  853.                             on btn_build_dds_db pressed do
  854.                             (
  855.                                 ::g_db_type = "dds.0"
  856.                                 db_creation_ask \
  857.                                                         db_type: &::g_db_type
  858.                             )                        
  859.                             on ddl_CryGame selected arg do
  860.                             (
  861.                                 ::g_CryGame_dropDown_selection = ddl_CryGame.items[arg]
  862.                                 format "% selected\n" ::g_CryGame_dropDown_selection
  863.                             )
  864.                         )
  865.                         
  866.                         rollout rollout_options "Material Options" width:290 height:100 category:1
  867.                         (
  868.                             checkbox 'chk_Physical_Material' "Physical Material" pos:[14,5] width:248 height:22 checked:true toolTip:"If unchecked, Standard Material is used instead" align:#left
  869.                             GroupBox 'grp_Options' "Texture Rename" pos:[9,60] width:265 height:55 align:#left
  870.                             checkbox 'chk_dds' "Rename .tif* to .dds" pos:[17,79] width:114 height:21 enabled:true checked:true align:#left
  871.                             checkbox 'chk_UVW_Flip_V' "UVW - Flip V" pos:[15,31] width:107 height:16 checked:true align:#left
  872.                             spinner 'spn_Spec_Map_Amount' "Specular Map Output Amount: " pos:[15,130] width:112 height:16 enabled:false range:[-100,100,-17] type:#float scale:0.1 align:#left
  873.                             spinner 'spn_displacement_map_amt' "Displacement Map Amount: " pos:[15,150] width:112 height:16 enabled:false range:[-100,100,0.1] type:#float scale:0.1 align:#left
  874.                             checkbox 'chk_PhysMat_SSS' "Use Subsurface Scattering / Skin Shader" pos:[15,175] width:265 height:16 checked:false align:#left
  875.                             checkbox 'chk_deepSearch' "Use Deep Search" pos:[15,195] width:265 height:16 checked:true align:#left
  876.                             checkbox 'chk_quickMTL_Match' "Use Quick .mtl Match" pos:[15,215] width:265 height:16 checked:true align:#left
  877.                             
  878.                             on rollout_options open do
  879.                             (    
  880.                                 if (setdir #scripts ::g_scriptsDefault) then
  881.                                 (
  882.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  883.                                 )
  884.                                 else
  885.                                 (
  886.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  887.                                 )
  888.                                 
  889.                                 ::g_dds                         = chk_dds.state
  890.                                 ::g_Physical_Material    = chk_Physical_Material.state
  891.                                 ::g_UVW_Flip_V            = chk_UVW_Flip_V.state
  892.                                 
  893.                                 format "\n-----Material Options: -----\n"
  894.                                 format "g_dds % \n"                                         ::g_dds
  895.                                 format "g_Physical_Material % \n"                         ::g_Physical_Material
  896.                                 format "chk_UVW_Flip_V % \n"                             ::g_UVW_Flip_V
  897.                                 
  898.                                 format "chk_PhysMat_SSS % \n"                         chk_PhysMat_SSS.state
  899.                                 format "chk_deepSearch % \n"                             chk_deepSearch.state
  900.                                 format "chk_quickMTL_Match % \n"                     chk_quickMTL_Match.state
  901.                                 
  902.                                 if ::g_Physical_Material then
  903.                                 (
  904.                                     spn_Spec_Map_Amount.enabled         = true
  905.                                     spn_displacement_map_amt.enabled     = true
  906.                                 )
  907.                                 else
  908.                                 (
  909.                                     spn_Spec_Map_Amount.enabled         = false
  910.                                     spn_displacement_map_amt.enabled     = false
  911.                                 )
  912.                                 ::inst_PHYS_MAT_ADJUST.spec_output_amount = spn_Spec_Map_Amount.value
  913.                             )
  914.                             on rollout_options close do
  915.                             (
  916.                                 if (setdir #scripts ::g_scriptsDefault) then
  917.                                 (
  918.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  919.                                 )
  920.                                 else
  921.                                 (
  922.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  923.                                 )
  924.                             )
  925.                             on rollout_options rolledUp state do
  926.                             (
  927.                                 if NOT state then
  928.                                 (
  929.                                     --closed
  930.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_options.height]
  931.                                 )
  932.                                 else
  933.                                 (
  934.                                     --open
  935.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_options.height]
  936.                                 )
  937.                             )
  938.                             on chk_Physical_Material changed arg do
  939.                             (
  940.                                 ::g_Physical_Material                                         = chk_Physical_Material.state        
  941.                                 format "Physical Material: %\n"                             ::g_Physical_Material 
  942.                                 
  943.                                 if ::g_Physical_Material then
  944.                                 (
  945.                                     spn_Spec_Map_Amount.enabled         = true
  946.                                     chk_PhysMat_SSS.enabled                 = true
  947.                                     spn_displacement_map_amt.enabled     = true
  948.                                 )
  949.                                 else
  950.                                 (
  951.                                     spn_Spec_Map_Amount.enabled         = false
  952.                                     chk_PhysMat_SSS.enabled                 = false
  953.                                     spn_displacement_map_amt.enabled     = false
  954.                                 )
  955.                                 ::inst_PHYS_MAT_ADJUST.spec_output_amount = spn_Spec_Map_Amount.value
  956.                             )
  957.                             on spn_Spec_Map_Amount changed arg do
  958.                             (
  959.                                 ::inst_PHYS_MAT_ADJUST.spec_output_amount = spn_Spec_Map_Amount.value
  960.                             )
  961.                             on chk_dds changed arg do
  962.                             (
  963.                                 ::g_dds                                                             = chk_dds.state        
  964.                                 format "Treat .tiff as .dds: %\n"                         ::g_dds
  965.                             )
  966.                             on chk_PhysMat_SSS changed arg do
  967.                             (
  968.                                 format "chk_PhysMat_SSS: %\n"                         chk_PhysMat_SSS.state
  969.                             )
  970.                             on chk_UVW_Flip_V changed arg do
  971.                             (
  972.                                 ::g_UVW_Flip_V                                                 = chk_UVW_Flip_V.state        
  973.                                 format "chk_UVW_Flip_V % \n"                             ::g_UVW_Flip_V
  974.                             )
  975.                             on chk_deepSearch changed arg do
  976.                             (    
  977.                                 format "chk_deepSearch % \n"                             arg
  978.                             )
  979.                             on chk_quickMTL_Match changed arg do
  980.                             (    
  981.                                 format "chk_quickMTL_Match % \n"                     arg
  982.                             )
  983.                             
  984.                         )
  985.  
  986.                         rollout rollout_Report "Report" width:290 height:150 category:9
  987.                         (
  988.                             checkbox 'chk_Mesh_Report' "Mesh Report" pos:[17,11] width:80 height:20 align:#left
  989.                             checkbox 'chk_xmlB_Report' "xmlB Report" pos:[17,31] width:78 height:20 checked:false align:#left
  990.                             checkbox 'chk_xmlB_Report_v2' "xmlB Report v2" pos:[17,50] width:110 height:20 checked:false align:#left
  991.                             checkbox 'chk_xmlB_Debug_Report' "xmlB Debug Report" pos:[17,69] width:113 height:20 align:#left
  992.                             checkbox 'chk_Build_Material_Report' "Build Material Report" pos:[17,89] width:122 height:18 enabled:true checked:false align:#left                        
  993.                             checkbox 'chk_Read_Comp_cryBones_Report' "Read Compiled Crybones Report" pos:[17,107] width:175 height:20 align:#left
  994.                             checkbox 'chk_Create_Bones_Report' "Create Bones Report" pos:[17,127] width:175 height:20 checked:false align:#left    
  995.                             checkbox 'chk_CDF_Report' "CDF Report" pos:[17,147] width:175 height:20 checked:false align:#left
  996.                             checkbox 'chk_Anim_Report' "Animation Report" pos:[17,167] width:175 height:20 checked:false align:#left
  997.                             checkbox 'chk_Heuristic_Report' "Heuristic Report" pos:[17,187] width:175 height:20 checked:false align:#left
  998.                             checkbox 'chk_MaterialRef_Report' "MaterialRef Report" pos:[17,207] width:175 height:20 checked:false align:#left
  999.                             checkbox 'chk_NameMTLRef_Report' "MTLRef Report" pos:[17,227] width:175 height:20 checked:false align:#left
  1000.                             checkbox 'chk_NametexRef_Report' "TEXRef Report" pos:[17,247] width:175 height:20 checked:false align:#left                        
  1001.                             
  1002.                             on rollout_Report open do
  1003.                             (
  1004.                                 if (setdir #scripts ::g_scriptsDefault) then
  1005.                                 (
  1006.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1007.                                 )
  1008.                                 else
  1009.                                 (
  1010.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1011.                                 )
  1012.                                 
  1013.                                 ::g_xmlB_Report_v2                             = chk_xmlB_Report_v2.state        
  1014.                                 ::g_xmlB_Debug_Report                     = chk_xmlB_Debug_Report.state
  1015.                                 ::g_Build_Material_Report                     = chk_Build_Material_Report.state
  1016.                                 ::g_xmlB_Report                                 = chk_xmlB_Report.state
  1017.                                 ::g_Mesh_Report                                 = chk_Mesh_Report.state
  1018.                                 ::g_Read_Comp_cryBones_Report         = chk_Read_Comp_cryBones_Report.state
  1019.                                 ::g_Read_Create_Bones_Report             = chk_Create_Bones_Report.state
  1020.                                 ::g_CDF_Report                                 = chk_CDF_Report.state            
  1021.                                 
  1022.                                 format "\n-----Report Options: -----\n"        
  1023.                                 format "g_xmlB_Report_v2 % \n"                         ::g_xmlB_Report_v2
  1024.                                 format "g_xmlB_Debug_Report % \n"                     ::g_xmlB_Debug_Report
  1025.                                 format "g_Build_Material_Report % \n"                     ::g_Build_Material_Report
  1026.                                 format "g_xmlB_Report % \n"                                 ::g_xmlB_Report
  1027.                                 format "g_Mesh_Report % \n"                             ::g_Mesh_Report
  1028.                                 format "g_Read_Comp_cryBones_Report % \n"         ::g_Read_Comp_cryBones_Report
  1029.                                 format "g_Read_Create_Bones_Report % \n"         ::g_Read_Create_Bones_Report
  1030.                                 format "g_CDF_Report % \n"                                 ::g_CDF_Report
  1031.                                 
  1032.                                 format "chk_Anim_Report % \n"                             chk_Anim_Report.state
  1033.                                 format "chk_Anim_Report % \n"                             chk_Heuristic_Report.state
  1034.                                 format "chk_MaterialRef_Report % \n"                     chk_MaterialRef_Report.state
  1035.                                 format "chk_NameMTLRef_Report % \n"                 chk_NameMTLRef_Report.state
  1036.                                 format "chk_NametexRef_Report % \n"                 chk_NametexRef_Report.state                            
  1037.                             )
  1038.                             on rollout_Report close do
  1039.                             (
  1040.                                 if (setdir #scripts ::g_scriptsDefault) then
  1041.                                 (
  1042.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1043.                                 )
  1044.                                 else
  1045.                                 (
  1046.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1047.                                 )
  1048.                             )
  1049.                             on rollout_Report rolledUp state do
  1050.                             (
  1051.                                 if NOT state then
  1052.                                 (
  1053.                                     --closed
  1054.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_Report.height]
  1055.                                 )
  1056.                                 else
  1057.                                 (
  1058.                                     --open
  1059.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_Report.height]
  1060.                                 )
  1061.                             )
  1062.                             on chk_xmlB_Report_v2 changed arg do
  1063.                             (
  1064.                                 ::g_xmlB_Report_v2 = chk_xmlB_Report_v2.state        
  1065.                                 format "chk_xmlB_Report_v2: %\n" ::g_xmlB_Report_v2
  1066.                             )
  1067.                             on chk_xmlB_Debug_Report changed arg do
  1068.                             (
  1069.                                 ::g_xmlB_Debug_Report = chk_xmlB_Debug_Report.state        
  1070.                                 format "chk_xmlB_Debug_Report: %\n" ::g_xmlB_Debug_Report
  1071.                             )
  1072.                             on chk_Build_Material_Report changed arg do
  1073.                             (
  1074.                                 ::g_Build_Material_Report = chk_Build_Material_Report.state        
  1075.                                 format "chk_Build_Material_Report: %\n" ::g_Build_Material_Report
  1076.                             )
  1077.                             on chk_xmlB_Report changed arg do
  1078.                             (
  1079.                                 ::g_xmlB_Report = chk_xmlB_Report.state        
  1080.                                 format "chk_xmlB_Report: %\n" ::g_xmlB_Report
  1081.                             )
  1082.                             on chk_Mesh_Report changed arg do
  1083.                             (
  1084.                                 ::g_Mesh_Report = chk_Mesh_Report.state        
  1085.                                 format "chk_Mesh_Report: %\n" ::g_Mesh_Report
  1086.                             )
  1087.                             on chk_Read_Comp_cryBones_Report changed arg do
  1088.                             (
  1089.                                 ::g_chk_Comp_cryBones_Report = chk_Read_Comp_cryBones_Report.state        
  1090.                                 format "chk_Read_Comp_cryBones_Report: %\n" ::g_chk_Comp_cryBones_Report
  1091.                             )
  1092.                             on chk_Create_Bones_Report changed arg do
  1093.                             (
  1094.                                 ::g_Create_Bones_Report = chk_Create_Bones_Report.state        
  1095.                                 format "chk_Create_Bones_Report: %\n" ::g_Create_Bones_Report
  1096.                             )
  1097.                             on chk_CDF_Report changed arg do
  1098.                             (
  1099.                                 ::g_Create_Bones_Report = chk_Create_Bones_Report.state        
  1100.                                 format "chk_Create_Bones_Report: %\n" ::g_Create_Bones_Report
  1101.                             )
  1102.                             on chk_CDF_Report changed arg do
  1103.                             (
  1104.                                 ::g_CDF_Report = chk_CDF_Report.state        
  1105.                                 format "chk_Create_Bones_Report: %\n" ::g_CDF_Report
  1106.                             )
  1107.                             on chk_Anim_Report changed arg do
  1108.                             (                        
  1109.                                 format "chk_Anim_Report: %\n" arg
  1110.                             )
  1111.                             on chk_Heuristic_Report changed arg do
  1112.                             (                        
  1113.                                 format "chk_Heuristic_Report: %\n" arg
  1114.                             )
  1115.                             on chk_MaterialRef_Report changed arg do
  1116.                             (                        
  1117.                                 format "chk_MaterialRef_Report: %\n" arg
  1118.                             )
  1119.                             on chk_NameMTLRef_Report changed arg do
  1120.                             (                        
  1121.                                 format "chk_NameMTLRef_Report: %\n" arg
  1122.                             )    
  1123.                             on chk_NametexRef_Report changed arg do
  1124.                             (                        
  1125.                                 format "chk_NametexRef_Report: %\n" arg
  1126.                             )                        
  1127.                         )
  1128.  
  1129.                         rollout rollout_animation "Animation" width:290 height:95 category:4
  1130.                         (
  1131.                             checkbox 'chk_Use_Skin_Wrap' "Use Skin_Wrap" pos:[16,17] width:255 height:21 align:#left enabled:false    
  1132.                             
  1133.                             on rollout_animation open do
  1134.                             (
  1135.                                 if (setdir #scripts ::g_scriptsDefault) then
  1136.                                 (
  1137.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1138.                                 )
  1139.                                 else
  1140.                                 (
  1141.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1142.                                 )
  1143.                             )
  1144.                             on rollout_animation close do
  1145.                             (
  1146.                                 if (setdir #scripts ::g_scriptsDefault) then
  1147.                                 (
  1148.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1149.                                 )
  1150.                                 else
  1151.                                 (
  1152.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1153.                                 )
  1154.                             )
  1155.                             on chk_Use_Skin_Wrap changed arg do
  1156.                             (
  1157.                                 ::g_Use_Skin_Wrap = chk_Use_Skin_Wrap.state        
  1158.                                 format "chk_Use_Skin_Wrap: %\n" ::g_Use_Skin_Wrap
  1159.                             )
  1160.                             on rollout_animation rolledUp state do
  1161.                             (
  1162.                                 if NOT state then
  1163.                                 (
  1164.                                     --closed
  1165.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_animation.height]
  1166.                                 )
  1167.                                 else
  1168.                                 (
  1169.                                     --open
  1170.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_animation.height]
  1171.                                 )
  1172.                             )
  1173.                         )
  1174.  
  1175.                         rollout rollout_About "About" width:290 height:50 category:10
  1176.                         (
  1177.                             label 'lbl_About' "joqqyhez@gmail.com  2016" pos:[14,13] width:263 height:19 align:#left
  1178.                             label 'lbl_trademark' "CRYENGINE is a Trademark of Crytek GmbH" pos:[13,35] width:266 height:20 align:#left                        
  1179.                             
  1180.                             on rollout_About open do
  1181.                             (
  1182.                                 if (setdir #scripts ::g_scriptsDefault) then
  1183.                                 (
  1184.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1185.                                 )
  1186.                                 else
  1187.                                 (
  1188.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1189.                                 )
  1190.                             )    
  1191.                             on rollout_About close do
  1192.                             (
  1193.                                 if (setdir #scripts ::g_scriptsDefault) then
  1194.                                 (
  1195.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1196.                                 )
  1197.                                 else
  1198.                                 (
  1199.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1200.                                 )
  1201.                             )                        
  1202.                             on rollout_About rolledUp state do
  1203.                             (                            
  1204.                                 if NOT state then
  1205.                                 (
  1206.                                     --closed
  1207.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_About.height]
  1208.                                 )
  1209.                                 else
  1210.                                 (
  1211.                                     --open
  1212.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_About.height]
  1213.                                 )
  1214.                             )
  1215.                         )
  1216.  
  1217.                         rollout rollout_Alert "Alert" width:290 height:85 category:8
  1218.                         (
  1219.                             listBox 'lbx_Message_Alert' "Message Alert" pos:[12,20] width:267 height:7 align:#left                        
  1220.                             
  1221.                             on rollout_Alert open do
  1222.                             (
  1223.                                 if (setdir #scripts ::g_scriptsDefault) then
  1224.                                 (
  1225.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1226.                                 )
  1227.                                 else
  1228.                                 (
  1229.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1230.                                 )
  1231.                             )    
  1232.                             on rollout_Alert close do
  1233.                             (
  1234.                                 if (setdir #scripts ::g_scriptsDefault) then
  1235.                                 (
  1236.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1237.                                 )
  1238.                                 else
  1239.                                 (
  1240.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1241.                                 )
  1242.                             )    
  1243.                             on rollout_Alert rolledUp state do
  1244.                             (
  1245.                                 if NOT state then
  1246.                                 (
  1247.                                     --closed
  1248.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_Alert.height]
  1249.                                 )
  1250.                                 else
  1251.                                 (
  1252.                                     --open
  1253.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_Alert.height]
  1254.                                 )
  1255.                             )
  1256.                         )
  1257.                         
  1258.                         rollout rollout_AnimationTracks "Animation Tracks" width:100 height:20 category:5
  1259.                         (
  1260.                             dropdownList 'ddl_Animation_Tracks' "Animation Tracks" pos:[8,20] width:265 height:30 items:#() align:#left
  1261.                             
  1262.                             on rollout_AnimationTracks open do
  1263.                             (
  1264.                                 if (setdir #scripts ::g_scriptsDefault) then
  1265.                                 (
  1266.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1267.                                 )
  1268.                                 else
  1269.                                 (
  1270.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1271.                                 )
  1272.                             )
  1273.                             on rollout_AnimationTracks close do
  1274.                             (
  1275.                                 if (setdir #scripts ::g_scriptsDefault) then
  1276.                                 (
  1277.                                     format "Current Scripts Dir set to #scripts: %\n" (getdir #scripts)
  1278.                                 )
  1279.                                 else
  1280.                                 (
  1281.                                     format "Current #scripts dir: %\n" (getdir #scripts)
  1282.                                 )
  1283.                             )    
  1284.                             on rollout_AnimationTracks rolledUp state do
  1285.                             (
  1286.                                 if NOT state then
  1287.                                 (
  1288.                                     --closed
  1289.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]-rollout_AnimationTracks.height]
  1290.                                 )
  1291.                                 else
  1292.                                 (
  1293.                                     --open
  1294.                                     CRYOP.size = [CRYOP.size[1], CRYOP.size[2]+rollout_AnimationTracks.height]
  1295.                                 )
  1296.                             )
  1297.                         )
  1298.  
  1299.                         --/////////////////////////////// Instanciate the rollouts ///////////////////////////////
  1300.                         CRYOP = newRolloutFloater "CryEngine Importer v 1.0" 290 735
  1301.  
  1302.                         addRollout             ::rollout_options         ::CRYOP  rolledUp:true
  1303.                         addRollout             ::rollout_Report         ::CRYOP rolledUp:true
  1304.                         addRollout             ::cryImport             ::CRYOP rolledUp:false
  1305.                         addRollout             ::rollout_animation     ::CRYOP rolledUp:true
  1306.                         -- addRollout             ::rollout_Alert             ::CRYOP rolledUp:false --set runtime instead inside CryMat_XML_.ms
  1307.                         addRollout             ::rollout_About         ::CRYOP rolledUp:true                    
  1308.  
  1309.                         CreateDialog         ::cryImport     rolledUp:false width:120 height:200        
  1310.                         --//////////////////////////////////////////////////////////////////////////////////////
  1311.                     )
  1312.                     else
  1313.                     (
  1314.                         delete_ini()
  1315.                         MessageBox "Cannot find or load the include files, cannot continue, aborting!" title:"Startup Error" beep:false
  1316.                     )
  1317.                 )
  1318.                 else
  1319.                 (
  1320.                     delete_ini()
  1321.                     format "Could not set the #scripts path - include files will not load - aborting!\n"
  1322.                 )    
  1323.             )
  1324.             catch
  1325.             (
  1326.                 delete_ini()
  1327.                 format "\n\n\n\n*** *** *** *** *** ***  Could not load include files ***  *** *** *** *** *** ***\n"
  1328.                 format "%" (getCurrentException())
  1329.                 format "\n*** *** *** *** *** *** END OF Could not load include files *** *** *** *** *** *** ***\n\n\n\n"
  1330.             )
  1331.         )
  1332.         else
  1333.         (
  1334.             delete_ini()
  1335.             MessageBox "Cannot find scriptpath, cannot continue, aborting!" title:"Startup Error" beep:false    
  1336.         )
  1337.  
  1338.         gc()
  1339.     )
  1340.     else
  1341.     (
  1342.         format "No ini file ( % ) found - aborting! (Make sure your user temp\n" ::g_iniFile
  1343.     )
  1344. )
  1345. else
  1346. (
  1347.     MessageBox "This script requires 3DS Max 2017 or higher!" title:"Startup Error" beep:true
  1348. )