Skip to content
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

Add Scene View Overlay Toolbar #6

Merged
merged 4 commits into from
Jul 12, 2024

Conversation

nukeandbeans
Copy link
Contributor

What this does:

  • Adds a new toolbar overlay to the scene view, with buttons to add lights, and adjust user settings.

How do I use?

Press space bar while the scene view is focused, and toggle the "Dynamic Lighting" overlay to show and hide it.

What can I do with it?

  • Create lights. Lots of lights.
  • Bake all those lights, quickly.
  • Clear those lights. Guess you didn't want them there after all, huh?

Extras:

  • There is an additional toggle in the bake drop-down that allows you to turn on bounce lighting by default, for each light you place after it is turned on.
  • When a light is placed, it will snap to the Unity grid, or the RealtimeCSG grid if it is present. This can be toggled.
  • There is a new about window! It's fancy! With icons!
  • All actions to create new lights have undo.

Added:
+ New overlay toolbar
+ About window
+ New scriptable object class for editor resources
+ Icons required for about window

Modified:
* Made DynamicLightManager.EditorDeleteLightmaps() public
* Commented out old menu items for support links
* Added reference to RealtimeCSG in the editor asmdef
* Added version define for RealtimeCSG to the editor asmdef
@Henry00IS
Copy link
Owner

Hey Fluffles, thank you for your contribution to the project! I appreciate the effort and time you've put into this.

I did notice a couple things.

On monitors without UI scaling the about dialog is very small and hard to read:
image

When you open the menu for other light types multiple times, it continues adding separator bars at the bottom:
image

The light creation options in the create menu have additional settings to set up the light sources. These options are not being applied. For example the Discoball light:
image
When created with the old menu:
image

I am using CodeMaid with default Visual Studio formatting. Please use the same coding style as the rest of the project:
CodeMaid Config.zip

Regarding the attribution comments in the code, I completely understand the desire to receive credit for your work. However, having the following comment at the top of every file:

// * * * * * * * * * * * * * * * * * * * * * *
//  Author:  Lindsey Keene (nukeandbeans)
//  Contact: Twitter @nukeandbeans, Discord @nukeandbeans
//
//  Description:
//
//  * * * * * * * * * * * * * * * * * * * * * *

Feels a bit out of place, especially on smaller files like editor resources.

I'm sure we can find a way to properly acknowledge your contributions, I like having you in the about dialog and I can even add a dedicated section in the documentation. This way, your work is recognized without the need for extensive comments throughout the codebase. What do you think?

Looking forward to your thoughts!

@Henry00IS
Copy link
Owner

This code does not compile on Unity 2020 because it's using C# 9.0 features.

LinkButton discordButton = new(); // Feature 'target-typed object creation' is not available in C# 8.0. Please use language version 9.0 or greater.

But also because it doesn't yet know UnityEditor.Overlays and UnityEditor.Toolbars etc. as such it may be worth putting them in 2021 or newer conditional compilation. We do not have to drop support just yet, when we simply use the existing menu code in older versions.

Also Unity objects should not use coalescing assignment, the ??= operator. It will throw warning UNT0023 and does not work the way you expect (DynamicLightingEditorResources).
https://nosuchstudio.medium.com/why-are-null-coalescing-operators-evil-in-unity-16f5a88d6071

* Adjusted scaling for about window UI
* Fixed disco ball lights not having proper settings when created
* Fixed spacers being added to the bake dropdown endlessly
* Fixed null coalescing issue (thanks again, Unity 😦)
* Fixed compilation issues on older versions of Unity that doesn't support overlays
@Henry00IS Henry00IS merged commit 555ae59 into Henry00IS:master Jul 12, 2024
Henry00IS added a commit that referenced this pull request Jul 12, 2024
@Henry00IS
Copy link
Owner

Thank you so much Fluffles! This is a big quality of life improvement! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants