public static void EditorConfigureTarget(ObjectTargetAbstractBehaviour otb, SerializedObjectTarget serializedObject) { if (VuforiaUtilities.GetPrefabType(otb) == PrefabType.Prefab) { return; } if (!SceneManager.Instance.SceneInitialized) { SceneManager.Instance.InitScene(); } using (serializedObject.Edit()) { if (!serializedObject.InitializedInEditor && !EditorApplication.isPlaying) { ConfigData.ObjectTargetData objectTargetData; ConfigDataManager.Instance.GetConfigData("--- EMPTY ---").GetObjectTarget("--- EMPTY ---", out objectTargetData); ObjectTargetEditor.UpdateAspectRatio(serializedObject, objectTargetData.size); ObjectTargetEditor.UpdateScale(serializedObject, objectTargetData.size); ObjectTargetEditor.UpdateBoundingBox(serializedObject, objectTargetData.bboxMin, objectTargetData.bboxMax); ObjectTargetEditor.UpdatePreviewImage(serializedObject, objectTargetData.targetID); serializedObject.DataSetPath = "--- EMPTY ---"; serializedObject.TrackableName = "--- EMPTY ---"; serializedObject.InitializedInEditor = true; } } }
public override void OnInspectorGUI() { base.DrawDefaultInspector(); VuforiaUtilities.DisableGuiForPrefab(base.target); if (ConfigDataManager.Instance.NumConfigDataObjects > 1) { using (this.mSerializedObject.Edit()) { bool flag = VuforiaUtilities.DrawDatasetTrackableInspector(this.mSerializedObject, false, new Func <ConfigData, string[]>(ObjectTargetEditor.GetTrackableNames), "Object Target"); this.mSerializedObject.LengthProperty.FixApproximatelyEqualFloatValues(); EditorGUILayout.PropertyField(this.mSerializedObject.LengthProperty, new GUIContent("Length"), new GUILayoutOption[0]); 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.PropertyField(this.mSerializedObject.ShowBoundingBoxProperty, new GUIContent("Show Bounding Box"), new GUILayoutOption[0]); VuforiaUtilities.DrawTrackableOptions(this.mSerializedObject, true, true, true); if (flag) { ConfigData.ObjectTargetData objectTargetData; ConfigDataManager.Instance.GetConfigData(this.mSerializedObject.GetDataSetName()).GetObjectTarget(this.mSerializedObject.TrackableName, out objectTargetData); ObjectTargetEditor.UpdateAspectRatio(this.mSerializedObject, objectTargetData.size); ObjectTargetEditor.UpdateBoundingBox(this.mSerializedObject, objectTargetData.bboxMin, objectTargetData.bboxMax); ObjectTargetEditor.UpdateScale(this.mSerializedObject, objectTargetData.size); ObjectTargetEditor.UpdatePreviewImage(this.mSerializedObject, objectTargetData.targetID); } if (this.mSerializedObject.PreviewImage) { GUILayout.Label(this.mSerializedObject.PreviewImage, new GUILayoutOption[] { GUILayout.Width(512f) }); } return; } } VuforiaUtilities.DrawMissingTargetsButton(); }
public override void ApplyDataSetProperties() { if (VuforiaUtilities.GetPrefabType(this.mTarget) == PrefabType.Prefab) { return; } using (this.mSerializedObject.Edit()) { ConfigData.ObjectTargetData objectTargetData; if (this.TrackableInDataSet(this.mSerializedObject.TrackableName, this.mSerializedObject.GetDataSetName())) { ConfigDataManager.Instance.GetConfigData(this.mSerializedObject.GetDataSetName()).GetObjectTarget(this.mSerializedObject.TrackableName, out objectTargetData); } else { ConfigDataManager.Instance.GetConfigData("--- EMPTY ---").GetObjectTarget("--- EMPTY ---", out objectTargetData); this.mSerializedObject.DataSetPath = "--- EMPTY ---"; this.mSerializedObject.TrackableName = "--- EMPTY ---"; } ObjectTargetEditor.UpdateAspectRatio(this.mSerializedObject, objectTargetData.size); ObjectTargetEditor.UpdateScale(this.mSerializedObject, objectTargetData.size); } }