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