public static T FindPreset <T>(string name) where T : PumkinPreset { object preset = null; if (typeof(T) == typeof(PumkinsCameraPreset)) { preset = CameraPresets.Find(o => o.name.ToLower() == name.ToLower()); } else if (typeof(T) == typeof(PumkinsCameraPreset)) { preset = PosePresets.Find(o => o.name.ToLower() == name.ToLower()); } else if (typeof(T) == typeof(PumkinsBlendshapePreset)) { preset = BlendshapePresets.Find(o => o.name.ToLower() == name.ToLower()); } return((T)preset); }
public static int GetPresetIndex <T>(T preset) where T : PumkinPreset { int i = -1; if (typeof(T) == typeof(PumkinsCameraPreset)) { i = CameraPresets.IndexOf(preset as PumkinsCameraPreset); } else if (typeof(T) == typeof(PumkinsPosePreset)) { i = PosePresets.IndexOf(preset as PumkinsPosePreset); } else if (typeof(T) == typeof(PumkinsBlendshapePreset)) { i = BlendshapePresets.IndexOf(preset as PumkinsBlendshapePreset); } return(i); }
public static int GetPresetIndex <T>(string name) where T : PumkinPreset { int i = -1; if (typeof(T) == typeof(PumkinsCameraPreset)) { i = CameraPresets.FindIndex(o => o.name.ToLower() == name.ToLower()); } else if (typeof(T) == typeof(PumkinsPosePreset)) { i = PosePresets.FindIndex(o => o.name.ToLower() == name.ToLower()); } else if (typeof(T) == typeof(PumkinsBlendshapePreset)) { i = BlendshapePresets.FindIndex(o => o.name.ToLower() == name.ToLower()); } return(i); }