Exemplo n.º 1
0
 public void EditorUpdate()
 {
     TrackableBehaviour[]             trackables = (TrackableBehaviour[])UnityEngine.Object.FindObjectsOfType(typeof(TrackableBehaviour));
     VirtualButtonAbstractBehaviour[] vbs        = (VirtualButtonAbstractBehaviour[])UnityEngine.Object.FindObjectsOfType(typeof(VirtualButtonAbstractBehaviour));
     this.CorrectTrackableScales(trackables);
     VirtualButtonEditor.CorrectPoses(vbs);
     if (this.mDoDeserialization)
     {
         ConfigDataManager.Instance.DoRead();
         DataSetLoadEditor.OnConfigDataChanged();
         this.ApplyDataSetAppearance();
         this.mDoDeserialization = false;
     }
     if (this.mApplyAppearance)
     {
         this.UpdateTrackableAppearance(trackables);
         this.mApplyAppearance = false;
     }
     if (this.mApplyProperties)
     {
         this.UpdateTrackableProperties(trackables);
         this.mApplyProperties = false;
     }
     if (this.mDoSerialization)
     {
         ConfigData configData = this.CreateDataSetFromTrackables(trackables);
         if (!ConfigParser.Instance.structToFile(this.mDataSetExportPath, configData))
         {
             UnityEngine.Debug.LogError("Export of scene file failed.");
         }
         this.mDoSerialization = false;
     }
     if (this.mValidateScene)
     {
         this.CheckForDuplicates(trackables);
         WordEditor.CheckForDuplicates();
         VirtualButtonEditor.Validate();
         this.mValidateScene = false;
     }
     if (this.mGoToTargetManagerPage)
     {
         this.mGoToTargetManagerPage = false;
         Process.Start("https://developer.vuforia.com/target-manager");
     }
     if (this.mGoToSampleAppPage)
     {
         this.mGoToSampleAppPage = false;
         Process.Start("https://developer.vuforia.com/resources/sample-apps");
     }
     if (this.mLastUpdate.Add(UPDATE_INTERVAL) < DateTime.Now)
     {
         SetUnityVersion();
         this.mLastUpdate = DateTime.Now;
     }
 }
Exemplo n.º 2
0
    // Update method triggered by Unity.
    // Used to check scene content changes.
    // Be aware that this update callback only is called once a SceneManager
    // instance has been created.
    // Be aware that the instance is destroyed if the SceneManager file is
    // recompiled.
    public void EditorUpdate()
    {
        TrackableBehaviour[] trackables =
            (TrackableBehaviour[])UnityEngine.Object.FindObjectsOfType(
                typeof(TrackableBehaviour));
        VirtualButtonBehaviour[] virtualButtons =
            (VirtualButtonBehaviour[])UnityEngine.Object.FindObjectsOfType(
                typeof(VirtualButtonBehaviour));

        // Correct scales of Trackables.
        CorrectTrackableScales(trackables);

        // Correct Virtual Button poses.
        VirtualButtonEditor.CorrectPoses(virtualButtons);

        // We do deserialization and serialization in this order to avoid
        // overwriting the config.xml file.
        if (mDoDeserialization)
        {
            ConfigDataManager.Instance.DoRead();

            DataSetLoadEditor.OnConfigDataChanged();

            ApplyDataSetAppearance();

            mDoDeserialization = false;
        }

        if (mApplyAppearance)
        {
            // We apply the newly read values to the scene.
            UpdateTrackableAppearance(trackables);

            mApplyAppearance = false;
        }

        if (mApplyProperties)
        {
            // We apply the newly read values to the scene.
            UpdateTrackableProperties(trackables);

            mApplyProperties = false;
        }

        if (mDoSerialization)
        {
            ConfigData sceneData = CreateDataSetFromTrackables(trackables);
            if (!ConfigParser.Instance.structToFile(mDataSetExportPath, sceneData))
            {
                Debug.LogError("Export of scene file failed.");
            }

            mDoSerialization = false;
        }

        if (mValidateScene)
        {
            // Check if there are duplicate trackables in the scene.
            CheckForDuplicates(trackables);

            // Check if there are trackables from different data sets in the scene.
            CheckDataSets(trackables);

            // Validate all Virtual Buttons in the scene.
            VirtualButtonEditor.Validate();

            mValidateScene = false;
        }

        if (mGoToARPage)
        {
            mGoToARPage = false;
            System.Diagnostics.Process.Start(
                "https://ar.qualcomm.com/qdevnet/projects");
        }
    }
Exemplo n.º 3
0
    // Update method triggered by Unity.
    // Used to check scene content changes.
    // Be aware that this update callback only is called once a SceneManager
    // instance has been created.
    // Be aware that the instance is destroyed if the SceneManager file is
    // recompiled.
    public void EditorUpdate()
    {
        TrackableBehaviour[] trackables =
            (TrackableBehaviour[])UnityEngine.Object.FindObjectsOfType(
                typeof(TrackableBehaviour));
        VirtualButtonBehaviour[] virtualButtons =
            (VirtualButtonBehaviour[])UnityEngine.Object.FindObjectsOfType(
                typeof(VirtualButtonBehaviour));

        // Correct scales of Trackables.
        CorrectTrackableScales(trackables);

        // Correct Virtual Button poses.
        VirtualButtonEditor.CorrectPoses(virtualButtons);

        // We do deserialization and serialization in this order to avoid
        // overwriting the config.xml file.
        if (mDoDeserialization)
        {
            ConfigDataManager.Instance.DoRead();

            DataSetLoadEditor.OnConfigDataChanged();

            ApplyDataSetAppearance();

            mDoDeserialization = false;
        }

        if (mApplyAppearance)
        {
            // We apply the newly read values to the scene.
            UpdateTrackableAppearance(trackables);

            mApplyAppearance = false;
        }

        if (mApplyProperties)
        {
            // We apply the newly read values to the scene.
            UpdateTrackableProperties(trackables);

            mApplyProperties = false;
        }

        if (mDoSerialization)
        {
            ConfigData sceneData = CreateDataSetFromTrackables(trackables);
            if (!ConfigParser.Instance.structToFile(mDataSetExportPath, sceneData))
            {
                Debug.LogError("Export of scene file failed.");
            }

            mDoSerialization = false;
        }

        if (mValidateScene)
        {
            // Check if there are duplicate trackables in the scene.
            CheckForDuplicates(trackables);

            //check for duplicate word trackables in the scene
            WordEditor.CheckForDuplicates();

            // Validate all Virtual Buttons in the scene.
            VirtualButtonEditor.Validate();

            mValidateScene = false;
        }

        if (mGoToTargetManagerPage)
        {
            mGoToTargetManagerPage = false;
            System.Diagnostics.Process.Start(
                "https://developer.vuforia.com/target-manager");
        }

        if (mGoToSampleAppPage)
        {
            mGoToSampleAppPage = false;
            System.Diagnostics.Process.Start(
                "https://developer.vuforia.com/resources/sample-apps");
        }

        if (mLastUpdate.Add(UPDATE_INTERVAL) < DateTime.Now)
        {
            SetUnityVersion();
            mLastUpdate = DateTime.Now;
        }
    }