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 ThemeColor controller #181

Merged
merged 17 commits into from
May 14, 2022
Merged

Conversation

DomNomNom
Copy link
Contributor

Re-purposes the bottom of the controller to show current theme colors

Adds a selection for themecolor mode and displays current theme color:
image

Adds a controller to change the custom theme colors
image

@pema99
Copy link
Collaborator

pema99 commented May 11, 2022

This PR shouldn't be against master, please retarget to dev. More pressingly, it sort of looks like you based your branch of an old version of master? The diff is huge has conflicts with dev.

@DomNomNom DomNomNom changed the base branch from master to dev May 11, 2022 09:51
@DomNomNom
Copy link
Contributor Author

Fixed the base / conflicts

@@ -64,7 +67,21 @@ void Update()

void Start()
{
if (audioLink == null) Debug.Log("Controller not connected to AudioLink");
if (audioLink == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't block the PR because of it, but again, nice to keep the bracing style consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. I'm too used to having a linter auto-fix my formatting ^^

if (themeColorController == null) {
// This is here in case someone upgraded AudioLink, which updates
// everything in the prefab, but not the outermost properties of the prefab.
// TODO: Double check that this is how upgrading ends up working.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you verify this yourself yet, or shall I do it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not yet verified this. I'd appreciate it if you have time

// TODO: Double check that this is how upgrading ends up working.
Debug.Log("AudioLinkController using fallback method for finding themeColorController");
Transform controllerTransform = transform.Find("ThemeColorController");
themeColorController = (UdonBehaviour) controllerTransform.GetComponent(typeof(UdonBehaviour));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a nullref exception waiting to happen in case "ThemeColorController" couldn't be found, or if it doesn't have an UdonBehaviour component. Perhaps add some null checks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Added null-checks.

audioSpectrumDisplay.SetFloat("_Threshold0", threshold0Slider.value);
audioSpectrumDisplay.SetFloat("_Threshold1", threshold1Slider.value);
audioSpectrumDisplay.SetFloat("_Threshold2", threshold2Slider.value);
audioSpectrumDisplay.SetFloat("_Threshold3", threshold3Slider.value);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind at all, but I'm just curious. Why'd you move this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it does not depend on audioLink, which is now gated behind a null-check

{
[UdonSynced] private int themeColorMode;

[UdonSynced] public Color[] customThemeColors = new Color[4]{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, you can sync this? I wasn't aware o.o

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:D
From Udon docs:

You can sync variables which are arrays for the following types:
bool, char, byte, sbyte, short, ushort, int, uint, long, ulong, float, double, Vector2, Vector3, Vector4, Quaternion, Color and Color32.

@pema99
Copy link
Collaborator

pema99 commented May 14, 2022

This looks great. Thanks for doing it, the theme colors are feeling like a real feature now. I've added a few minor comments.

About the networking code added to support the customizable theme colors, have you tested it? In my experience it can be quite tricky to get Udon networking code right, so I'd like to know if you'v verified it with multiple VRC clients.

@pema99
Copy link
Collaborator

pema99 commented May 14, 2022

Seems like the upgrade logic works fine

@pema99 pema99 merged commit 5d7c15e into llealloo:dev May 14, 2022
pema99 added a commit that referenced this pull request May 15, 2022
* Fix broken shader includes

* Add player validity check

* Fix NaN propagation through slider control if duration comes back 0

* #if guarded using directives ,class declarations and code that depends vrc/udon to allow compiling without without VRCSDK and UDON

* stop unity from throwing warnings

* fix implicit truncation warning

* recompiled UDON assets and updated prefabs

* fixed truncation properly

* added override keyword instead of disabling the warning

* Recompiled Udon Assets

* unified inconsistent line endings

* Recompiled Udon Assets

* Add editor define to export script

* No-op incompatible code

* Add render texture property to be set globally

* Mode spectrum wheel model. Recompile prefabs

* Copy over changelog. Move version included in releases

* Add header guard to AudioLink.cginc

This is a public facing API, and as such should have a header guard, so that modular shaders can include the file wherever necessary without stepping on each other's toes.

As a practical example, adding AudioLink support to LTCGI usually breaks shaders when both are used in combination on one material, since `LTCGI.cginc` also includes `AudioLink.cginc`.

* Fixed vertical uv flip of audio texture on Quest

* Remove profiler from example scene, fixes #162

* Update instance owner use to the non-broken one.

Switch from Networking.IsInstanceOwner to Networking.LocalPlayer.isInstanceOwner because the static method is known to be broken.

* Revisited issue #162

Fixed a NullReferenceException that would occur if you have an empty UdonBehaviour when trying to link all sound reactive objects.

* Add Demo 9 for ALPASS_THEME_COLOR

* Fix Theme colors not being set.

* save scene

* save

* Add Demo 9 to LiveScene too.

* Revert to audiolink material

* bracing style

* add scripting define symbol

* Remove some duplicated stuff and copy it over on build instead

* Update changelog tentatively

* Namespace mirror toggle script to prevent conflicts, recompile assets

* cleanup warning

* Update some audiolink note functions

* revert truncation changes

* fixed typos

* ThemeColorEnable -> ThemeColorMode (#172)

* ThemeColorsEnable -> ThemeColorMode

* Use suggested labels for themeColorMode

* Remove debug log

* themeColorX -> customThemeColorX

* update asset file with the addition of "custom"

* Move some scripts, namespace editor scripts, recompile needed assets

* Change fade defaults to be more responsive. (#176)

* Add UTC (Unix Epoc Indexed) Timestamps (#174)

* AudioLinkGetTimeOfDay

* Update changelog again

* Update readme

* Little mistake regarding UTC time

* Remove unused shader variable. (#177)

* Adjust null checks for the audioSource (#180)

This prevents AudioLink script from crashing when an audioSource is not present, as it might only be assigned during runtime instead of in editor.  
Add a warning to notify users about the missing audioSource in case it was unintentional.

* fix pixelated logo on controller (#179)

* Cleanup repeated uint encoding code. (#178)

* Add ThemeColor controller (#181)

* ThemeColorsEnable -> ThemeColorMode

* Use suggested labels for themeColorMode

* Remove debug log

* themeColorX -> customThemeColorX

* update asset file with the addition of "custom"

* Add to Colors to AudioLinkController.

* Add Theme color preview to bottom of controller

* In progress towards ThemeColorController

* Make dropdown work

* yay

* Fix clipping on selection markers.

* brace style

* sprinkle in null checks for themeColorController

* use casting, not `as`

* commit whatever unity did to the asset file

* tweak selection indicator positions

* Styling

* Update readme and changelog

* This is 0.2.8

* UI scooting and call things lassos

* Hopefully last recompilation

* Don't use material from example folder for controller

Co-authored-by: Justin Aquadro <[email protected]>
Co-authored-by: Float3 <[email protected]>
Co-authored-by: yewnyx <[email protected]>
Co-authored-by: pi <[email protected]>
Co-authored-by: Shadowriver <[email protected]>
Co-authored-by: Techanon <[email protected]>
Co-authored-by: Nestorboy <[email protected]>
Co-authored-by: DomNomNom <[email protected]>
Co-authored-by: CNLohr <[email protected]>
Co-authored-by: Leah <[email protected]>
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.

2 participants