private static void CheckMesh(MultiTargetAbstractBehaviour mtb)
    {
        bool      flag      = false;
        Transform transform = mtb.transform.Find("ChildTargets");

        if (transform == null)
        {
            flag = true;
        }
        else
        {
            for (int i = 0; i < transform.childCount; i++)
            {
                Transform    child     = transform.GetChild(i);
                MeshFilter   component = child.GetComponent <MeshFilter>();
                MeshRenderer renderer  = child.GetComponent <MeshRenderer>();
                if (((component == null) || (component.sharedMesh == null)) || (((renderer == null) || (renderer.sharedMaterials.Length == 0)) || (renderer.sharedMaterials[0] == null)))
                {
                    flag = true;
                }
            }
        }
        if (flag)
        {
            TrackableAccessor accessor = AccessorFactory.Create(mtb);
            if (accessor != null)
            {
                accessor.ApplyDataSetProperties();
            }
        }
    }
Пример #2
0
        private async Task ExecuteLoadRepositoriesAsync(RepositoryQueryArguments arguments)
        {
            Cursor cursor = this.Cursor;

            this.Cursor = Cursors.AppStarting;

            try
            {
                this.resultContainer.Children.Clear();

                IPublicRepositoryReader accessor = AccessorFactory.Create <IPublicRepositoryReader>(this.model.RepositoryName, this.model.IsOrganization);

                IResult <IRepository> result = await accessor.ReadAsync(arguments);

                if (result != null)
                {
                    this.ApplyResults(result.Results);
                    this.ApplyPagings(result.Pagination);

                    if (result.Limitation != null)
                    {
                        Shared.StatusHandler.GlobalStatus.LimitationMaximum    = result.Limitation.Maximum;
                        Shared.StatusHandler.GlobalStatus.LimitationRemaining  = result.Limitation.Remaining;
                        Shared.StatusHandler.GlobalStatus.LimitationExpiration = result.Limitation.Expiration.DateTime;
                    }
                }
            }
            finally
            {
                this.Cursor = cursor;
            }
        }
    public override void OnInspectorGUI()
    {
        EditorGUIUtility.LookLikeInspector();
        base.DrawDefaultInspector();
        MultiTargetAbstractBehaviour target     = (MultiTargetAbstractBehaviour)base.target;
        IEditorMultiTargetBehaviour  behaviour2 = target;

        if (QCARUtilities.GetPrefabType(target) == PrefabType.Prefab)
        {
            GUILayout.Label("You can't choose a target for a prefab.", new GUILayoutOption[0]);
        }
        else if (ConfigDataManager.Instance.NumConfigDataObjects > 1)
        {
            string[] configDataNames = new string[ConfigDataManager.Instance.NumConfigDataObjects];
            ConfigDataManager.Instance.GetConfigDataNames(configDataNames);
            int indexFromString = QCARUtilities.GetIndexFromString(behaviour2.DataSetName, configDataNames);
            if (indexFromString < 0)
            {
                indexFromString = 0;
            }
            int        index       = EditorGUILayout.Popup("Data Set", indexFromString, configDataNames, new GUILayoutOption[0]);
            string     dataSetName = configDataNames[index];
            ConfigData configData  = ConfigDataManager.Instance.GetConfigData(dataSetName);
            string[]   arrayToFill = new string[configData.NumMultiTargets];
            configData.CopyMultiTargetNames(arrayToFill, 0);
            int selectedIndex = QCARUtilities.GetIndexFromString(behaviour2.TrackableName, arrayToFill);
            if (selectedIndex < 0)
            {
                selectedIndex = 0;
            }
            int num4 = EditorGUILayout.Popup("Multi Target", selectedIndex, arrayToFill, new GUILayoutOption[0]);
            if ((arrayToFill.Length > 0) && ((index != indexFromString) || (num4 != selectedIndex)))
            {
                behaviour2.SetDataSetPath("QCAR/" + configDataNames[index] + ".xml");
                behaviour2.SetNameForTrackable(arrayToFill[num4]);
            }
            behaviour2.SetExtendedTracking(EditorGUILayout.Toggle("Extended tracking", behaviour2.ExtendedTracking, new GUILayoutOption[0]));
        }
        else if (GUILayout.Button("No targets defined. Press here for target creation!", new GUILayoutOption[0]))
        {
            SceneManager.Instance.GoToTargetManagerPage();
        }
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
            TrackableAccessor accessor = AccessorFactory.Create(target);
            if (accessor != null)
            {
                accessor.ApplyDataSetProperties();
            }
            SceneManager.Instance.SceneUpdated();
        }
    }
Пример #4
0
 private void UpdateTrackableProperties(TrackableBehaviour[] trackables)
 {
     foreach (TrackableBehaviour behaviour in trackables)
     {
         if (behaviour is DataSetTrackableBehaviour)
         {
             DataSetTrackableBehaviour target   = (DataSetTrackableBehaviour)behaviour;
             TrackableAccessor         accessor = AccessorFactory.Create(target);
             if (accessor != null)
             {
                 accessor.ApplyDataSetProperties();
             }
         }
     }
 }
Пример #5
0
    // Updates trackables in scene from config data.
    private void UpdateTrackableProperties(TrackableBehaviour[] trackables)
    {
        foreach (TrackableBehaviour tb in trackables)
        {
            // Ignore non-data set trackables.
            if (!(tb is DataSetTrackableBehaviour))
            {
                continue;
            }

            DataSetTrackableBehaviour trackable     = (DataSetTrackableBehaviour)tb;
            TrackableAccessor         configApplier = AccessorFactory.Create(trackable);
            configApplier.ApplyDataSetProperties();
        }
    }
Пример #6
0
 private void UpdateTrackableAppearance(TrackableBehaviour[] trackables)
 {
     if (!Application.isPlaying)
     {
         foreach (TrackableBehaviour behaviour in trackables)
         {
             if (behaviour is DataSetTrackableBehaviour)
             {
                 DataSetTrackableBehaviour target   = (DataSetTrackableBehaviour)behaviour;
                 TrackableAccessor         accessor = AccessorFactory.Create(target);
                 if (accessor != null)
                 {
                     accessor.ApplyDataSetAppearance();
                 }
             }
         }
     }
 }
Пример #7
0
        private static void TestRepositories(String value, Boolean organization)
        {
            IPublicRepositoryReader accessor = AccessorFactory.Create <IPublicRepositoryReader>(value, organization);

            IResult <IRepository> result = null;

            Task.Run(async() =>
            {
                var count = await accessor.TotalCountAsync();

                Console.WriteLine($"total count: {count}");

                RepositoryQueryArguments arguments = new RepositoryQueryArguments(new PagingArgument(50));

                while (true)
                {
                    result = await accessor.ReadAsync(arguments);

                    if (!result.Results.Any())
                    {
                        break;
                    }

                    Console.WriteLine(result);

                    foreach (IRepository repository in result.Results)
                    {
                        Console.WriteLine(repository);
                    }

                    Console.WriteLine($"count: {result.Results.Count()}");

                    if (result.Pagination == null || result.Pagination.Next == null)
                    {
                        break;
                    }

                    arguments.Paging = new PagingArgument(result.Pagination.Next);
                }

                Console.WriteLine($"total count: {count}");
            })
            .Wait();
        }
Пример #8
0
    // Updates trackables in scene from config data.
    private void UpdateTrackableAppearance(TrackableBehaviour[] trackables)
    {
        // do not set appearance in play mode
        if (!Application.isPlaying)
        {
            foreach (TrackableBehaviour tb in trackables)
            {
                // Ignore non-data set trackables.
                if (!(tb is DataSetTrackableBehaviour))
                {
                    continue;
                }

                DataSetTrackableBehaviour trackable     = (DataSetTrackableBehaviour)tb;
                TrackableAccessor         configApplier = AccessorFactory.Create(trackable);
                if (configApplier != null)
                {
                    configApplier.ApplyDataSetAppearance();
                }
            }
        }
    }
Пример #9
0
        private static void TestReleases(String owner, String repository)
        {
            IPublicReleaseReader accessor = AccessorFactory.Create <IPublicReleaseReader>(owner, repository);

            IResult <IRelease> result = null;

            Task.Run(async() =>
            {
                ReleaseQueryArguments arguments = new ReleaseQueryArguments(new PagingArgument(50));

                while (true)
                {
                    result = await accessor.ReadAsync(arguments);

                    if (!result.Results.Any())
                    {
                        break;
                    }

                    Console.WriteLine(result);

                    foreach (IRelease release in result.Results)
                    {
                        Console.WriteLine(release);
                    }

                    Console.WriteLine($"count: {result.Results.Count()}");

                    if (result.Pagination == null || result.Pagination.Next == null)
                    {
                        break;
                    }

                    arguments.Paging = new PagingArgument(result.Pagination.Next);
                }
            })
            .Wait();
        }
    private static void CheckMesh(MultiTargetBehaviour mtb)
    {
        // when copy-pasting targets between scenes, the mesh and materials of
        // the game objects get lost. This checks for them and re-creates them if they are found missing.
        bool updateGeometry = false;

        Transform childTargets = mtb.transform.Find("ChildTargets");

        if (childTargets == null)
        {
            updateGeometry = true;
        }
        else
        {
            for (int i = 0; i < childTargets.childCount; i++)
            {
                Transform    childTarget  = childTargets.GetChild(i);
                MeshFilter   meshFilter   = childTarget.GetComponent <MeshFilter>();
                MeshRenderer meshRenderer = childTarget.GetComponent <MeshRenderer>();
                if (meshFilter == null || meshFilter.sharedMesh == null ||
                    meshRenderer == null || meshRenderer.sharedMaterials.Length == 0 ||
                    meshRenderer.sharedMaterials[0] == null)
                {
                    updateGeometry = true;
                }
            }
        }

        if (updateGeometry)
        {
            TrackableAccessor accessor = AccessorFactory.Create(mtb);
            if (accessor != null)
            {
                accessor.ApplyDataSetProperties();
            }
        }
    }
Пример #11
0
 public AbstractAccessor CreateAccessor()
 {
     return(AccessorFactory.Create(HttpContext.User));
 }
Пример #12
0
    // Lets the user choose a Multi Target from a drop down list. Multi Target
    // must be defined in the "config.xml" file.
    public override void OnInspectorGUI()
    {
        EditorGUIUtility.LookLikeInspector();

        DrawDefaultInspector();

        MultiTargetBehaviour        mtb       = (MultiTargetBehaviour)target;
        IEditorMultiTargetBehaviour editorMtb = mtb;

        if (QCARUtilities.GetPrefabType(mtb) ==
            PrefabType.Prefab)
        {
            GUILayout.Label("You can't choose a target for a prefab.");
        }
        else if (ConfigDataManager.Instance.NumConfigDataObjects > 1)
        {
            // Draw list for choosing a data set.
            string[] dataSetList = new string[ConfigDataManager.Instance.NumConfigDataObjects];
            ConfigDataManager.Instance.GetConfigDataNames(dataSetList);
            int currentDataSetIndex =
                QCARUtilities.GetIndexFromString(editorMtb.DataSetName, dataSetList);

            // If name is not in array we automatically choose default name;
            if (currentDataSetIndex < 0)
            {
                currentDataSetIndex = 0;
            }

            int newDataSetIndex = EditorGUILayout.Popup("Data Set",
                                                        currentDataSetIndex,
                                                        dataSetList);

            string chosenDataSet = dataSetList[newDataSetIndex];

            ConfigData dataSetData = ConfigDataManager.Instance.GetConfigData(chosenDataSet);

            // Draw list for choosing a Trackable.
            string[] namesList = new string[dataSetData.NumMultiTargets];
            dataSetData.CopyMultiTargetNames(namesList, 0);
            int currentTrackableIndex =
                QCARUtilities.GetIndexFromString(editorMtb.TrackableName, namesList);

            // If name is not in array we automatically choose default name;
            if (currentTrackableIndex < 0)
            {
                currentTrackableIndex = 0;
            }

            int newTrackableIndex = EditorGUILayout.Popup("Multi Target",
                                                          currentTrackableIndex,
                                                          namesList);

            if (namesList.Length > 0)
            {
                if (newDataSetIndex != currentDataSetIndex || newTrackableIndex != currentTrackableIndex)
                {
                    editorMtb.SetDataSetPath("QCAR/" + dataSetList[newDataSetIndex] + ".xml");

                    editorMtb.SetNameForTrackable(namesList[newTrackableIndex]);
                }
            }
        }
        else
        {
            if (GUILayout.Button("No targets defined. Press here for target " +
                                 "creation!"))
            {
                SceneManager.Instance.GoToARPage();
            }
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(mtb);

            // If name has changed we apply the correct values from the config
            // file.
            TrackableAccessor accessor = AccessorFactory.Create(mtb);
            if (accessor != null)
            {
                accessor.ApplyDataSetProperties();
            }

            SceneManager.Instance.SceneUpdated();
        }
    }