浏览代码

Update RunInUnitySimulationWindow.cs

/main
Mohsen Kamalzadeh 4 年前
当前提交
36bad735
共有 1 个文件被更改,包括 20 次插入4 次删除
  1. 24
      com.unity.perception/Editor/Randomization/Editors/RunInUnitySimulationWindow.cs

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


sysParamMenu.text = definition.description;
});
}
sysParamMenu.text = sysParamDefinitions[0].description;
m_SysParam = sysParamDefinitions[0];

}
catch (Exception e)
{
EditorUtility.ClearProgressBar();
PerceptionEditorAnalytics.ReportRunInUnitySimulationFailed(runGuid, e.Message);
throw;
}

Debug.Log("Created build zip");
}
List<AppParam> GenerateAppParamIds(CancellationToken token)
List<AppParam> GenerateAppParamIds(CancellationToken token, float progressStart, float progressEnd)
{
var appParamIds = new List<AppParam>();
var scenario = (ScenarioBase)m_ScenarioField.value;

constants["totalIterations"] = m_TotalIterationsField.value;
constants["instanceCount"]= m_InstanceCountField.value;
constants["instanceCount"] = m_InstanceCountField.value;
var progressIncrement = (progressEnd - progressStart) / m_InstanceCountField.value;
for (var i = 0; i < m_InstanceCountField.value; i++)
{

constants["instanceIndex"]= i;
constants["instanceIndex"] = i;
var appParamsString = JsonConvert.SerializeObject(configuration, Formatting.Indented);
var appParamId = API.UploadAppParam(appParamName, appParamsString);

name = appParamName,
num_instances = 1
});
EditorUtility.DisplayProgressBar("Unity Simulation Run", $"Uploading app-param-ids for instances: {i + 1}/{m_InstanceCountField.value}", progressStart + progressIncrement * i);
}
return appParamIds;

{
EditorUtility.DisplayProgressBar("Unity Simulation Run", "Uploading build...", 0.1f);
m_RunButton.SetEnabled(false);
var cancellationTokenSource = new CancellationTokenSource();
var token = cancellationTokenSource.Token;

cancellationTokenSource: cancellationTokenSource);
Debug.Log($"Build upload complete: build id {buildId}");
var appParams = GenerateAppParamIds(token);
var appParams = GenerateAppParamIds(token, 0.1f, 0.9f);
EditorUtility.ClearProgressBar();
EditorUtility.DisplayProgressBar("Unity Simulation Run", $"Uploading run definition...", 0.9f);
var runDefinitionId = API.UploadRunDefinition(new RunDefinition
{
app_params = appParams.ToArray(),

});
Debug.Log($"Run definition upload complete: run definition id {runDefinitionId}");
EditorUtility.DisplayProgressBar("Unity Simulation Run", $"Executing run...", 0.95f);
EditorUtility.ClearProgressBar();
PerceptionEditorAnalytics.ReportRunInUnitySimulationSucceeded(runGuid, run.executionId);
}
正在加载...
取消
保存