private static void SendAssetToSP() { // Get the currently selected mesh game object MeshInfo[] meshesInfo = MaterialsManipulation.GetSelectedMeshesInfo(); switch (meshesInfo.Length) { case 0: EditorUtility.DisplayDialog("Substance Painter", "You need to select one compatible mesh game object in the scene hierarchy respecting prerequisites:\n" + "- the mesh must be an fbx file imported in project assets\n" + "- materials must use the 'Standard' shader\n" + "- materials names must be the default ones (as defined in the mesh)", "OK"); break; case 1: SendMeshToSP(meshesInfo[0]); break; default: ItemSelectorWindow.ShowSelect( "Send to Substance Painter", "Select the mesh to send to Substance Painter", meshesInfo.ToList().Select(info => info.AssetPath).ToArray(), index => SendMeshToSP(meshesInfo[index])); break; } }
// Disable the verification for GameObject menu entry as it doesn't work // on game objects contextual menu // Instead, pop a dialog to alert on prerequisites to follow // [MenuItem(SendGameObjectMenuPath, true)] private static bool ValidateSendAssetToSP() { return(MaterialsManipulation.GetSelectedMeshesInfo().Length > 0); }