//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ZFileUtils Globals VARIABLES
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[VarDef,isMac,0]//do we have a Mac or PC
[VarDef,Zvers,0]//ZBrush version
[VarDef,dllPath,""]//plugin DLL path
[VarDef,dllVersion,0]//plugin DLL version
[VarDef,err,0]//standard error
[VarDef,folderName,""]//folder path/name
[VarDef,fileName,""]//file path/name
[VarDef,copyFileName, ""]// Name of file to copy to
[VarSet,index,0] //seems unused
/* Unused Global Variables :
[VarDef,fileCount, 0]// Number of files loaded -- unused
//[VarDef,gSharedPath,""] //path to shared/public MyPluginData folder
*/
// Get current language
// @returns the current language index2
[RoutineDef, ZFU_GetCurrentLanguage,[VarSet, lang, [FileExecute, [Var, dllPath], GetCurrentLanguage]]
, lang]
// Register localization files for the plugin
// @enFilePath: path to the english xml localization file, must be formated "[name]en.xml"
// other languages are deduced as being "[name]fr.xml", "[name]jp.xml", etc...
[RoutineDef, ZFU_RegisterLocalizationFile,[FileExecute, [Var, dllPath], RegisterLocalizationFile, enFilePath]
, enFilePath]
[RoutineDef, ZFU_LocalizeText,[If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]]
[If, [FileExecute, [Var, dllPath], GetLocalizedText, text,, ZFU_Mem_Temp],,
[MemReadString, ZFU_Mem_Temp, text]
]
[MemDelete, ZFU_Mem_Temp]
, text]
[RoutineDef, ZFU_LocalizeTitle,[If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]]
[If, [FileExecute, [Var, dllPath], GetLocalizedTitle, text,, ZFU_Mem_Temp],,
[MemReadString, ZFU_Mem_Temp, text]
]
[MemDelete, ZFU_Mem_Temp]
, text]
[RoutineDef, ZFU_LocalizeInfo,[If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]]
[If, [FileExecute, [Var, dllPath], GetLocalizedInfo, text,, ZFU_Mem_Temp],,
[MemReadString, ZFU_Mem_Temp, text]
]
[MemDelete, ZFU_Mem_Temp]
, text]
[RoutineDef, ZFU_LocalizeDescr,[If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]]
[If, [FileExecute, [Var, dllPath], GetLocalizedDescr, text,, ZFU_Mem_Temp],,
[MemReadString, ZFU_Mem_Temp, text]
]
[MemDelete, ZFU_Mem_Temp]
, text]
[RoutineDef, ZFU_StrReplaceArg,[If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]]
[MemWriteString, ZFU_Mem_Temp, text]
[If, [FileExecute, [Var, dllPath], StrReplaceArg, argText, argIndex, ZFU_Mem_Temp],,
[MemReadString, ZFU_Mem_Temp, text]
]
[MemDelete, ZFU_Mem_Temp]
, text, argIndex, argText]
[RoutineDef, CheckSystem,//check ZBrush version
[VarSet,Zvers,[ZBrushInfo,0]]
[If,[Val,Zvers] >= 4.8,,
[Note,"\Cff9923This zscript\Cffffff is not designed for this version of \Cff9923ZBrush\Cffffff.",,3,4737096,,300]
]
[VarSet,isMac, [ZBrushInfo,6]] //check Mac or PC
// Make sure we have the dll and set its path
[If,[ZBrushInfo,16]==64,//64 bit
//use the path below for testing only
//[VarSet,dllPath,"zgametoolsData/ZFileUtils.lib"]
//use the path below for installed plugins
//[VarSet,dllPath,"ZBRUSH_ZSTARTUP/ZPlugs64/zgametoolsData/ZFileUtils.lib"]
[VarSet,dllPath,"ztexturerdata/ZFileUtils.lib"]
//use the path below for testing only
//[VarSet,dllPath,"zgametoolsData\ZFileUtils64.dll"]
//use the path below for installed plugins
//[VarSet,dllPath,"ZBRUSH_ZSTARTUP\ZPlugs64\zgametool sData\ZFileUtils64.dll"]
[VarSet,dllPath,"ztexturerdata\ZFileUtils64.dll"]
,//else 32 bit - no longer supported
[Note,"\Cff9923This zscript\Cffffff is not designed for this version of \Cff9923ZBrush\Cffffff.",,3,4737096,,300]
]
[If, [FileExists, [Var,dllPath]],
//check that correct version
[VarSet, dllVersion, [FileExecute, [Var,dllPath], Version]]
[If, [Val,dllVersion] >= 4.8,//dll version
[Note,"\Cff9923Note :\Cc0c0c0 The \Cff9923 ZFileUtils plugin \CffffffDLL\Cc0c0c0 is an earlier version which does not support this plugin. Please install correct version."]
, // else no DLL.
[Note,"\Cff9923Note :\Cc0c0c0 The \Cff9923 ZFileUtils plugin \CffffffDLL\Cc0c0c0 could not be found at the correct location. Please re-install the plugin, making sure the relevant files and folders are in the \CffffffZStartup/ZPlugs\Cc0c0c0 folder."]
]
]//end routine
//Routine to Initialize ZFUtilsTests, set up a language file
[RoutineDef, InitZFUtilsTests,// Initialize localization
[RoutineCall, ZFU_RegisterLocalizationFile, [FileNameResolvePath, "zTexturerData/lang/ztexturer_en.xml"]]
]
[RoutineCall, InitZFUtilsTests]
[RoutineCall, CheckSystem]