//---------------------------------------------------------------------------------------------------------------------- #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); } }