public static ActorSystemSetup CreateActorSystemSetup()
        {
            var actorSystemSetup = ScriptableObject.CreateInstance <ActorSystemSetup>();

            ActorSystemSetupAnalyzer.InitializeActorSystemSetup(actorSystemSetup);
            return(actorSystemSetup);
        }
        public bool OnSelectEntry(SearchTreeEntry entry, SearchWindowContext context)
        {
            if (entry is SearchTreeGroupEntry)
            {
                return(false);
            }

            var actorConfig = (ActorConfig)entry.userData;
            var actorSetup  = ActorSystemSetupAnalyzer.CreateActorSetup(actorConfig);

            m_Asset.ActorSetups.Add(actorSetup);

            foreach (var inputConfig in actorConfig.InputConfigs)
            {
                var isValid = MultiplicityValidator.IsValid(m_Asset.ComponentConfigs.First(x => x.Id == inputConfig.ComponentConfigId).InputMultiplicity, 0);
                actorSetup.Inputs.Add(new ActorPort(Guid.NewGuid().ToString(), inputConfig.Id, new List <ActorLink>(), isValid, false));
            }

            foreach (var outputConfig in actorConfig.OutputConfigs)
            {
                var isValid = MultiplicityValidator.IsValid(m_Asset.ComponentConfigs.First(x => x.Id == outputConfig.ComponentConfigId).OutputMultiplicity, 0);
                actorSetup.Outputs.Add(new ActorPort(Guid.NewGuid().ToString(), outputConfig.Id, new List <ActorLink>(), isValid, false));
            }

            var node = CreateNode(actorSetup);

            var pointInWindow = context.screenMousePosition - position.position;
            var pointInGraph  = node.parent.WorldToLocal(pointInWindow);

            node.SetPosition(new Rect(pointInGraph, Vector2.zero));
            actorSetup.Position = pointInGraph;

            return(true);
        }
    public IEnumerator TestBenchmarkSetup()
    {
        yield return(new PerformanceTests().Setup());

        var viewerReflectBootstrapper = Object.FindObjectsOfType <ViewerReflectBootstrapper>().First();

        ActorSystemSetupAnalyzer.MigrateInPlace(viewerReflectBootstrapper.Asset);
    }
        void EndMigration()
        {
            if (m_Asset != null)
            {
                ActorSystemSetupAnalyzer.CompleteInteractiveMigration(m_Asset);
            }

            SaveAsset();
            Reload();
        }
        void CreateSetupAsset(string fileName)
        {
            var asset = CreateInstance <ActorSystemSetup>();

            AssignAsset(asset);
            ActorSystemSetupAnalyzer.InitializeActorSystemSetup(asset);

            var getActiveFolderPath = typeof(ProjectWindowUtil)
                                      .GetMethod("GetActiveFolderPath", BindingFlags.Static | BindingFlags.NonPublic);
            var obj = getActiveFolderPath.Invoke(null, new object[0]);
            var pathToCurrentFolder = obj.ToString();

            ProjectWindowUtil.CreateAsset(m_Asset, AssetDatabase.GenerateUniqueAssetPath(pathToCurrentFolder + $"/{fileName}.asset"));
        }
 void BeginMigration()
 {
     ActorSystemSetupAnalyzer.BeginInteractiveMigration(m_Asset);
     Reload();
 }
Esempio n. 7
0
 public static ActorSetup CreateActorSetup(this ActorConfig actorConfig) =>
 ActorSystemSetupAnalyzer.CreateActorSetup(actorConfig);
Esempio n. 8
0
        public IEnumerator Setup()
        {
            var types = AppDomain.CurrentDomain.GetAssemblies()
                        .SelectMany(x => x.GetTypes())
                        .Where(t => typeof(BenchmarkUtils).IsAssignableFrom(t) && t.IsClass)
                        .OrderByDescending(x => ((BenchmarkUtilsImplPriorityAttribute)Attribute.GetCustomAttribute(x, typeof(BenchmarkUtilsImplPriorityAttribute))).Priority)
                        .ToList();

            m_BenchmarkTestsUtils = (BenchmarkUtils)Activator.CreateInstance(types.First());

            if (k_IsRunningUnderUtr)
            {
                m_ModelFolderPath = Directory.EnumerateDirectories(Directory.GetParent(Application.dataPath).Parent.FullName, ".PerformanceTestProjects", SearchOption.AllDirectories).FirstOrDefault();

                QualitySettings.SetQualityLevel(0);
                Screen.fullScreenMode      = FullScreenMode.FullScreenWindow;
                Screen.fullScreen          = true;
                QualitySettings.vSyncCount = 0;
            }
            else
            {
                m_ModelFolderPath = FindProjectsPath();
            }

            if (m_ModelFolderPath == null)
            {
                Debug.LogError("Unable to find Samples data. Reflect Samples require local Reflect Model data in '.PerformanceTestProjects' in " + Directory.GetParent(Application.dataPath).Parent.FullName);
            }

            if (!m_SceneLoaded)
            {
                //Load scene
                SceneManager.sceneLoaded += (s, a) => { m_SceneLoaded = true; };
                SceneManager.LoadScene(m_BenchmarkTestsUtils.GetScenePath(), LoadSceneMode.Single);

                yield return(new WaitWhile(() => m_SceneLoaded == false));

                m_BenchmarkTestsUtils.PostSceneSetup();

                //Too many exception with UI without user
                var uiStateManager = Object.FindObjectOfType <UIStateManager>();
                if (uiStateManager != null)
                {
                    uiStateManager.GetComponent <Canvas>().enabled = false;
                }

                var loginManager = Object.FindObjectOfType <LoginManager>();
                if (loginManager != null)
                {
                    loginManager.enabled = false;
                }

                yield return(null);

                //Activate Mars session to get the main camera
                var scene           = SceneManager.GetActiveScene();
                var rootGameObjects = new List <GameObject>();
                scene.GetRootGameObjects(rootGameObjects);
                foreach (var go in rootGameObjects)
                {
                    if (go.name.Equals("MARS Session"))
                    {
                        go.SetActive(true);
                        break;
                    }
                }

                m_ViewerReflectBootstrapper = UnityEngine.Object.FindObjectsOfType <ViewerReflectBootstrapper>().First();

                var actorSystemSetup = UnityEngine.Object.Instantiate(m_ViewerReflectBootstrapper.Asset);

                //Clear exclude and Migrate to get benchmark Actor
                actorSystemSetup.ExcludedAssemblies.RemoveAll(x => x == "BenchmarkAssembly");
                ActorSystemSetupAnalyzer.InitializeAnalyzer(actorSystemSetup);
                ActorSystemSetupAnalyzer.PrepareInPlace(actorSystemSetup);
                ActorSystemSetupAnalyzer.MigrateInPlace(actorSystemSetup);

                //Create and connect new actor
                var newProviderSetup = actorSystemSetup.CreateActorSetup <BenchmarkActor>();
                actorSystemSetup.ReplaceActor(actorSystemSetup.GetActorSetup <DataProviderActor>(), newProviderSetup);
                actorSystemSetup.ConnectNet <SpatialDataChanged>(actorSystemSetup.GetActorSetup <DynamicEntryFilterActor>(), newProviderSetup);

                //Assign root transform to GameObjectBuilderActor and SpatialActor
                actorSystemSetup.GetActorSetup <GameObjectBuilderActor>().GetActorSettings <GameObjectBuilderActor.Settings>().Root = GameObject.Find("Root").transform;
                actorSystemSetup.GetActorSetup <SpatialActor>().GetActorSettings <SpatialActor.Settings>().Root = GameObject.Find("Root").transform;

                //Replace Asset by modified temp asset
                m_ViewerReflectBootstrapper.Asset = actorSystemSetup;

                yield return(null);

                var freeFly = Camera.main.GetComponent <FreeFlyCamera>();
                if (freeFly != null)
                {
                    freeFly.enabled = false;
                }

                if (k_IsRunningUnderUtr)
                {
                    m_ViewerReflectBootstrapper.StartCoroutine(disableVsync());
                }

                yield return(new WaitForSeconds(10));
            }
        }