Ejemplo n.º 1
0
        //[MenuItem("Assets/MeshSync/Download DCC Plugins", false, 100)]
        static void DownloadDCCPlugins()
        {
            //Actual plugin name: UnityMeshSync_<version>_<postfix>
            string[] dccPlatformNames =
            {
                "3DSMAX_Windows.zip",
                "Blender_Linux.zip",
                "Blender_Mac.zip",
                "Blender_Windows.zip",
                "Maya_Linux.zip",
                "Maya_Mac.zip",
                "Maya_Windows.zip",
                "Metasequoia_Windows.zip",
                "MotionBuilder_Linux.zip",
                "MotionBuilder_Windows.zip"
            };

            string destFolder = EditorUtility.OpenFolderPanel("Select copy destination", "", "");

            if (string.IsNullOrEmpty(destFolder))
            {
                return;
            }


            DCCPluginDownloader downloader = new DCCPluginDownloader(true, destFolder, dccPlatformNames);

            downloader.Execute((string version, List <string> dccPluginLocalPaths) => {
                Debug.Log("Downloaded " + dccPluginLocalPaths.Count
                          + "MeshSync DCC Plugins to " + destFolder + " Version: " + version);
                EditorUtility.RevealInFinder(destFolder);
            }, () => {
                Debug.LogError("Failed to download MeshSync DCC plugins.");
            });
        }
Ejemplo n.º 2
0
//----------------------------------------------------------------------------------------------------------------------    
    internal void Integrate(string requestedPluginVersion, Action onComplete) {

        string dccToolName = GetDCCToolInFileNameV();
        string dccPluginFileName = dccToolName + "_" + GetCurrentDCCPluginPlatform() + ".zip";
    
        //Make sure the DCC plugin zip file exists first
        DCCPluginDownloader downloader = new DCCPluginDownloader(false, 
            new string[] { dccPluginFileName }
        );
        
        string dccDesc = m_dccToolInfo.GetDescription();

        string progressBarInfo = "Installing plugin for " + dccDesc;
        EditorUtility.DisplayProgressBar("MeshSync", progressBarInfo,0);
        downloader.Execute( requestedPluginVersion, 
            /*onSuccess=*/ (string pluginVersion, List<string> dccPluginLocalPaths) => {
                EditorUtility.DisplayProgressBar("MeshSync", progressBarInfo, 0.5f);
                if (dccPluginLocalPaths.Count <= 0 || !File.Exists(dccPluginLocalPaths[0])) {
                    HandleFailedIntegration(GetLastErrorMessage(), dccDesc);
                    return;                    
                }
                
                bool dccConfigured = DCCIntegrationUtility.InstallDCCPlugin(this, m_dccToolInfo, pluginVersion, dccPluginLocalPaths[0]);
                if (!dccConfigured) {
                    HandleFailedIntegration(GetLastErrorMessage(), dccDesc);
                    return;
                }
                
                EditorUtility.ClearProgressBar();
                FinalizeDCCConfigurationV();
                
                onComplete();
            }, 
            /*onFail=*/ () => {
                Debug.LogError("[MeshSync] Failed to download DCC Plugin for " + dccDesc);
                EditorUtility.ClearProgressBar();
            }
        );
    }
Ejemplo n.º 3
0
//----------------------------------------------------------------------------------------------------------------------    
    internal void Integrate(Action onComplete) {

        string dccToolName = GetDCCToolInFileNameV();
        string dccPluginFileName = dccToolName + "_" + GetCurrentDCCPluginPlatform() + ".zip";
    
        //Make sure the DCC plugin zip file exists first
        DCCPluginDownloader downloader = new DCCPluginDownloader(false,SAVED_PLUGINS_FOLDER, 
            new string[] { dccPluginFileName }
        );
        
        string dccDesc = m_dccToolInfo.GetDescription();

        string progressBarInfo = "Installing plugin for " + dccDesc;
        EditorUtility.DisplayProgressBar("MeshSync", progressBarInfo,0);
        downloader.Execute((string pluginVersion, List<string> dccPluginLocalPaths) => {

            EditorUtility.DisplayProgressBar("MeshSync", progressBarInfo, 0.5f);
            bool dccConfigured = false;
            if (dccPluginLocalPaths.Count >0 && File.Exists(dccPluginLocalPaths[0])) {
                
                //Extract
                string localPluginPath = dccPluginLocalPaths[0];
                string tempPath = FileUtil.GetUniqueTempPathInProject();        
                Directory.CreateDirectory(tempPath);
                ZipUtility.UncompressFromZip(localPluginPath, null, tempPath);
                
                dccConfigured = ConfigureDCCToolV(m_dccToolInfo, Path.GetFileNameWithoutExtension(localPluginPath),tempPath);
                
                //Cleanup
                FileUtility.DeleteFilesAndFolders(tempPath);
                
            }
            
            if (!dccConfigured) {
                HandleFailedIntegration("Failed in configuring DCC ", dccDesc);
                return;
            }

            string installInfoPath = DCCPluginInstallInfo.GetInstallInfoPath(m_dccToolInfo);
            string installInfoFolder = Path.GetDirectoryName(installInfoPath);
            if (null == installInfoPath || null == installInfoFolder) {
                HandleFailedIntegration($"Invalid path: {installInfoPath}",dccDesc);
                return;
            }

            //Write DCCPluginInstallInfo for the version
            Directory.CreateDirectory(installInfoFolder);

            DCCPluginInstallInfo installInfo =  FileUtility.DeserializeFromJson<DCCPluginInstallInfo>(installInfoPath);
            if (null == installInfo) {
                installInfo = new DCCPluginInstallInfo();
            }
            installInfo.SetPluginVersion(m_dccToolInfo.AppPath, pluginVersion);
    
            try {
                FileUtility.SerializeToJson(installInfo, installInfoPath);
            } catch (Exception e) {
                HandleFailedIntegration(e.ToString(), dccDesc);
                return;
            }
            
            EditorUtility.ClearProgressBar();
            FinalizeDCCConfigurationV();
            
            onComplete();
        }, () => {
            Debug.LogError("[MeshSync] Failed to download DCC Plugin for " + dccDesc);
            EditorUtility.ClearProgressBar();
        });
    }