68 lines
No EOL
2.6 KiB
C#
68 lines
No EOL
2.6 KiB
C#
using System;
|
|
using JD.Nas.Service;
|
|
using JD.Shotgun.Service.ShotgunEntities;
|
|
|
|
namespace Orbit.AfterEffects.Helpers
|
|
{
|
|
public static class ShotgunToNas
|
|
{
|
|
//public static string GetStudioCode(ShotgunProductionStudio shotgunStudio)
|
|
//{
|
|
// switch (shotgunStudio)
|
|
// {
|
|
// case ShotgunProductionStudio.Paris:
|
|
// return "MRC";
|
|
|
|
// case ShotgunProductionStudio.Pune:
|
|
// return "PUN";
|
|
|
|
// case ShotgunProductionStudio.Shanghai:
|
|
// return "SHA";
|
|
|
|
// default:
|
|
// throw new ArgumentException($"Unknown {nameof(ShotgunProductionStudio)} '{shotgunStudio}'. Known studios are {string.Join(", ", Enum.GetNames(typeof(ShotgunProductionStudio)))}.");
|
|
// }
|
|
//}
|
|
|
|
public static ProjectType GetProjectType(ShotgunAssetType assetType)
|
|
{
|
|
if (assetType == ShotgunAssetType.Coach)
|
|
{
|
|
return ProjectType.Coach;
|
|
}
|
|
|
|
if (assetType == ShotgunAssetType.Fx)
|
|
{
|
|
return ProjectType.Fx;
|
|
}
|
|
|
|
throw new InvalidOperationException($"Unknown asset type '{assetType}'.");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Return the path to the After Effect file project.
|
|
/// The path will be automatically converted with the N: drive mapping.
|
|
/// </summary>
|
|
/// <param name="asset">The asset to return the project file path</param>
|
|
/// <param name="studioCode">The code of the studio, eg. MRC</param>
|
|
/// <returns>The project file path mapped to the N drive</returns>
|
|
public static string GetAfterEffectsFilePath(this INasService nasService, ShotgunMapAsset asset, string studioCode)
|
|
{
|
|
if (!nasService.IsNPathValid(out string errors))
|
|
{
|
|
throw new InvalidOperationException($"The NAS Network Drive not mapped correctly: {errors}");
|
|
}
|
|
|
|
string projectCode = asset.NasProjectCodeName;
|
|
string mapName = asset.MapName;
|
|
string assetShortName = asset.ShortName;
|
|
|
|
ProjectType projectType = GetProjectType(asset.AssetType);
|
|
|
|
string afterEffectsProjectFilePath = nasService.GetAfterEffectsFilePath(projectCode, studioCode, mapName, projectType, assetShortName);
|
|
|
|
// We need to convert to a studio agnostic the path of the file, so the render farm will use its local file location
|
|
return nasService.ConvertToNPath(afterEffectsProjectFilePath, studioCode);
|
|
}
|
|
}
|
|
} |