Пример #1
0
 private static void CheckMesh(SerializedVuMark serializedObject)
 {
     using (List <VuMarkAbstractBehaviour> .Enumerator enumerator = serializedObject.GetBehaviours().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             GameObject gameObject = enumerator.Current.gameObject;
             MeshFilter component  = gameObject.GetComponent <MeshFilter>();
             if (component == null || component.sharedMesh == null)
             {
                 VuMarkEditor.UpdateMesh(gameObject, serializedObject.BoundingBox, serializedObject.Origin);
             }
         }
     }
     if (!serializedObject.PreviewImageProperty.hasMultipleDifferentValues)
     {
         VuMarkEditor.UpdateMaterial(serializedObject);
         return;
     }
     UnityEngine.Object[] targetObjects = serializedObject.SerializedObject.targetObjects;
     for (int i = 0; i < targetObjects.Length; i++)
     {
         VuMarkEditor.UpdateMaterial(new SerializedVuMark(new SerializedObject(targetObjects[i])));
     }
 }
Пример #2
0
 public override void OnInspectorGUI()
 {
     base.DrawDefaultInspector();
     VuforiaUtilities.DisableGuiForPrefab(base.target);
     if (ConfigDataManager.Instance.NumConfigDataObjects > 1)
     {
         using (this.mSerializedObject.Edit())
         {
             if (VuforiaUtilities.DrawDatasetTrackableInspector(this.mSerializedObject, false, new Func <ConfigData, string[]>(VuMarkEditor.GetTrackableNames), "VuMark Template"))
             {
                 ConfigData.VuMarkData vuMarkData;
                 ConfigDataManager.Instance.GetConfigData(this.mSerializedObject.GetDataSetName()).GetVuMarkTarget(this.mSerializedObject.TrackableName, out vuMarkData);
                 VuMarkEditor.UpdateDataSetInfo(this.mSerializedObject, vuMarkData);
                 VuMarkEditor.UpdateAspectRatio(this.mSerializedObject, vuMarkData.size);
                 VuMarkEditor.UpdateScale(this.mSerializedObject, vuMarkData.size);
                 VuMarkEditor.UpdateMaterial(this.mSerializedObject);
             }
             this.mSerializedObject.WidthProperty.FixApproximatelyEqualFloatValues();
             EditorGUILayout.PropertyField(this.mSerializedObject.WidthProperty, new GUIContent("Width"), new GUILayoutOption[0]);
             this.mSerializedObject.HeightProperty.FixApproximatelyEqualFloatValues();
             EditorGUILayout.PropertyField(this.mSerializedObject.HeightProperty, new GUIContent("Height"), new GUILayoutOption[0]);
             EditorGUILayout.LabelField(new GUIContent("ID Type"), new GUIContent(this.mSerializedObject.IdType.ToString()), new GUILayoutOption[0]);
             EditorGUILayout.LabelField(new GUIContent("ID Length"), new GUIContent(this.mSerializedObject.IdLength.ToString()), new GUILayoutOption[0]);
             string text = "Define whether the VuMark has a changing background per instance,signaling to SDK how to track it. \nIf enabled, the SDK tracks this VuMark based on what is seen by the camera and not assume the template background image is useful for tracking because the background can change per instance. \nIf disabled, the SDK tracks this VuMark based on the template used to create the dataset. This is the default behavior.";
             EditorGUILayout.PropertyField(this.mSerializedObject.TrackingFromRuntimeAppearanceProperty, new GUIContent("Track From Appearance", text), new GUILayoutOption[0]);
             VuforiaUtilities.DrawTrackableOptions(this.mSerializedObject, true, true, false);
             return;
         }
     }
     VuforiaUtilities.DrawMissingTargetsButton();
 }
Пример #3
0
        public void OnEnable()
        {
            VuMarkAbstractBehaviour arg_22_0 = (VuMarkAbstractBehaviour)base.target;

            this.mSerializedObject = new SerializedVuMark(base.serializedObject);
            VuMarkEditor.EditorConfigureTarget(arg_22_0, this.mSerializedObject);
        }
Пример #4
0
 public static void EditorConfigureTarget(VuMarkAbstractBehaviour vmb, SerializedVuMark serializedObject)
 {
     if (vmb == null)
     {
         Debug.LogError("VuMarkAbstractBehaviour parameter is null !");
         return;
     }
     if (VuforiaUtilities.GetPrefabType(vmb) == PrefabType.Prefab)
     {
         return;
     }
     if (!SceneManager.Instance.SceneInitialized)
     {
         SceneManager.Instance.InitScene();
     }
     using (serializedObject.Edit())
     {
         if (!serializedObject.InitializedInEditor && !EditorApplication.isPlaying)
         {
             ConfigData.VuMarkData vuMarkData;
             ConfigDataManager.Instance.GetConfigData("--- EMPTY ---").GetVuMarkTarget("--- EMPTY ---", out vuMarkData);
             serializedObject.DataSetPath   = "--- EMPTY ---";
             serializedObject.TrackableName = "--- EMPTY ---";
             VuMarkEditor.UpdateDataSetInfo(serializedObject, vuMarkData);
             VuMarkEditor.UpdateAspectRatio(serializedObject, vuMarkData.size);
             VuMarkEditor.UpdateScale(serializedObject, vuMarkData.size);
             serializedObject.InitializedInEditor = true;
         }
     }
     if (!EditorApplication.isPlaying)
     {
         VuMarkEditor.CheckMesh(serializedObject);
     }
 }
Пример #5
0
 internal static void UpdateAspectRatio(SerializedVuMark serializedObject, Vector2 size)
 {
     serializedObject.AspectRatio = size[1] / size[0];
     using (List <VuMarkAbstractBehaviour> .Enumerator enumerator = serializedObject.GetBehaviours().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             VuMarkEditor.UpdateMesh(enumerator.Current.gameObject, serializedObject.BoundingBox, serializedObject.Origin);
         }
     }
 }
Пример #6
0
 public override void ApplyDataSetProperties()
 {
     if (VuforiaUtilities.GetPrefabType(this.mTarget) == PrefabType.Prefab)
     {
         return;
     }
     using (this.mSerializedObject.Edit())
     {
         ConfigData.VuMarkData vuMarkData;
         if (this.TrackableInDataSet(this.mSerializedObject.TrackableName, this.mSerializedObject.GetDataSetName()))
         {
             ConfigDataManager.Instance.GetConfigData(this.mSerializedObject.GetDataSetName()).GetVuMarkTarget(this.mSerializedObject.TrackableName, out vuMarkData);
         }
         else
         {
             ConfigDataManager.Instance.GetConfigData("--- EMPTY ---").GetVuMarkTarget("--- EMPTY ---", out vuMarkData);
             this.mSerializedObject.DataSetPath   = "--- EMPTY ---";
             this.mSerializedObject.TrackableName = "--- EMPTY ---";
         }
         VuMarkEditor.UpdateDataSetInfo(this.mSerializedObject, vuMarkData);
         VuMarkEditor.UpdateScale(this.mSerializedObject, vuMarkData.size);
     }
 }