Exemple #1
0
//----------------------------------------------------------------------------------------------------------------------

        #region Button callbacks
        void OnAddDCCToolButtonClicked()
        {
            string folder = EditorUtility.OpenFolderPanel("Add DCC Tool", m_lastOpenedFolder, "");

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

            m_lastOpenedFolder = folder;

            //Find the path to the actual app
            DCCToolType lastDCCToolType = DCCToolType.AUTODESK_MAYA;
            DCCToolInfo dccToolInfo     = null;

            for (int i = 0; i < (int)(DCCToolType.NUM_DCC_TOOL_TYPES) && null == dccToolInfo; ++i)
            {
                lastDCCToolType = (DCCToolType)(i);
                dccToolInfo     = DCCFinderUtility.FindDCCToolInDirectory(lastDCCToolType, null, m_lastOpenedFolder);
            }

            if (null == dccToolInfo)
            {
                EditorUtility.DisplayDialog("MeshSync Project Settings", "No DCC Tool is detected", "Ok");
                return;
            }

            //Add
            MeshSyncEditorSettings settings = MeshSyncEditorSettings.GetOrCreateSettings();

            if (settings.AddDCCTool(dccToolInfo))
            {
                Setup(m_root);
            }
        }
        void OnAddDCCToolButtonClicked(EventBase evt)
        {
            string path = null;

            if (Application.platform == RuntimePlatform.OSXEditor)
            {
                path = OpenFilePanel();
            }
            else
            {
                path = OpenFolderPanel();
            }

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

            //Find the path to the actual app
            DCCToolType lastDCCToolType = DCCToolType.AUTODESK_MAYA;
            DCCToolInfo dccToolInfo     = null;

            for (int i = 0; i < (int)(DCCToolType.NUM_DCC_TOOL_TYPES) && null == dccToolInfo; ++i)
            {
                lastDCCToolType = (DCCToolType)(i);
                dccToolInfo     = DCCFinderUtility.FindDCCToolInDirectory(lastDCCToolType, null, path);
            }

            if (null == dccToolInfo)
            {
                EditorUtility.DisplayDialog("MeshSync Project Settings", "No DCC Tool is detected", "Ok");
                return;
            }

            MeshSyncEditorSettings settings = MeshSyncEditorSettings.GetOrCreateSettings();

            if (settings.AddDCCTool(dccToolInfo))
            {
                //Add to ScrollView
                VisualTreeAsset dccToolInfoTemplate = UIElementsEditorUtility.LoadVisualTreeAsset(
                    MeshSyncEditorConstants.DCC_TOOL_INFO_TEMPLATE_PATH
                    );
                ScrollView scrollView = GetEventButtonUserDataAs <ScrollView>(evt.target);
                Assert.IsNotNull(scrollView);
                AddDCCToolSettingsContainer(dccToolInfo, scrollView, dccToolInfoTemplate);
            }
        }
Exemple #3
0
        internal static DCCToolInfo FindDCCToolInDirectory(DCCToolType toolType, string version, string dir)
        {
            switch (toolType)
            {
            case DCCToolType.AUTODESK_MAYA: {
                return(FindMayaInDirectory(dir, version));
            }

            case DCCToolType.AUTODESK_3DSMAX: {
                return(Find3DSMaxInDirectory(dir, version));
            }

            case DCCToolType.BLENDER: {
                return(FindBlenderInDirectory(dir, version));
            }

            default:
                throw new NotImplementedException();
            }
        }
//----------------------------------------------------------------------------------------------------------------------

        HashSet <string> FindUniqueVersionsOfSupportedDCCTools(DCCToolType dccToolType)
        {
            HashSet <string> versions = new HashSet <string>();

            foreach (KeyValuePair <string, DCCToolInfo> dccToolInfo in MeshSyncEditorConstants.SUPPORTED_DCC_TOOLS_BY_FOLDER)
            {
                if (dccToolInfo.Value.Type != dccToolType)
                {
                    continue;
                }

                string curVer = dccToolInfo.Value.DCCToolVersion;
                if (versions.Contains(curVer) || string.IsNullOrEmpty(curVer))
                {
                    continue;
                }

                versions.Add(curVer);
            }

            return(versions);
        }
Exemple #5
0
        internal static DCCToolInfo FindDCCToolInDirectory(DCCToolType toolType, string version, string dir)
        {
#if UNITY_EDITOR_WIN
            dir = dir.Replace("/", "\\");
#endif

            switch (toolType)
            {
            case DCCToolType.AUTODESK_MAYA: {
                return(FindMayaInDirectory(dir, version));
            }

            case DCCToolType.AUTODESK_3DSMAX: {
                return(Find3DSMaxInDirectory(dir, version));
            }

            case DCCToolType.BLENDER: {
                return(FindBlenderInDirectory(dir, version));
            }

            default:
                throw new NotImplementedException();
            }
        }
Exemple #6
0
 internal DCCToolInfo(DCCToolType type, string dccToolVersion)
 {
     Type           = type;
     DCCToolVersion = dccToolVersion;
 }