浏览代码

added tooltips

/main
Steven Leal 4 年前
当前提交
ef4cf781
共有 2 个文件被更改,包括 31 次插入7 次删除
  1. 23
      com.unity.perception/Editor/Randomization/Editors/RunInUnitySimulationWindow.cs
  2. 15
      com.unity.perception/Editor/Randomization/Uxml/RunInUnitySimulationWindow.uxml

23
com.unity.perception/Editor/Randomization/Editors/RunInUnitySimulationWindow.cs


string m_BuildZipPath;
SysParamDefinition[] m_SysParamDefinitions;
IntegerField m_InstanceCountField;
Button m_RunButton;
IntegerField m_TotalIterationsField;
IntegerField m_TotalIterationsField;
ObjectField m_ScenarioConfig;
Button m_RunButton;
TextAsset scenarioConfig => (TextAsset)m_ScenarioConfig.value;
string scenarioConfigAssetPath => AssetDatabase.GetAssetPath(scenarioConfig);
[MenuItem("Window/Run in Unity Simulation")]
static void ShowWindow()

});
}
m_ScenarioConfig = root.Q<ObjectField>("scenario-config");
m_ScenarioConfig.objectType = typeof(TextAsset);
var configPath = PlayerPrefs.GetString("SimWindow/scenarioConfig");
if (configPath != string.Empty)
m_ScenarioConfig.value = AssetDatabase.LoadAssetAtPath<TextAsset>(configPath);
m_RunButton = root.Q<Button>("run-button");
m_RunButton.clicked += RunInUnitySimulation;

if (!StaticData.IsSubclassOfRawGeneric(typeof(UnitySimulationScenario<>), currentScenario.GetType()))
throw new NotSupportedException(
"Scenario class must be derived from UnitySimulationScenario to run in Unity Simulation");
if (scenarioConfig != null && Path.GetExtension(scenarioConfigAssetPath) != ".json")
throw new NotSupportedException(
"Scenario configuration must be a JSON text asset");
}
void SetNewPlayerPreferences()

PlayerPrefs.SetInt("SimWindow/instanceCount", m_InstanceCountField.value);
PlayerPrefs.SetInt("SimWindow/sysParamIndex", m_SysParamIndex);
PlayerPrefs.SetString("SimWindow/scenarioConfig",
scenarioConfig != null ? scenarioConfigAssetPath : string.Empty);
}
void CreateLinuxBuildAndZip()

List<AppParam> GenerateAppParamIds(CancellationToken token, float progressStart, float progressEnd)
{
var appParamIds = new List<AppParam>();
var configuration = JObject.Parse(currentScenario.SerializeToJson());
var configuration = JObject.Parse(scenarioConfig != null
? File.ReadAllText(scenarioConfigAssetPath)
: currentScenario.SerializeToJson());
var constants = configuration["constants"];
constants["totalIterations"] = m_TotalIterationsField.value;

15
com.unity.perception/Editor/Randomization/Uxml/RunInUnitySimulationWindow.uxml


<VisualElement class="sim-window__container-outer">
<Label text="Simulation Parameters" class="sim-window__header-1"/>
<TextField name="run-name" label="Run Name"/>
<editor:IntegerField name="total-iterations" label="Total Iterations"/>
<editor:IntegerField name="instance-count" label="Instance Count" max-value="10000"/>
<VisualElement class="unity-base-field">
<editor:IntegerField name="total-iterations" label="Total Iterations"
tooltip="The number of scenario iterations to execute"/>
<editor:IntegerField name="instance-count" label="Instance Count" max-value="10000"
tooltip="The number of instances to distribute the work load across"/>
<VisualElement class="unity-base-field"
tooltip="The compute resources configuration to execute the simulation with">
<Label text="Optional Configuration" class="sim-window__header-1" style="margin-top: 10px;"/>
<editor:ObjectField name="scenario-config" label="Scenario JSON Config" allow-scene-object="false"
tooltip="Choose a JSON configuration to load during the run.
You can leave this option blank to use the scenario settings currently configured in the editor."/>
<VisualElement style="align-items: center;">
<Button name="run-button" text="Build and Run" style="margin: 10px; padding: 2 20; font-size: 13px;"/>
</VisualElement>

正在加载...
取消
保存