Пример #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            var markerLibrary = ImageMarkerEditorUtils.GetSessionMarkerLibrary();

            if (markerLibrary == null)
            {
                return;
            }

            var markerIndex = ImageMarkerEditorUtils.UnselectedMarkerIndex;

            using (var check = new EditorGUI.ChangeCheckScope())
            {
                var currentMarkerID = m_SynthMarkerGuidProperty.stringValue;
                var newMarkerID     = m_MarkerDefinitionSelectorDrawer.DrawSelectorGUI(markerLibrary, currentMarkerID);

                markerIndex = ImageMarkerEditorUtils.CurrentSelectedImageMarkerIndex(markerLibrary, newMarkerID);

                if (markerIndex != ImageMarkerEditorUtils.UnselectedMarkerIndex)
                {
                    var markerDefinition = markerLibrary[markerIndex];

                    if (newMarkerID != currentMarkerID)
                    {
                        m_SynthMarkerGuidProperty.stringValue             = newMarkerID;
                        m_SynthMarkerTextureProperty.objectReferenceValue = markerDefinition.Texture;

                        serializedObject.ApplyModifiedProperties();
                        m_MarkerDefinitionSelectorDrawer.UpdateMarkerLibraryData(m_SynthMarkerGuidProperty.stringValue);
                    }

                    if (check.changed)
                    {
                        m_SynthesizedMarkerId.UpdateMarkerSize(markerDefinition.Size);
                    }
                }

                if (check.changed)
                {
                    serializedObject.ApplyModifiedProperties();
                    MARSSession.Instance.CheckCapabilities();
                    EditorUtility.SetDirty(this);
                }
            }

            SetMarkerSizeToTransformScale(markerLibrary, markerIndex);
        }
Пример #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            var markerLibrary = ImageMarkerEditorUtils.GetSessionMarkerLibrary();

            if (markerLibrary == null)
            {
                return;
            }

            using (var check = new EditorGUI.ChangeCheckScope())
            {
                var currentMarkerID = m_MarkerGuidProperty.stringValue;
                var newMarkerID     = m_MarkerDefinitionSelectorDrawer.DrawSelectorGUI(markerLibrary, currentMarkerID);
                if (newMarkerID != currentMarkerID)
                {
                    m_MarkerGuidProperty.stringValue = newMarkerID;
                    serializedObject.ApplyModifiedProperties();
                    m_MarkerDefinitionSelectorDrawer.UpdateMarkerLibraryData(m_MarkerGuidProperty.stringValue);
                }

                if (check.changed)
                {
                    serializedObject.ApplyModifiedProperties();
                    isDirty = true;

                    var marsSession = MARSSession.Instance;
                    if (marsSession == null)
                    {
                        return;
                    }

                    marsSession.CheckCapabilities();
                }
            }
        }