public override void ApplyDataSetAppearance()
 {
     if (VuforiaUtilities.GetPrefabType(this.mTarget) == PrefabType.Prefab)
     {
         return;
     }
     using (this.mSerializedObject.Edit())
     {
         ConfigData.ImageTargetData imageTargetData;
         if (this.TrackableInDataSet(this.mSerializedObject.TrackableName, this.mSerializedObject.GetDataSetName()))
         {
             ConfigDataManager.Instance.GetConfigData(this.mSerializedObject.GetDataSetName()).GetImageTarget(this.mSerializedObject.TrackableName, out imageTargetData);
         }
         else if (this.mSerializedObject.ImageTargetType != ImageTargetType.PREDEFINED)
         {
             imageTargetData = VuforiaUtilities.CreateDefaultImageTarget();
         }
         else
         {
             ConfigDataManager.Instance.GetConfigData("--- EMPTY ---").GetImageTarget("--- EMPTY ---", out imageTargetData);
             this.mSerializedObject.DataSetPath   = "--- EMPTY ---";
             this.mSerializedObject.TrackableName = "--- EMPTY ---";
         }
         ImageTargetEditor.UpdateAspectRatio(this.mSerializedObject, imageTargetData.size);
         ImageTargetEditor.UpdateMaterial(this.mSerializedObject);
     }
 }
 private void DrawPredefinedTargetInspectorUI(bool typeChanged)
 {
     if (ConfigDataManager.Instance.NumConfigDataObjects > 1)
     {
         if (VuforiaUtilities.DrawDatasetTrackableInspector(this.mSerializedObject, typeChanged, new Func <ConfigData, string[]>(ImageTargetEditor.GetTrackableNames), "Image Target") | typeChanged)
         {
             if (base.serializedObject.isEditingMultipleObjects)
             {
                 this.mSerializedObject.SerializedObject.ApplyModifiedPropertiesWithoutUndo();
                 UnityEngine.Object[] targetObjects = this.mSerializedObject.SerializedObject.targetObjects;
                 for (int i = 0; i < targetObjects.Length; i++)
                 {
                     ImageTargetEditor.UpdateDataSetAppearance(new SerializedImageTarget(new SerializedObject(targetObjects[i])));
                 }
             }
             else
             {
                 ImageTargetEditor.UpdateDataSetAppearance(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]);
         VuforiaUtilities.DrawTrackableOptions(this.mSerializedObject, true, true, true);
         return;
     }
     if (typeChanged)
     {
         ImageTargetEditor.UpdateMaterial(this.mSerializedObject);
     }
     VuforiaUtilities.DrawMissingTargetsButton();
 }
        internal static void UpdateMaterial(SerializedImageTarget serializedObject)
        {
            Material material = serializedObject.GetMaterial();

            material = ImageTargetEditor.UpdateMaterial(serializedObject.GetDataSetName(), serializedObject.TrackableName, serializedObject.ImageTargetType, material);
            serializedObject.SetMaterial(material);
        }
        private void DrawUserDefinedTargetInspectorUI(bool typeChanged)
        {
            if (typeChanged)
            {
                ConfigData.ImageTargetData imageTargetData = VuforiaUtilities.CreateDefaultImageTarget();
                this.mSerializedObject.TrackableName = string.Empty;
                ImageTargetEditor.UpdateAspectRatio(this.mSerializedObject, imageTargetData.size);
                this.mSerializedObject.SetMaterial(ImageTargetEditor.UpdateMaterial("", "", ImageTargetType.USER_DEFINED, this.mSerializedObject.GetMaterial()));
            }
            if (this.mSerializedObject.TrackableName.Length > 64)
            {
                EditorGUILayout.HelpBox("Target name must not exceed 64 character limit!", MessageType.Error);
            }
            EditorGUILayout.PropertyField(this.mSerializedObject.TrackableNameProperty, new GUIContent("Target Name"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.mSerializedObject.PreserveChildSizeProperty, new GUIContent("Preserve child size"), new GUILayoutOption[0]);
            bool expr_BB = SceneManager.Instance.SmartTerrainInitializationEnabled();

            if (expr_BB)
            {
                EditorGUILayout.HelpBox("Extended Tracking cannot be enabled at the same time as Smart Terrain.", MessageType.Info);
            }
            GUI.enabled = !expr_BB;
            EditorGUILayout.PropertyField(this.mSerializedObject.ExtendedTrackingProperty, new GUIContent("Enable Extended Tracking"), new GUILayoutOption[0]);
            GUI.enabled = true;
        }
 public static void EditorConfigureTarget(ImageTargetAbstractBehaviour itb, SerializedImageTarget serializedObject)
 {
     if (itb == null)
     {
         Debug.LogError("ImageTargetAbstractBehaviour parameter is null !");
         return;
     }
     if (VuforiaUtilities.GetPrefabType(itb) == PrefabType.Prefab)
     {
         return;
     }
     if (!SceneManager.Instance.SceneInitialized)
     {
         SceneManager.Instance.InitScene();
     }
     using (serializedObject.Edit())
     {
         if (!serializedObject.InitializedInEditor && !EditorApplication.isPlaying)
         {
             ConfigData.ImageTargetData imageTargetData;
             ConfigDataManager.Instance.GetConfigData("--- EMPTY ---").GetImageTarget("--- EMPTY ---", out imageTargetData);
             serializedObject.DataSetPath   = "--- EMPTY ---";
             serializedObject.TrackableName = "--- EMPTY ---";
             ImageTargetEditor.UpdateAspectRatio(serializedObject, imageTargetData.size);
             ImageTargetEditor.UpdateScale(serializedObject, imageTargetData.size);
             ImageTargetEditor.UpdateMaterial(serializedObject);
             serializedObject.InitializedInEditor = true;
         }
         else if (!EditorApplication.isPlaying)
         {
             ImageTargetEditor.CheckMesh(serializedObject);
         }
     }
 }
        private static void UpdateDataSetAppearance(SerializedImageTarget serializedObject)
        {
            ConfigData configData = ConfigDataManager.Instance.GetConfigData(serializedObject.GetDataSetName());

            if (configData.ImageTargetExists(serializedObject.TrackableName))
            {
                ConfigData.ImageTargetData imageTargetData;
                configData.GetImageTarget(serializedObject.TrackableName, out imageTargetData);
                ImageTargetEditor.UpdateAspectRatio(serializedObject, imageTargetData.size);
                ImageTargetEditor.UpdateScale(serializedObject, imageTargetData.size);
            }
            ImageTargetEditor.UpdateMaterial(serializedObject);
        }
 private static void CheckMesh(SerializedImageTarget serializedObject)
 {
     using (List <ImageTargetAbstractBehaviour> .Enumerator enumerator = serializedObject.GetBehaviours().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             GameObject gameObject = enumerator.Current.gameObject;
             MeshFilter component  = gameObject.GetComponent <MeshFilter>();
             if ((component == null || component.sharedMesh == null) && !serializedObject.AspectRatioProperty.hasMultipleDifferentValues)
             {
                 ImageTargetEditor.UpdateMesh(gameObject, serializedObject.AspectRatio);
             }
         }
     }
     if (!serializedObject.DataSetPathProperty.hasMultipleDifferentValues && !serializedObject.TrackableNameProperty.hasMultipleDifferentValues)
     {
         ImageTargetEditor.UpdateMaterial(serializedObject);
     }
 }
        private void DrawCloudRecoTargetInspectorUI(bool typeChanged)
        {
            if (typeChanged)
            {
                ConfigData.ImageTargetData imageTargetData = VuforiaUtilities.CreateDefaultImageTarget();
                this.mSerializedObject.TrackableName = string.Empty;
                ImageTargetEditor.UpdateAspectRatio(this.mSerializedObject, imageTargetData.size);
                this.mSerializedObject.SetMaterial(ImageTargetEditor.UpdateMaterial("", "", ImageTargetType.CLOUD_RECO, this.mSerializedObject.GetMaterial()));
            }
            EditorGUILayout.PropertyField(this.mSerializedObject.PreserveChildSizeProperty, new GUIContent("Preserve child size"), new GUILayoutOption[0]);
            bool expr_7B = SceneManager.Instance.SmartTerrainInitializationEnabled();

            if (expr_7B)
            {
                EditorGUILayout.HelpBox("Extended Tracking cannot be enabled at the same time as Smart Terrain.", MessageType.Info);
            }
            GUI.enabled = !expr_7B;
            EditorGUILayout.PropertyField(this.mSerializedObject.ExtendedTrackingProperty, new GUIContent("Enable Extended Tracking"), new GUILayoutOption[0]);
            GUI.enabled = true;
            SmartTerrainInitializationTargetEditorExtension.DrawInspectorForInitializationTarget(this.mSerializedObject, true);
        }