Steven Leal
4 年前
当前提交
ce61e59b
共有 31 个文件被更改,包括 216 次插入 和 109 次删除
-
4com.unity.perception/Editor/Randomization/ParameterConfigurationEditor.cs
-
2com.unity.perception/Editor/Randomization/ParameterElement.cs
-
6com.unity.perception/Editor/Randomization/SamplerElement.cs
-
6com.unity.perception/Editor/Randomization/StaticData.cs
-
2com.unity.perception/Runtime/Randomization/Parameters/NumericParameter.cs
-
5com.unity.perception/Runtime/Randomization/Parameters/Parameter.cs
-
6com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/BooleanParameter.cs
-
21com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/ColorHsvaParameter.cs
-
9com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/FloatParameter.cs
-
3com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/GameObjectParameter.cs
-
6com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/IntegerParameter.cs
-
3com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/MaterialParameter.cs
-
3com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/StringParameter.cs
-
13com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector2Parameter.cs
-
17com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector3Parameter.cs
-
23com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector4Parameter.cs
-
6com.unity.perception/Runtime/Randomization/Samplers/FloatRange.cs
-
2com.unity.perception/Runtime/Randomization/Samplers/SamplerTypes/ConstantSampler.cs
-
2com.unity.perception/Runtime/Randomization/Samplers/SamplerTypes/NormalSampler.cs
-
2com.unity.perception/Runtime/Randomization/Samplers/SamplerTypes/UniformSampler.cs
-
61com.unity.perception/Runtime/Randomization/Samplers/SamplerUtility.cs
-
7com.unity.perception/Tests/Runtime/Randomization/SamplerTests/ConstantSamplerTests.cs
-
13com.unity.perception/Tests/Runtime/Randomization/SamplerTests/RangedSamplerTests.cs
-
33com.unity.perception/Runtime/Randomization/Parameters/ParameterDisplayName.cs
-
33com.unity.perception/Runtime/Randomization/Samplers/SamplerDisplayName.cs
-
16com.unity.perception/Tests/Runtime/Randomization/SamplerTests/FloatRangeTests.cs
-
3com.unity.perception/Tests/Runtime/Randomization/SamplerTests/FloatRangeTests.cs.meta
-
18com.unity.perception/Runtime/Randomization/Samplers/SamplerMetaData.cs
-
0/com.unity.perception/Runtime/Randomization/Samplers/SamplerDisplayName.cs.meta
-
0/com.unity.perception/Runtime/Randomization/Parameters/ParameterDisplayName.cs.meta
|
|||
using System; |
|||
|
|||
namespace UnityEngine.Perception.Randomization.Parameters |
|||
{ |
|||
/// <summary>
|
|||
/// Defines the label used to identify a parameter types in a parameter configuration
|
|||
/// </summary>
|
|||
[AttributeUsage(AttributeTargets.Class)] |
|||
public class ParameterDisplayName : Attribute |
|||
{ |
|||
/// <summary>
|
|||
/// Returns the ParameterDisplayName attribute annotating a particular parameter type
|
|||
/// </summary>
|
|||
/// <param name="type">The type of parameter</param>
|
|||
/// <returns>A ParameterDisplayName attribute</returns>
|
|||
public static ParameterDisplayName GetDisplayName(Type type) => |
|||
(ParameterDisplayName)GetCustomAttribute(type, typeof(ParameterDisplayName)); |
|||
|
|||
/// <summary>
|
|||
/// The parameter label string
|
|||
/// </summary>
|
|||
public string displayName; |
|||
|
|||
/// <summary>
|
|||
/// Constructs a new ParameterDisplayName attribute
|
|||
/// </summary>
|
|||
/// <param name="displayName">The parameter label string</param>
|
|||
public ParameterDisplayName(string displayName) |
|||
{ |
|||
this.displayName = displayName; |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
|
|||
namespace UnityEngine.Perception.Randomization.Samplers |
|||
{ |
|||
/// <summary>
|
|||
/// Defines the label used to identify a sampler types in the sampler drop down menu
|
|||
/// </summary>
|
|||
[AttributeUsage(AttributeTargets.Struct)] |
|||
public class SamplerDisplayName : Attribute |
|||
{ |
|||
/// <summary>
|
|||
/// Returns the SamplerDisplayName attribute annotating a particular sampler type
|
|||
/// </summary>
|
|||
/// <param name="type">The type of sampler</param>
|
|||
/// <returns>A SamplerDisplayName attribute</returns>
|
|||
public static SamplerDisplayName GetDisplayName(Type type) => |
|||
(SamplerDisplayName)GetCustomAttribute(type, typeof(SamplerDisplayName)); |
|||
|
|||
/// <summary>
|
|||
/// The sampler label string
|
|||
/// </summary>
|
|||
public string displayName; |
|||
|
|||
/// <summary>
|
|||
/// Constructs a new SamplerDisplayName attribute
|
|||
/// </summary>
|
|||
/// <param name="displayName">The sampler label string</param>
|
|||
public SamplerDisplayName(string displayName) |
|||
{ |
|||
this.displayName = displayName; |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using NUnit.Framework; |
|||
using UnityEngine.Perception.Randomization.Samplers; |
|||
|
|||
namespace RandomizationTests.SamplerTests |
|||
{ |
|||
[TestFixture] |
|||
public class FloatRangeTests |
|||
{ |
|||
[Test] |
|||
public void InvalidRange() |
|||
{ |
|||
Assert.Throws<ArgumentException>(() => new FloatRange(1, -1).Validate()); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 75f6733e0b774298892d1b88069fdca2 |
|||
timeCreated: 1597556434 |
|
|||
using System; |
|||
|
|||
namespace UnityEngine.Perception.Randomization.Samplers |
|||
{ |
|||
[AttributeUsage(AttributeTargets.Struct)] |
|||
public class SamplerMetaData : Attribute |
|||
{ |
|||
public static SamplerMetaData GetMetaData(Type type) => |
|||
(SamplerMetaData)GetCustomAttribute(type, typeof(SamplerMetaData)); |
|||
|
|||
public string displayName; |
|||
|
|||
public SamplerMetaData(string displayName) |
|||
{ |
|||
this.displayName = displayName; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue