Exemplo n.º 1
0
            private static void ListenToPlayModeChanges()
            {
                EditorApplication.playmodeStateChanged += () =>
                {
                    if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
                    {
                        FixOpenAndUnsavedScenes();
                    }

                    if (EditorApplication.isPlaying
#if UNITY_5_6_OR_NEWER
                        && SessionState.GetBool(PreferencesKey, false)
#else
                        && EditorPrefs.HasKey(PreferencesKey)
#endif
                        )
                    {
#if UNITY_5_6_OR_NEWER
                        SessionState.EraseBool(
#else
                        EditorPrefs.DeleteKey(
#endif
                            PreferencesKey
                            );
                    }
                };
            }
Exemplo n.º 2
0
        internal static void RunOnceWhenAccessTokenAndProjectIdAreInitialized()
        {
            if (string.IsNullOrEmpty(CloudProjectSettings.accessToken))
            {
                return;
            }

            if (!SetupCloudProjectId.HasCloudProjectId())
            {
                return;
            }

            if (!SessionState.GetBool(
                    CloudProjectDownloader.IS_PROJECT_DOWNLOADER_ALREADY_EXECUTED_KEY, false))
            {
                return;
            }

            EditorApplication.update -= RunOnceWhenAccessTokenAndProjectIdAreInitialized;

            if (!ShouldProjectBeMigrated())
            {
                SessionState.SetInt(
                    IS_PROJECT_MIGRATED_ALREADY_CALCULATED_KEY,
                    MIGRATED_NOTHING_TO_DO);
                return;
            }

            Execute(
                CloudProjectSettings.accessToken,
                SetupCloudProjectId.GetCloudProjectId());
        }
Exemplo n.º 3
0
        static bool ShouldProjectBeMigrated(
            string projectPath,
            string projectGuid)
        {
            if (SessionState.GetBool(
                    CloudProjectDownloader.SHOULD_PROJECT_BE_DOWNLOADED_KEY, false))
            {
                return false;
            }

            string collabPath = GetCollabSnapshotFile(
                projectPath, projectGuid);

            if (!File.Exists(collabPath))
            {
                return false;
            }

            if (FindWorkspace.HasWorkspace(Application.dataPath))
            {
                return false;
            }

            return true;
        }
Exemplo n.º 4
0
        public ProfilerTimelineGUI(IProfilerWindowController window)
        {
            m_Window = window;
            // Configure default groups
            groups = new List <GroupInfo>(new GroupInfo[]
            {
                new GroupInfo()
                {
                    name = "", height = 0, expanded = true, threads = new List <ThreadInfo>()
                },
                new GroupInfo()
                {
                    name = "Unity Job System", height = kGroupHeight, expanded = SessionState.GetBool("Unity Job System", false), threads = new List <ThreadInfo>()
                },
                new GroupInfo()
                {
                    name = "Loading", height = kGroupHeight, expanded = SessionState.GetBool("Loading", false), threads = new List <ThreadInfo>()
                },
            });

            m_LocalizedString_Total     = LocalizationDatabase.GetLocalizedString("Total");
            m_LocalizedString_Instances = LocalizationDatabase.GetLocalizedString("Instances");

            m_HTicks = new TickHandler();
            m_HTicks.SetTickModulos(k_TickModulos);
        }
Exemplo n.º 5
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var surfacesProp = property.FindPropertyRelative(nameof(ChiselSurfaceDefinition.surfaces));

            EditorGUI.BeginProperty(position, label, surfacesProp);
            bool prevShowMixedValue = EditorGUI.showMixedValue;

            EditorGUI.BeginChangeCheck();
            var path            = surfacesProp.propertyPath;
            var surfacesVisible = SessionState.GetBool(path, false);

            surfacesVisible = EditorGUILayout.Foldout(surfacesVisible, kSurfacesContent);
            if (EditorGUI.EndChangeCheck())
            {
                SessionState.SetBool(path, surfacesVisible);
            }
            if (surfacesVisible)
            {
                EditorGUI.indentLevel++;
                SerializedProperty elementProperty;
                for (int i = 0; i < surfacesProp.arraySize; i++)
                {
                    surfacePropertyContent.text = string.Format(kSurfacePropertyName, (i + 1));
                    elementProperty             = surfacesProp.GetArrayElementAtIndex(i);
                    EditorGUILayout.PropertyField(elementProperty, surfacePropertyContent, true);
                }
                EditorGUI.indentLevel--;
            }

            EditorGUI.showMixedValue = prevShowMixedValue;
            EditorGUI.EndProperty();
        }
Exemplo n.º 6
0
        protected override void InitInspector()
        {
            boundsProp             = serializedObject.FindProperty("bounds");
            surfaceDescriptionProp = serializedObject.FindProperty("surfaceDescriptions");
            surfaceAssetProp       = serializedObject.FindProperty("surfaceAssets");

            surfacesVisible = SessionState.GetBool(kSurfacesVisibleKey, false);
        }
 protected virtual void OnEnable()
 {
     synchronizationSettingsFoldout = SessionState.GetBool(SynchronizationSettingsKey, synchronizationSettingsFoldout);
     handedness          = serializedObject.FindProperty("handedness");
     useSourcePoseData   = serializedObject.FindProperty("useSourcePoseData");
     poseAction          = serializedObject.FindProperty("poseAction");
     destroyOnSourceLost = serializedObject.FindProperty("destroyOnSourceLost");
 }
Exemplo n.º 8
0
 private bool ReadActiveState()
 {
     if (this.m_Area == ProfilerArea.GPU)
     {
         return(SessionState.GetBool("ProfilerChart" + this.m_Area, false));
     }
     return(EditorPrefs.GetBool("ProfilerChart" + this.m_Area, true));
 }
Exemplo n.º 9
0
 static void SelectReadmeAutomatically()
 {
     if (!SessionState.GetBool(kShowedReadmeSessionStateName, false))
     {
         SelectReadme();
         SessionState.SetBool(kShowedReadmeSessionStateName, true);
     }
 }
Exemplo n.º 10
0
 static ScriptBuilder()
 {
     if (SessionState.GetBool("SpeedScriptLoaded", false) == false)
     {
         SessionState.SetBool("SpeedScriptLoaded", true);
         TemplateSettingsEditorWindow.RefreshCustomTemplates();
     }
 }
Exemplo n.º 11
0
 static XRPackage()
 {
     if (!SessionState.GetBool(k_NotificationKey, false))
     {
         Debug.LogWarning(k_PackageNotificationTooltip);
         SessionState.SetBool(k_NotificationKey, true);
     }
 }
Exemplo n.º 12
0
 protected static void SelectReadmeOnLoad()
 {
     if (!SessionState.GetBool(isReadmeShownKey, false))
     {
         SelectReadme();
         SessionState.SetBool(isReadmeShownKey, true);
     }
 }
Exemplo n.º 13
0
        static void CheckPrefsAndShow()
        {
            int cookie = EditorPrefs.GetInt(kShowOnStart + salt, defaultValue: 0);

            if (cookie < kShowOnStartCookie && !SessionState.GetBool(kShownThisSession, defaultValue: false))
            {
                Show();
            }
        }
Exemplo n.º 14
0
 public static bool GetBoolOnce(string key, bool defaultValue = false)
 {
     if (SessionState.GetBool(key, defaultValue))
     {
         return(true);
     }
     SessionState.SetBool(key, !defaultValue);
     return(false);
 }
Exemplo n.º 15
0
 private static void SelectReadmeAutomatically()
 {
     if (SessionState.GetBool(ShowedReadmeSessionStateName, false))
     {
         return;
     }
     SelectReadme();
     SessionState.SetBool(ShowedReadmeSessionStateName, true);
 }
        public override void DrawInspectorGUI(object target)
        {
            IMixedRealitySpatialAwarenessSystem spatial            = (IMixedRealitySpatialAwarenessSystem)target;
            IMixedRealityDataProviderAccess     dataProviderAccess = (IMixedRealityDataProviderAccess)spatial;

            EditorGUILayout.LabelField("Observers", EditorStyles.boldLabel);
            int observerIndex = 0;

            foreach (IMixedRealitySpatialAwarenessObserver observer in dataProviderAccess.GetDataProviders())
            {
                GUI.color = observer.IsRunning ? enabledColor : disabledColor;

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);

                GUI.color = GetObserverColor(observerIndex);
                GUILayout.Button(observer.Name);
                GUI.color = observer.IsRunning ? enabledColor : disabledColor;

                EditorGUILayout.Toggle("Running", observer.IsRunning);
                EditorGUILayout.LabelField("Source", observer.SourceName);
                EditorGUILayout.Toggle("Is Stationary", observer.IsStationaryObserver);
                EditorGUILayout.FloatField("Update Interval", observer.UpdateInterval);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Volume Properties", EditorStyles.boldLabel);
                EditorGUILayout.EnumPopup("Volume Type", observer.ObserverVolumeType);
                EditorGUILayout.Vector3Field("Origin", observer.ObserverOrigin);
                EditorGUILayout.Vector3Field("Rotation", observer.ObserverRotation.eulerAngles);
                EditorGUILayout.Vector3Field("Extents", observer.ObservationExtents);

                EditorGUILayout.EndVertical();
                observerIndex++;
            }

            GUI.color = enabledColor;

            if (!Application.isPlaying)
            {
                EditorGUILayout.HelpBox("Observers will be populated once you enter play mode.", MessageType.Info);
            }
            else if (observerIndex == 0)
            {
                EditorGUILayout.LabelField("(None found)", EditorStyles.miniLabel);
            }

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Editor Options", EditorStyles.boldLabel);
            ShowObserverBoundary = SessionState.GetBool(ShowObserverBoundaryKey, false);
            ShowObserverBoundary = EditorGUILayout.Toggle("Show Observer Boundaries", ShowObserverBoundary);
            SessionState.SetBool(ShowObserverBoundaryKey, ShowObserverBoundary);

            ShowObserverOrigin = SessionState.GetBool(ShowObserverOriginKey, false);
            ShowObserverOrigin = EditorGUILayout.Toggle("Show Observer Origins", ShowObserverOrigin);
            SessionState.SetBool(ShowObserverOriginKey, ShowObserverOrigin);
        }
Exemplo n.º 17
0
        public static float GetDefaultHeight(string propertyPath, bool hasLabel)
        {
            var height = EditorGUI.GetPropertyHeight(SerializedPropertyType.Generic, GUIContent.none);

            if (!hasLabel || SessionState.GetBool(propertyPath, false))
            {
                height += (EditorGUI.GetPropertyHeight(SerializedPropertyType.Boolean, GUIContent.none) + kSpacing) * kBitsHigh;
            }
            return(height);
        }
        public static void _showCoreInstallerWindow()
        {
            if (!SessionState.GetBool(_shouldShowWindowKey, false))
            {
                return;
            }

            SessionState.EraseBool(_shouldShowWindowKey);
            EditorApplication.delayCall += OneSignalSetupWindow.ShowWindow;
        }
Exemplo n.º 19
0
 internal void OnEnable()
 {
     if (!target)
     {
         submeshesProp = null;
         return;
     }
     submeshesProp    = serializedObject.FindProperty("subMeshes");
     submeshesVisible = SessionState.GetBool(kSubmeshesVisibleKey, true);
 }
Exemplo n.º 20
0
        private static void OnInitializeOnLoad()
        {
            CompilationPipeline.assemblyCompilationFinished += OnCompilationFinished;

            if (!SessionState.GetBool(UniMobWeavedFlagName, false))
            {
                SessionState.SetBool(UniMobWeavedFlagName, true);
                WeaveExistingAssemblies(CompilationPipeline.GetAssemblies());
            }
        }
        protected virtual void OnEnable()
        {
            DrawManualDirectionHandle = SessionState.GetBool(DrawManualDirectionHandleKey, DrawManualDirectionHandle);

            editorSettingsFoldout = SessionState.GetBool(EditorSettingsFoldoutKey, editorSettingsFoldout);

            connector = (ToolTipConnector)target;

            serializedObject.ApplyModifiedProperties();
        }
    public static void _showCoreInstallerWindow()
    {
        if (!SessionState.GetBool(_shouldShowWindowKey, false))
        {
            return;
        }

        SessionState.EraseBool(_shouldShowWindowKey);
        OneSignalSetupWindow.ShowWindow();
    }
Exemplo n.º 23
0
    static void CheckPrefsAndShow()
    {
        int cookie = EditorPrefs.GetInt(kShowOnStart + salt, defaultValue: 0);

        if (cookie < kShowOnStartCookie && !SessionState.GetBool(kShownThisSession, defaultValue: false))
        {
            EditorApplication.delayCall += ResetRenderPipeline;
            Show();
        }
    }
Exemplo n.º 24
0
        void AddProperty(AbstractShaderProperty property, bool create = false, int index = -1)
        {
            if (m_PropertyRows.ContainsKey(property.guid))
            {
                return;
            }

            if (create)
            {
                property.displayName = m_Graph.SanitizePropertyName(property.displayName);
            }

            var icon  = property.generatePropertyBlock ? exposedIcon : null;
            var field = new BlackboardField(icon, property.displayName, property.propertyType.ToString())
            {
                userData = property
            };

            var propertyView = new BlackboardFieldPropertyView(field, m_Graph, property);
            var row          = new BlackboardRow(field, propertyView);
            var pill         = row.Q <Pill>();

            pill.RegisterCallback <MouseEnterEvent>(evt => OnMouseHover(evt, property));
            pill.RegisterCallback <MouseLeaveEvent>(evt => OnMouseHover(evt, property));
            pill.RegisterCallback <DragUpdatedEvent>(OnDragUpdatedEvent);

            var expandButton = row.Q <Button>("expandButton");

            expandButton.RegisterCallback <MouseDownEvent>(evt => OnExpanded(evt, property), TrickleDown.TrickleDown);

            row.userData = property;
            if (index < 0)
            {
                index = m_PropertyRows.Count;
            }
            if (index == m_PropertyRows.Count)
            {
                m_Section.Add(row);
            }
            else
            {
                m_Section.Insert(index, row);
            }
            m_PropertyRows[property.guid] = row;

            m_PropertyRows[property.guid].expanded = SessionState.GetBool(property.guid.ToString(), true);

            if (create)
            {
                row.expanded = true;
                m_Graph.owner.RegisterCompleteObjectUndo("Create Property");
                m_Graph.AddShaderProperty(property);
                field.OpenTextEditor();
            }
        }
Exemplo n.º 25
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            // show button state in play mode
            {
                EditorGUI.BeginDisabledGroup(Application.isPlaying == false);

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Button State", EditorStyles.boldLabel);
                EditorGUILayout.Toggle("Touching", button.IsTouching);
                EditorGUILayout.Toggle("Pressing", button.IsPressing);
                EditorGUI.EndDisabledGroup();
            }

            // editor settings
            {
                EditorGUI.BeginDisabledGroup(Application.isPlaying == true);
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Editor Settings", EditorStyles.boldLabel);
                VisiblePlanes = SessionState.GetBool(VisiblePlanesKey, true);
                bool newValue = EditorGUILayout.Toggle("Show Button Event Planes", VisiblePlanes);
                if (newValue != VisiblePlanes)
                {
                    SessionState.SetBool(VisiblePlanesKey, newValue);
                }

                // enable plane editing
                {
                    EditorGUI.BeginDisabledGroup(VisiblePlanes == false);
                    EditingEnabled = SessionState.GetBool(EditingEnabledKey, false);
                    newValue       = EditorGUILayout.Toggle("Make Planes Editable", EditingEnabled);
                    if (newValue != EditingEnabled)
                    {
                        SessionState.SetBool(EditingEnabledKey, newValue);
                        EditorUtility.SetDirty(target);
                    }
                    EditorGUI.EndDisabledGroup();
                }

                // plane distance conversion
                {
                    EditorGUI.BeginDisabledGroup(EditingEnabled == false);
                    PressableButton.SpaceMode buttonSpaceMode = button.DistanceSpaceMode;
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField(buttonSpaceMode == PressableButton.SpaceMode.Local ? "Plane Distances are in local space" : "Plane Distances are in world space", EditorStyles.boldLabel);
                    if (GUILayout.Button(buttonSpaceMode == PressableButton.SpaceMode.Local ? "Convert Distances to World Space" : "Convert Distances to Local Space"))
                    {
                        OnTriggerPlaneDistanceConversion();
                    }
                    EditorGUI.EndDisabledGroup();
                }
                EditorGUI.EndDisabledGroup();
            }
        }
        internal ShaderInputViewController(ShaderInput shaderInput, ShaderInputViewModel inViewModel, GraphDataStore graphDataStore)
            : base(shaderInput, inViewModel, graphDataStore)
        {
            InitializeViewModel();

            m_BlackboardPropertyView            = new BlackboardPropertyView(ViewModel);
            m_BlackboardPropertyView.controller = this;

            m_BlackboardRowView          = new SGBlackboardRow(m_BlackboardPropertyView, null);
            m_BlackboardRowView.expanded = SessionState.GetBool($"Unity.ShaderGraph.Input.{shaderInput.objectId}.isExpanded", false);
        }
Exemplo n.º 27
0
 private bool ReadActiveState()
 {
     if (m_Area == ProfilerArea.GPU)
     {
         return(SessionState.GetBool(kPrefCharts + m_Area, false));
     }
     else
     {
         return(EditorPrefs.GetBool(kPrefCharts + m_Area, true));
     }
 }
Exemplo n.º 28
0
    public static bool CheckForFirstInit()
    {
        bool firstLaunch = SessionState.GetBool("EnvConfigFirstLaunch", true);

        if (firstLaunch)
        {
            SessionState.SetBool("EnvConfigFirstLaunch", false);
        }

        return(firstLaunch);
    }
Exemplo n.º 29
0
        /// <summary>
        /// Draws a section start with header name and save open/close state to given preference key in SessionState
        /// </summary>
        public static bool DrawSectionFoldoutWithKey(string headerName, string preferenceKey = null, GUIStyle style = null, bool defaultOpen = true)
        {
            bool showPref = SessionState.GetBool(preferenceKey, defaultOpen);
            bool show = DrawSectionFoldout(headerName, showPref, style);
            if (show != showPref)
            {
                SessionState.SetBool(preferenceKey, show);
            }

            return show;
        }
        /// <summary>
        /// Asks to open the SDK Setup if legacy files are found or core is missing
        /// </summary>
        [InitializeOnLoadMethod] public static void CheckForLegacy()
        {
            if (SessionState.GetBool(_sessionCheckKey, false))
            {
                return;
            }

            SessionState.SetBool(_sessionCheckKey, true);

            EditorApplication.delayCall += _checkForLegacy;
        }