-
Notifications
You must be signed in to change notification settings - Fork 855
[Quality Audit] Make MenuItem dynamically hiddeable for LookDev and RenderGraphWindow [OnHold] #5519
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
[Quality Audit] Make MenuItem dynamically hiddeable for LookDev and RenderGraphWindow [OnHold] #5519
Conversation
Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed. SRP Core Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure. |
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 comments, I think we should use the Pipeline instead of the Asset though.
com.unity.render-pipelines.core/Editor/Utilities/MenuUtilities.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.core/Editor/Utilities/MenuUtilities.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.core/Editor/Utilities/MenuUtilities.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.core/Editor/Utilities/MenuUtilities.cs
Outdated
Show resolved
Hide resolved
this.renderPipelineAssetTypes = renderPipelineAssetTypes | ||
.Select(rpat => rpat != null ? rpat : typeof(RenderPipelineAsset)).ToArray(); |
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.
I think we should throw an exception if the typeof is null or if the typeof is RenderPipelineAsset. This will mean invalid data. I think attribute must only be used to specify
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.
This is only to support case where we want something only in builtin. Builtin is null (render pipeline asset used) but null cannot be used as a key
public readonly int priority; | ||
public readonly bool validate; | ||
|
||
public MenuItemForRenderPipeline(string path, bool validate = false, int priority = 0, params Type[] renderPipelineAssetTypes) |
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.
Are we sure we want the asset and not the pipeline?
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.
Jenny seamed to say that the only thing we are certain at editor start is GraphicsSettings.currentRenderPipeline which is the Asset. Did I miss something @jenniferd-unity ? I would also prefer checking the RenderPipeline and not the asset if possible
@@ -1,690 +1,691 @@ | |||
using UnityEngine; |
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.
Is this file from this PR?
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.
Yes sorry I added missing name space here.
Only modification is that I remove the menu item for the RenderGraphWindow
Co-authored-by: alex-vazquez <76204843+alex-vazquez@users.noreply.github.com>
Co-authored-by: alex-vazquez <76204843+alex-vazquez@users.noreply.github.com>
Co-authored-by: alex-vazquez <76204843+alex-vazquez@users.noreply.github.com>
…ttps://github.com/Unity-Technologies/Graphics into srpcore/qualityaudit/menuitem-dynamically-hiddeable
@alex-vazquez Did you do any test for other attributes somewhere? I think I perhaps need to add some for this one. (I dunno exactly how) |
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.
See my comments about InitializeOnLoad and not being able to know which SRP is going to be used for rendering.
|
||
// Note: GraphicsSettings.currentRenderPipeline == null possible and should mean built-in | ||
// though we cannot use null as key so it was early replaced by typeof(RenderPipelineAsset) | ||
Type currentSRPType = GraphicsSettings.currentRenderPipeline?.GetType() ?? typeof(RenderPipelineAsset); |
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.
you can use RenderPipelineManager.currentPipeline
if you want the RenderPipeline type (our APIs are very confusing I know).
The problem I can see here is that this can be called from a InitializeOnLoad where we cannot guarantee that the ADB is ready - which means we cannot guarantee accessibility to the SRP asset of the current Quality level.
So I guess your solution works in some circumstances but not all. We definitely need to push for a callback to guarantee those scenarios. (OnAssetDatabaseReady?)
We know from CoreRP if they can or cannot be used. Also cleaning code
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.
Use the MenuManager :)
Update: This PR is OnHold and will remain as we still don't have a good lifecycle for render pipeline nd this is required to land it. Removing remaining reviewer. |
Closing the PR for now |
Purpose of this PR
MenuItem are not dynamically hideable normally. Here we added this possibility.
For LookDev and RenderGraph, we can find which RP can use them from CoreRP. So there is dedicated rules to them. This is a change from first attempt ([MenuItemForRenderPipeline]). As the attribute is no use right now, it is not in the final version of the PR. (It can still be added later though)
This is a requirement for Quality Audit in order to not have so many state (currently it can be "not here", "here but disabled", "here and enabled")
Testing status
Tested Manually:
Comments to reviewers