Add new and improve existing toolbar buttons #171

Merged
ManlyMarco merged 4 commits from toolbars into main 2025-09-20 01:48:05 +00:00
ManlyMarco commented 2025-09-20 01:45:38 +00:00 (Migrated from github.com)
No description provided.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-09-20 01:46:17 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

This PR adds new and improves existing toolbar buttons by implementing toolbar controls using the KKAPI.Studio.UI.Toolbars framework. The changes migrate from the deprecated CustomToolbarButtons API to the new SimpleToolbarButton and SimpleToolbarToggle controls.

Key changes:

  • Migrated toolbar button implementations to use KKAPI's new toolbar system
  • Encapsulated UI visibility state management with property accessors
  • Improved error messaging and logging in some components

Reviewed Changes

Copilot reviewed 14 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
VideoExport.Core/VideoExport.cs Implements new toolbar toggle button and encapsulates UI visibility with ShowUI property
Timeline.Core/TimelineButton.cs Refactors toolbar button to extend SimpleToolbarButton with improved state management
Timeline.Core/Timeline.cs Updates to use new TimelineButton implementation and removes deprecated button update calls
NodesConstraints.Core/NodesConstraints.cs Migrates to SimpleToolbarToggle with improved state management
Core.PoseEditor/MainWindow.cs Adds SimpleToolbarButton implementation with multi-click support and color state management
Core.PoseEditor/PoseController.cs Adds public accessor for DrawAdvancedMode and triggers toolbar color updates
VideoExport.Core/VideoExport.Core.projitems Adds toolbar icon as embedded resource
Other files Updates field access and improves error messages

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

## Pull Request Overview This PR adds new and improves existing toolbar buttons by implementing toolbar controls using the KKAPI.Studio.UI.Toolbars framework. The changes migrate from the deprecated CustomToolbarButtons API to the new SimpleToolbarButton and SimpleToolbarToggle controls. Key changes: - Migrated toolbar button implementations to use KKAPI's new toolbar system - Encapsulated UI visibility state management with property accessors - Improved error messaging and logging in some components ### Reviewed Changes Copilot reviewed 14 out of 19 changed files in this pull request and generated 3 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | VideoExport.Core/VideoExport.cs | Implements new toolbar toggle button and encapsulates UI visibility with ShowUI property | | Timeline.Core/TimelineButton.cs | Refactors toolbar button to extend SimpleToolbarButton with improved state management | | Timeline.Core/Timeline.cs | Updates to use new TimelineButton implementation and removes deprecated button update calls | | NodesConstraints.Core/NodesConstraints.cs | Migrates to SimpleToolbarToggle with improved state management | | Core.PoseEditor/MainWindow.cs | Adds SimpleToolbarButton implementation with multi-click support and color state management | | Core.PoseEditor/PoseController.cs | Adds public accessor for DrawAdvancedMode and triggers toolbar color updates | | VideoExport.Core/VideoExport.Core.projitems | Adds toolbar icon as embedded resource | | Other files | Updates field access and improves error messages | </details> --- <sub>**Tip:** Customize your code reviews with copilot-instructions.md. <a href="/IllusionMods/HSPlugins/new/main/.github?filename=copilot-instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Create the file</a> or <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">learn how to get started</a>.</sub>
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-09-20 01:46:16 +00:00

[nitpick] This complex null-checking chain could be simplified using the null-conditional operator: _self?._toolbarButton?.ButtonObject?.image?.color = ... for better readability.

            _self?._toolbarButton?.ButtonObject?.image?.color = PoseController.DrawAdvancedMode ? Color.yellow : _self.ShowUI ? Color.green : Color.white;
[nitpick] This complex null-checking chain could be simplified using the null-conditional operator: `_self?._toolbarButton?.ButtonObject?.image?.color = ...` for better readability. ```suggestion _self?._toolbarButton?.ButtonObject?.image?.color = PoseController.DrawAdvancedMode ? Color.yellow : _self.ShowUI ? Color.green : Color.white; ```
@ -31,0 +52,4 @@
protected override void CreateControl()
{
base.CreateControl();
UpdateButton();
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-09-20 01:46:16 +00:00

Potential null reference exception if ButtonObject is null. Consider adding a null check before calling StopCoroutine.

                        if (ButtonObject != null)
                            ButtonObject.StopCoroutine(_currentlyIsPlaying);
Potential null reference exception if ButtonObject is null. Consider adding a null check before calling StopCoroutine. ```suggestion if (ButtonObject != null) ButtonObject.StopCoroutine(_currentlyIsPlaying); ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-09-20 01:46:16 +00:00

Potential null reference exception if _toolbarButton is null when ShowUI is set before Awake() completes. Consider adding a null check.

                    if (_toolbarButton != null)
                        _toolbarButton.Toggled.OnNext(value);
Potential null reference exception if _toolbarButton is null when ShowUI is set before Awake() completes. Consider adding a null check. ```suggestion if (_toolbarButton != null) _toolbarButton.Toggled.OnNext(value); ```
Sign in to join this conversation.
No description provided.