/// <summary> /// A patched variant of <see cref="Parameter.Choice.getChoiceOptions()"/> that doesn't commit <see href="https://www.youtube.com/watch?v=Lebv2-ptzWY"/> when you call it.<para/> /// This returns a string array of every option name that displays in the dropdown menu of the ThreeRings Model Editor, should there be a multi-choice option on a model. /// </summary> /// <param name="choice">The choice to get the list of options from.</param> /// <returns></returns> public static string[] GetChoiceOptions(this Parameter.Choice choice) { string[] options = new string[choice.options.Length]; for (int index = 0; index < choice.options.Length; index++) { options[index] = choice.options[index].name; } return(options); }
/// <summary> /// Returns the default option of this choice. Will return null if it couldn't be found for whatever reason. /// </summary> /// <param name="choice">The choice to get the default option from.</param> /// <returns></returns> public static Parameter.Choice.Option GetDefaultOption(this Parameter.Choice choice) { return(choice.options.Where(opt => opt.name == choice.choice).FirstOrDefault()); }