浏览代码

Randomization updates

/fod_generator_randomization_changes
Steven Borkman 4 年前
当前提交
51e0a9ac
共有 3 个文件被更改,包括 15 次插入4 次删除
  1. 11
      com.unity.perception/Editor/Randomization/Editors/ScenarioBaseEditor.cs
  2. 2
      com.unity.perception/Editor/Randomization/Uxml/ScenarioBaseElement.uxml
  3. 6
      com.unity.perception/Runtime/Randomization/Samplers/SamplerTypes/UniformSampler.cs

11
com.unity.perception/Editor/Randomization/Editors/ScenarioBaseEditor.cs


using UnityEngine;
using System;
using UnityEngine.UI;
using Button = UnityEngine.UIElements.Button;
using Random = UnityEngine.Random;
namespace UnityEditor.Perception.Randomization
{

CreatePropertyFields();
CheckIfConstantsExist();
var randomSeedButton = m_Root.Q<Button>("random");
randomSeedButton.clicked += () =>
{
m_Scenario.genericConstants.randomSeed = (uint)Random.Range(int.MinValue, int.MaxValue);
};
var serializeConstantsButton = m_Root.Q<Button>("serialize");
serializeConstantsButton.clicked += () =>

2
com.unity.perception/Editor/Randomization/Uxml/ScenarioBaseElement.uxml


<Foldout style="padding-left: 16px" text="Constants" name="constants-list" tooltip="A list of parameters for this scenario that will be JSON serialized in the configuration file."/>
<editor:PropertyField name="configuration-file-name" label="Constants File Name" binding-path="serializedConstantsFileName"/>
<VisualElement style="flex-direction: row;">
<Button name="random" text="Generate Random Seed" style="flex-grow: 1;"
tooltip="Creates a new random seed"/>
<Button name="serialize" text="Serialize To Config File" style="flex-grow: 1;"
tooltip="Serializes scenario constants and randomizer settings to a JSON configuration file"/>
<Button name="deserialize" text="Deserialize From Config File" style="flex-grow: 1;"

6
com.unity.perception/Runtime/Randomization/Samplers/SamplerTypes/UniformSampler.cs


}
/// <summary>
/// Constructs a new uniform distribution sampler
/// Constructs a new uniform distribution sampler with the interval [min, max)
/// <param name="min">The smallest value contained within the range</param>
/// <param name="max">The largest value contained within the range</param>
/// <param name="min">The smallest value contained within the range (inclusive)</param>
/// <param name="max">The largest value contained within the range (exclusive)</param>
public UniformSampler(float min, float max)
{
range = new FloatRange(min, max);

正在加载...
取消
保存