Exemplo n.º 1
0
        //================================ Private|Protected methods ================================

        protected virtual void OnEnable()
        {
            Spline = new SplineBridge(serializedObject);

            /*EditMode.onEditModeStartDelegate += OnEditModeStart;
             * EditMode.onEditModeEndDelegate += OnEditModeEnd;*/
        }
Exemplo n.º 2
0
 protected virtual void OnDisable()
 {
     Spline = null;
     if (EditMode.editMode != EditMode.SceneViewEditMode.None)
     {
         EditMode.QuitEditMode();
     }
     // ReSharper disable once DelegateSubtraction
     EditMode.onEditModeEndDelegate -= OnEditModeEnd;
     // ReSharper disable once DelegateSubtraction
     EditMode.onEditModeStartDelegate -= OnEditModeStart;
 }
Exemplo n.º 3
0
        public void StartEditing(EditMode.SceneViewEditMode mode, UnityEditor.Editor caller)
        {
            if (mode == EditMode.SceneViewEditMode.None || _caller == caller)
            {
                return;
            }
            Type editorType;

            if (!_editors.TryGetValue(mode, out editorType))
            {
                if (SPSettings.Current.DebugMode)
                {
                    Debug.LogErrorFormat("Editor for mode {0} was not found!", mode);
                }
                return;
            }
            _caller = caller;
            _editor = UnityEditor.Editor.CreateEditor(
                SplineBridge.GetUnserializedSpline(caller.serializedObject), editorType);
            editorType            = _editor.GetType();
            _onSceneGUIMethodInfo = editorType.GetMethod("OnSceneGUI",
                                                         BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.InvokeMethod);
            if (_onSceneGUIMethodInfo == null)
            {
                Debug.LogErrorFormat(
                    "Editor {0} has no method OnSceneGUI for view updating. Editing can not be processed.",
                    _editor.GetType().Name);
                _editor = null;
                _caller = null;
                return;
            }

            SceneView.onSceneGUIDelegate += OnSceneGuiDelegate;
            Tools.hidden = true;
            if (SPSettings.Current.DebugMode)
            {
                Debug.LogFormat("Editor {0} enabled for editing {1}",
                                _editor.GetType().Name, _editor.target);
            }
        }
Exemplo n.º 4
0
 /// <inheritdoc />
 protected virtual void OnDisable()
 {
     Spline = null;
 }
Exemplo n.º 5
0
 //================================      Public methods      =================================
 /// <inheritdoc />
 protected virtual void OnEnable()
 {
     Spline = new SplineBridge(serializedObject);
 }