public static void ChangeEditMode(SceneViewEditMode mode, UnityEditor.Editor caller) { UnityEditor.Editor objectFromInstanceId = InternalEditorUtility.GetObjectFromInstanceID(ownerId) as UnityEditor.Editor; if (SPSettings.Current.DebugMode) { Debug.LogFormat("ChangeEditMode from {0} to {1} ", editMode, mode); } editMode = mode; ownerId = mode == SceneViewEditMode.None ? 0 : caller.GetInstanceID(); _contoller.EndEditing(); if (onEditModeEndDelegate != null) { onEditModeEndDelegate(objectFromInstanceId); } if (editMode != SceneViewEditMode.None) { _contoller.StartEditing(mode, caller); if (onEditModeStartDelegate != null) { onEditModeStartDelegate(caller, editMode); } } SceneView.RepaintAll(); }
public static void DoInspectorControls(UnityEditor.Editor caller) { int instanceId = caller.GetInstanceID(); if (editMode != SceneViewEditMode.None && ownerId != instanceId) { return; } _contoller.OnInspectorGUI(); }
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(); }
public static void DoEditModeInspectorModeButton(UnityEditor.Editor caller) { if (_buttonStyle == null) { _buttonStyle = new GUIStyle((GUIStyle)"Button"); _buttonStyle.padding = new RectOffset(0, 0, 0, 0); _buttonStyle.margin = new RectOffset(10, 10, 0, 0); } DetectMainToolChange(); Rect controlRect = EditorGUILayout.GetControlRect(true, 23f); Rect position = new Rect(controlRect.xMin + EditorGUIUtility.labelWidth, controlRect.yMin, 33f, 23f); int instanceId = caller.GetInstanceID(); bool flag = editMode != SceneViewEditMode.None && ownerId == instanceId; EditorGUI.BeginChangeCheck(); bool editing = GUI.Toggle(position, flag, _icon, _buttonStyle); if (!EditorGUI.EndChangeCheck()) { return; } ChangeEditMode(editing ? SceneViewEditMode.Spline : SceneViewEditMode.None, caller); }
internal void UnsavedChangesStateChanged(Editor editor, bool value) { Internal_UnsavedChangesStateChanged(this, editor.GetInstanceID(), value); }
public static void DoEditModeInspectorModeButton(SceneViewEditMode mode, string label, GUIContent icon, Bounds bounds, Editor caller) { if (!EditorUtility.IsPersistent(caller.target)) { DetectMainToolChange(); if (s_EditColliderButtonStyle == null) { s_EditColliderButtonStyle = new GUIStyle("Button"); s_EditColliderButtonStyle.padding = new RectOffset(0, 0, 0, 0); s_EditColliderButtonStyle.margin = new RectOffset(0, 0, 0, 0); } Rect rect = EditorGUILayout.GetControlRect(true, 23f, new GUILayoutOption[0]); Rect position = new Rect(rect.xMin + EditorGUIUtility.labelWidth, rect.yMin, 33f, 23f); GUIContent content = new GUIContent(label); Vector2 vector = GUI.skin.label.CalcSize(content); Rect rect3 = new Rect(position.xMax + 5f, rect.yMin + ((rect.height - vector.y) * 0.5f), vector.x, rect.height); int instanceID = caller.GetInstanceID(); bool flag = (editMode == mode) && (ownerID == instanceID); EditorGUI.BeginChangeCheck(); bool flag2 = GUI.Toggle(position, flag, icon, s_EditColliderButtonStyle); GUI.Label(rect3, label); if (EditorGUI.EndChangeCheck()) { ChangeEditMode(!flag2 ? SceneViewEditMode.None : mode, bounds, caller); } } }
public static bool IsOwner(Editor editor) { return (editor.GetInstanceID() == ownerID); }
public static void DoInspectorToolbar(SceneViewEditMode[] modes, GUIContent[] guiContents, Bounds bounds, Editor caller) { if (!EditorUtility.IsPersistent(caller.target)) { DetectMainToolChange(); if (s_ToolbarBaseStyle == null) { s_ToolbarBaseStyle = "Command"; } int instanceID = caller.GetInstanceID(); int index = ArrayUtility.IndexOf<SceneViewEditMode>(modes, editMode); if (ownerID != instanceID) { index = -1; } EditorGUI.BeginChangeCheck(); int num3 = GUILayout.Toolbar(index, guiContents, s_ToolbarBaseStyle, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { SceneViewEditMode mode = (num3 != index) ? modes[num3] : SceneViewEditMode.None; ChangeEditMode(mode, bounds, caller); } } }
public static bool IsOwner(Editor editor) { return editor.GetInstanceID() == EditMode.ownerID; }
private static void ChangeEditMode(EditMode.SceneViewEditMode mode, Bounds bounds, Editor caller) { Editor objectFromInstanceId = InternalEditorUtility.GetObjectFromInstanceID(EditMode.ownerID) as Editor; EditMode.editMode = mode; EditMode.ownerID = mode == EditMode.SceneViewEditMode.None ? 0 : caller.GetInstanceID(); if (EditMode.onEditModeEndDelegate != null) EditMode.onEditModeEndDelegate(objectFromInstanceId); if (EditMode.editMode != EditMode.SceneViewEditMode.None && EditMode.onEditModeStartDelegate != null) EditMode.onEditModeStartDelegate(caller, EditMode.editMode); EditMode.EditModeChanged(bounds); InspectorWindow.RepaintAllInspectors(); }
public static void DoInspectorToolbar(EditMode.SceneViewEditMode[] modes, GUIContent[] guiContents, Bounds bounds, Editor caller) { if (EditorUtility.IsPersistent(caller.target)) return; EditMode.DetectMainToolChange(); if (EditMode.s_ToolbarBaseStyle == null) EditMode.s_ToolbarBaseStyle = (GUIStyle) "Command"; int instanceId = caller.GetInstanceID(); int selected = ArrayUtility.IndexOf<EditMode.SceneViewEditMode>(modes, EditMode.editMode); if (EditMode.ownerID != instanceId) selected = -1; EditorGUI.BeginChangeCheck(); int index = GUILayout.Toolbar(selected, guiContents, EditMode.s_ToolbarBaseStyle, new GUILayoutOption[0]); if (!EditorGUI.EndChangeCheck()) return; EditMode.ChangeEditMode(index != selected ? modes[index] : EditMode.SceneViewEditMode.None, bounds, caller); }
public static void DoInspectorToolbar(EditMode.SceneViewEditMode[] modes, GUIContent[] guiContents, Bounds bounds, Editor caller) { if (EditorUtility.IsPersistent(caller.target)) { return; } EditMode.DetectMainToolChange(); if (EditMode.s_ToolbarBaseStyle == null) { EditMode.s_ToolbarBaseStyle = "Command"; } int instanceID = caller.GetInstanceID(); int num = ArrayUtility.IndexOf<EditMode.SceneViewEditMode>(modes, EditMode.editMode); if (EditMode.ownerID != instanceID) { num = -1; } EditorGUI.BeginChangeCheck(); int num2 = GUILayout.Toolbar(num, guiContents, EditMode.s_ToolbarBaseStyle, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { EditMode.SceneViewEditMode mode = (num2 != num) ? modes[num2] : EditMode.SceneViewEditMode.None; EditMode.ChangeEditMode(mode, bounds, caller); } }
public static void DoEditModeInspectorModeButton(EditMode.SceneViewEditMode mode, string label, GUIContent icon, Bounds bounds, Editor caller) { if (EditorUtility.IsPersistent(caller.target)) return; EditMode.DetectMainToolChange(); if (EditMode.s_EditColliderButtonStyle == null) { EditMode.s_EditColliderButtonStyle = new GUIStyle((GUIStyle) "Button"); EditMode.s_EditColliderButtonStyle.padding = new RectOffset(0, 0, 0, 0); EditMode.s_EditColliderButtonStyle.margin = new RectOffset(0, 0, 0, 0); } Rect controlRect = EditorGUILayout.GetControlRect(true, 23f, new GUILayoutOption[0]); Rect position1 = new Rect(controlRect.xMin + EditorGUIUtility.labelWidth, controlRect.yMin, 33f, 23f); Vector2 vector2 = GUI.skin.label.CalcSize(new GUIContent(label)); Rect position2 = new Rect(position1.xMax + 5f, controlRect.yMin + (float) (((double) controlRect.height - (double) vector2.y) * 0.5), vector2.x, controlRect.height); int instanceId = caller.GetInstanceID(); bool flag1 = EditMode.editMode == mode && EditMode.ownerID == instanceId; EditorGUI.BeginChangeCheck(); bool flag2 = GUI.Toggle(position1, flag1, icon, EditMode.s_EditColliderButtonStyle); GUI.Label(position2, label); if (!EditorGUI.EndChangeCheck()) return; EditMode.ChangeEditMode(!flag2 ? EditMode.SceneViewEditMode.None : mode, bounds, caller); }