Пример #1
0
        internal static void ChangeEditMode(EditMode.SceneViewEditMode mode, Bounds bounds, IToolModeOwner owner)
        {
            IToolModeOwner toolModeOwner = InternalEditorUtility.GetObjectFromInstanceID(EditMode.ownerID) as IToolModeOwner;

            EditMode.editMode = mode;
            EditMode.ownerID  = ((mode == EditMode.SceneViewEditMode.None) ? 0 : owner.GetInstanceID());
            if (EditMode.onEditModeEndDelegate != null && toolModeOwner is Editor)
            {
                EditMode.onEditModeEndDelegate(toolModeOwner as Editor);
            }
            if (EditMode.editModeEnded != null)
            {
                EditMode.editModeEnded(toolModeOwner);
            }
            if (EditMode.editMode != EditMode.SceneViewEditMode.None)
            {
                if (EditMode.onEditModeStartDelegate != null && owner is Editor)
                {
                    EditMode.onEditModeStartDelegate(owner as Editor, EditMode.editMode);
                }
                if (EditMode.editModeStarted != null)
                {
                    EditMode.editModeStarted(owner, EditMode.editMode);
                }
            }
            EditMode.EditModeChanged(bounds);
            InspectorWindow.RepaintAllInspectors();
        }
Пример #2
0
        internal static void ChangeEditMode(SceneViewEditMode mode, Bounds bounds, IToolModeOwner owner)
        {
            IToolModeOwner oldOwner = InternalEditorUtility.GetObjectFromInstanceID(ownerID) as IToolModeOwner;

            editMode = mode;

            ownerID = mode != SceneViewEditMode.None ? owner.GetInstanceID() : 0;

            if (onEditModeEndDelegate != null && oldOwner is Editor)
            {
                onEditModeEndDelegate(oldOwner as Editor);
            }
            if (editModeEnded != null)
            {
                editModeEnded(oldOwner);
            }

            if (editMode != SceneViewEditMode.None)
            {
                if (onEditModeStartDelegate != null && owner is Editor)
                {
                    onEditModeStartDelegate(owner as Editor, editMode);
                }
                if (editModeStarted != null)
                {
                    editModeStarted(owner, editMode);
                }
            }

            EditModeChanged(bounds);

            InspectorWindow.RepaintAllInspectors();
        }
Пример #3
0
        public static void OnSelectionChange()
        {
            IToolModeOwner toolModeOwner = InternalEditorUtility.GetObjectFromInstanceID(EditMode.ownerID) as IToolModeOwner;

            if (toolModeOwner == null || !toolModeOwner.ModeSurvivesSelectionChange((int)EditMode.s_EditMode))
            {
                EditMode.QuitEditMode();
            }
        }
Пример #4
0
        public static void OnSelectionChange()
        {
            IToolModeOwner owner = InternalEditorUtility.GetObjectFromInstanceID(ownerID) as IToolModeOwner;

            if (owner != null && owner.ModeSurvivesSelectionChange((int)s_EditMode))
            {
                return;
            }
            QuitEditMode();
        }
Пример #5
0
 public static AnimationEvent FromClipboard(AnimationWindowEventClipboard e)
 {
     return(new AnimationEvent
     {
         time = e.time,
         functionName = e.functionName,
         stringParameter = e.stringParam,
         objectReferenceParameter = InternalEditorUtility.GetObjectFromInstanceID(e.objectParam),
         floatParameter = e.floatParam,
         intParameter = e.intParam,
         messageOptions = e.messageOptions
     });
 }
Пример #6
0
        internal static void EditModeToolStateChanged(IToolModeOwner owner, SceneViewEditMode mode)
        {
            // In cases of domain reloads the EditorTool can be deserialized prior to the target Inspector being
            // created. The EditMode tools do not expect an editModeStarted callback on reloads.
            if (owner == null && mode != SceneViewEditMode.None)
            {
                editMode = mode;
                return;
            }

            IToolModeOwner oldOwner = InternalEditorUtility.GetObjectFromInstanceID(ownerID) as IToolModeOwner;

            editMode = mode;

            if (oldOwner != null)
            {
                if (onEditModeEndDelegate != null && oldOwner is Editor)
                {
                    onEditModeEndDelegate(oldOwner as Editor);
                }

                if (editModeEnded != null)
                {
                    editModeEnded(oldOwner);
                }
            }

            ownerID = mode != SceneViewEditMode.None ? owner.GetInstanceID() : k_OwnerIdNone;

            if (editMode != SceneViewEditMode.None)
            {
                if (onEditModeStartDelegate != null && owner is Editor)
                {
                    onEditModeStartDelegate(owner as Editor, editMode);
                }

                if (editModeStarted != null)
                {
                    editModeStarted(owner, editMode);
                }
            }

            FocusEditModeToolTarget((mode != SceneViewEditMode.None && owner != null)
                ? owner.GetWorldBoundsOfTargets()
                : new Bounds(Vector3.zero, Vector3.positiveInfinity));

            InspectorWindow.RepaintAllInspectors();
        }
Пример #7
0
        private static void ChangeEditMode(EditMode.SceneViewEditMode mode, Bounds bounds, Editor caller)
        {
            Editor editor = InternalEditorUtility.GetObjectFromInstanceID(EditMode.ownerID) as Editor;

            EditMode.editMode = mode;
            EditMode.ownerID  = ((mode == EditMode.SceneViewEditMode.None) ? 0 : caller.GetInstanceID());
            if (EditMode.onEditModeEndDelegate != null)
            {
                EditMode.onEditModeEndDelegate(editor);
            }
            if (EditMode.editMode != EditMode.SceneViewEditMode.None && EditMode.onEditModeStartDelegate != null)
            {
                EditMode.onEditModeStartDelegate(caller, EditMode.editMode);
            }
            EditMode.EditModeChanged(bounds);
            InspectorWindow.RepaintAllInspectors();
        }
Пример #8
0
        private static void ChangeEditMode(SceneViewEditMode mode, Bounds bounds, Editor caller)
        {
            Editor objectFromInstanceID = InternalEditorUtility.GetObjectFromInstanceID(ownerID) as Editor;

            editMode = mode;
            ownerID  = (mode == SceneViewEditMode.None) ? 0 : caller.GetInstanceID();
            if (onEditModeEndDelegate != null)
            {
                onEditModeEndDelegate(objectFromInstanceID);
            }
            if ((editMode != SceneViewEditMode.None) && (onEditModeStartDelegate != null))
            {
                onEditModeStartDelegate(caller, editMode);
            }
            EditModeChanged(bounds);
            InspectorWindow.RepaintAllInspectors();
        }