浏览代码

documented display name methods

/usim-randomization
Steven Leal 4 年前
当前提交
fd4ab9ac
共有 3 个文件被更改,包括 10 次插入10 次删除
  1. 4
      com.unity.perception/Editor/Randomization/ParameterElement.cs
  2. 7
      com.unity.perception/Runtime/Randomization/Parameters/Parameter.cs
  3. 9
      com.unity.perception/Runtime/Randomization/Samplers/SamplerUtility.cs

4
com.unity.perception/Editor/Randomization/ParameterElement.cs


removeButton.RegisterCallback<MouseUpEvent>(evt => paramConfigEditor.RemoveParameter(this));
var parameterTypeLabel = this.Query<Label>("parameter-type-label").First();
parameterTypeLabel.text = parameter.displayName;
parameterTypeLabel.text = Parameter.GetDisplayName(parameter.GetType());
var parameterNameField = this.Q<TextField>("name");
parameterNameField.isDelayed = true;

m_TargetPropertyMenu.menu.MenuItems().Clear();
m_TargetPropertyMenu.text = parameter.target.propertyName == string.Empty
? "Select a property"
: TargetPropertyDisplayText(parameter.target);
: Parameter.GetDisplayName(parameter.GetType());
var options = GatherPropertyOptions(parameter.target.gameObject, parameter.sampleType);
foreach (var option in options)

7
com.unity.perception/Runtime/Randomization/Parameters/Parameter.cs


/// Returns the display name of a parameter type
/// </summary>
/// <param name="type">A subclass of Parameter</param>
/// <returns>A parameter type's display name</returns>
/// <returns>The parameter type's display name</returns>
public static string GetDisplayName(Type type)
{
return type.Name.Replace("Parameter", "");

/// An array containing a reference to each sampler field in this parameter
/// </summary>
public abstract ISampler[] samplers { get; }
/// <summary>
/// The display name of this parameter's sample type
/// </summary>
public virtual string displayName => GetDisplayName(GetType());
/// <summary>
/// Constructs a new parameter

9
com.unity.perception/Runtime/Randomization/Samplers/SamplerUtility.cs


internal const uint largePrime = 0x202A96CF;
const int k_SamplingBatchSize = 64;
internal static string GetSamplerDisplayName(Type sampleType)
/// <summary>
/// Returns the sampler's display name
/// </summary>
/// <param name="samplerType">The sampler type</param>
/// <returns>The display name</returns>
public static string GetSamplerDisplayName(Type samplerType)
return sampleType.Name.Replace("Sampler", string.Empty);
return samplerType.Name.Replace("Sampler", string.Empty);
}
/// <summary>

正在加载...
取消
保存