Merge pull request #53 from Unity-Technologies/open_scene_menu_option
Added an option to open the SynthDet scene to the SynthDet menu
This commit is contained in:
Коммит
34333508b2
|
@ -1,39 +1,24 @@
|
|||
using SynthDet.Randomizers;
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Perception.Randomization.Randomizers.SampleRandomizers;
|
||||
using UnityEngine.Perception.Randomization.Scenarios;
|
||||
using BackgroundObjectPlacementRandomizer = SynthDet.Randomizers.BackgroundObjectPlacementRandomizer;
|
||||
using ForegroundObjectPlacementRandomizer = SynthDet.Randomizers.ForegroundObjectPlacementRandomizer;
|
||||
|
||||
namespace SynthDet
|
||||
{
|
||||
public static class MenuItems
|
||||
{
|
||||
[MenuItem("SynthDet/Create Default Scenario")]
|
||||
static void CreateDefaultScenario()
|
||||
[MenuItem("SynthDet/Open SynthDet Scene")]
|
||||
static void OpenSynthDetScene()
|
||||
{
|
||||
var scenarioObj = new GameObject("Scenario");
|
||||
|
||||
var scenario = scenarioObj.AddComponent<FixedLengthScenario>();
|
||||
scenario.constants.totalIterations = 1000;
|
||||
|
||||
scenario.AddRandomizer(new BackgroundObjectPlacementRandomizer());
|
||||
scenario.AddRandomizer(new ForegroundObjectPlacementRandomizer());
|
||||
scenario.AddRandomizer(new ForegroundOccluderPlacementRandomizer());
|
||||
scenario.AddRandomizer(new ForegroundOccluderScaleRandomizer());
|
||||
scenario.AddRandomizer(new ForegroundScaleRandomizer());
|
||||
scenario.AddRandomizer(new TextureRandomizer());
|
||||
scenario.AddRandomizer(new HueOffsetRandomizer());
|
||||
scenario.AddRandomizer(new RotationRandomizer());
|
||||
scenario.AddRandomizer(new UnifiedRotationRandomizer());
|
||||
scenario.AddRandomizer(new LightRandomizer());
|
||||
scenario.AddRandomizer(new CameraRandomizer());
|
||||
scenario.AddRandomizer(new ForegroundObjectMetricReporter());
|
||||
scenario.AddRandomizer(new LightingInfoMetricReporter());
|
||||
scenario.AddRandomizer(new CameraPostProcessingMetricReporter());
|
||||
|
||||
Selection.activeGameObject = scenarioObj;
|
||||
}
|
||||
try
|
||||
{
|
||||
EditorSceneManager.OpenScene("Assets/Scenes/SynthDet.unity");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError("Could not open the SynthDet Scene. Make sure the file Assets/Scenes/SynthDet.unity exists and is a valid Scene.");
|
||||
Debug.LogException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче