-
Notifications
You must be signed in to change notification settings - Fork 0
Project settings UI #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| using UnityEditor; | ||
| using UnityEditor.UIElements; | ||
| using UnityEngine; | ||
| using UnityEngine.UIElements; | ||
|
|
||
| namespace Disguise.RenderStream | ||
| { | ||
| [CustomEditor(typeof(DisguiseRenderStreamSettings))] | ||
| class DisguiseRenderStreamSettingsEditor : Editor | ||
| { | ||
| public static class Style | ||
| { | ||
| public const string DisguiseSettingsContainer = "disguise-settings-container"; | ||
| public const string DisguiseSettingsTitle = "disguise-settings-title"; | ||
| } | ||
|
|
||
| [SerializeField] | ||
| VisualTreeAsset m_Layout; | ||
|
|
||
| [SerializeField] | ||
| StyleSheet m_Style; | ||
|
|
||
| public override VisualElement CreateInspectorGUI() | ||
| { | ||
| var root = new VisualElement(); | ||
|
|
||
| m_Layout.CloneTree(root); | ||
| root.styleSheets.Add(m_Style); | ||
|
|
||
| root.Bind(serializedObject); | ||
|
|
||
| return root; | ||
| } | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| .disguise-settings-container | ||
| { | ||
| margin-left: 9px; | ||
| margin-top: 1px; | ||
| } | ||
|
|
||
| .disguise-settings-title | ||
| { | ||
| font-size: 19px; | ||
| -unity-font-style: bold; | ||
| margin-bottom: 12px; | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements"> | ||
| <uie:PropertyField label="Scene Control" binding-path="sceneControl" /> | ||
| <uie:PropertyField label="Unity Debug Window Presenter" binding-path="enableUnityDebugWindowPresenter" /> | ||
| </ui:UXML> | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| using UnityEditor; | ||
| using UnityEngine.UIElements; | ||
|
|
||
| namespace Disguise.RenderStream | ||
| { | ||
| static class DisguiseRenderStreamSettingsProvider | ||
| { | ||
| static readonly string k_SettingsPath = "Project/DisguiseRenderStream"; | ||
|
|
||
| class Contents | ||
| { | ||
| public const string SettingsName = "Disguise RenderStream"; | ||
| } | ||
|
|
||
| [SettingsProvider] | ||
| static SettingsProvider CreateSettingsProvider() => | ||
| new (k_SettingsPath, SettingsScope.Project) | ||
| { | ||
| label = Contents.SettingsName, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Food for thoughts: I noticed that when the Cluster Display package looks like is present settings looks like this: I wonder, is it what we want? Because there are a lot of settings in there that are not for Disguise RenderStream and could potentially confuse the user (and cause trouble if wrongly configured). In fact, when Cluster Display is working with Disguise I'd be tempted to have the following settings:
But I guess this cannot be achieved only in this package, we also need a way for the ClusterDisplay package to stop providing its own settings when "requested" (or maybe we simply want to hardcode checking for the DisguiseRenderStream package)
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few thoughts:
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oups, my bad. Yeah, I must admit I'm not a big fan of Cluster Display knowing about Disguise RenderStream package either. What about Cluster Display only adds its setting pages if Cluster Graphics package is present? Not perfect but "less worst"?
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's interesting. I rather like the idea of making Cluster Display (core) a "hidden" dependency of other packages (e.g. Graphics, RenderStream), kind of similar to Core SRP. Let's take a look at how Core SRP settings are exposed for inspiration. |
||
| activateHandler = (searchContext, parentElement) => | ||
| { | ||
| var settings = DisguiseRenderStreamSettings.GetOrCreateSettings(); | ||
| var editor = Editor.CreateEditor(settings); | ||
|
|
||
| var gui = editor.CreateInspectorGUI(); | ||
| gui.AddToClassList(DisguiseRenderStreamSettingsEditor.Style.DisguiseSettingsContainer); | ||
|
|
||
| var title = new Label { text = Contents.SettingsName }; | ||
| title.AddToClassList(DisguiseRenderStreamSettingsEditor.Style.DisguiseSettingsTitle); | ||
| gui.Insert(0, title); | ||
|
|
||
| parentElement.Add(gui); | ||
| }, | ||
| keywords = SettingsProvider.GetSearchKeywordsFromSerializedObject(new SerializedObject(DisguiseRenderStreamSettings.GetOrCreateSettings())) | ||
| }; | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: In code, I've started using
L10.Tr()for strings, because this was the recommendation I got on the UIToolkit slack. Unfortunately, they don't have a good answer for strings in UXML. Figures 😞