Add tablet integration and refactor curve utilities #84

Merged
rnetiks merged 19 commits from master into master 2025-09-12 14:01:12 +00:00
rnetiks commented 2025-09-07 22:32:29 +00:00 (Migrated from github.com)

Introduced a new Tablet class utilizing WinTabAPI for tablet input handling, including support for pressure sensitivity and data processing. Replaced legacy Bezier functionality in SmartRect with a generic solver function and migrated curve logic to a dedicated Curve utility for cleaner code and maintainability.

Introduced a new `Tablet` class utilizing WinTabAPI for tablet input handling, including support for pressure sensitivity and data processing. Replaced legacy Bezier functionality in `SmartRect` with a generic solver function and migrated curve logic to a dedicated `Curve` utility for cleaner code and maintainability.
ManlyMarco (Migrated from github.com) reviewed 2025-09-08 17:36:42 +00:00
ManlyMarco (Migrated from github.com) left a comment

Is good but

Is good but
@ -0,0 +1,251 @@
using MonoMod.Cil;
ManlyMarco (Migrated from github.com) commented 2025-09-08 17:36:31 +00:00

Is this class supposed to be internal?

Is this class supposed to be internal?
@ -0,0 +186,4 @@
private int _bufferSize;
private IntPtr _packetBuffer;
public float CurrentPressure
ManlyMarco (Migrated from github.com) commented 2025-09-08 17:35:13 +00:00

No summary

No summary
@ -0,0 +477,4 @@
return ushort.MaxValue;
}
public void Dispose()
ManlyMarco (Migrated from github.com) commented 2025-09-08 17:36:06 +00:00

Either add a summary or make this an explicit interface implementation

Either add a summary or make this an explicit interface implementation
ManlyMarco (Migrated from github.com) reviewed 2025-09-08 18:14:05 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-09-11 18:42:35 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

Adds tablet integration capabilities with a dedicated Tablet class using WinTabAPI for pressure-sensitive input and refactors curve utilities for better code organization. The changes replace legacy Bezier functionality with a generic solver pattern and consolidate curve logic into a dedicated utility class.

  • Add comprehensive tablet integration with WinTabAPI support for pressure sensitivity and data processing
  • Refactor SmartRect to use generic solver functions instead of hardcoded Bezier templates
  • Migrate curve functionality to dedicated Curve utility class with various interpolation methods

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Shared.Core/Utilities/TabletManager.cs Implements singleton manager for tablet input with event subscription and polling mechanisms
src/Shared.Core/Utilities/Tablet.cs Core tablet class with WinTabAPI integration for pressure-sensitive input handling
src/Shared.Core/Utilities/SmartRect.cs Refactors animation system to use generic solver functions and adds new event/properties
src/Shared.Core/Utilities/Curve.cs New utility class containing various curve interpolation methods and templates
src/Shared.Core/Shared.Core.projitems Updates project file to include new tablet and curve utility classes

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

## Pull Request Overview Adds tablet integration capabilities with a dedicated `Tablet` class using WinTabAPI for pressure-sensitive input and refactors curve utilities for better code organization. The changes replace legacy Bezier functionality with a generic solver pattern and consolidate curve logic into a dedicated utility class. - Add comprehensive tablet integration with WinTabAPI support for pressure sensitivity and data processing - Refactor `SmartRect` to use generic solver functions instead of hardcoded Bezier templates - Migrate curve functionality to dedicated `Curve` utility class with various interpolation methods ### Reviewed Changes Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | src/Shared.Core/Utilities/TabletManager.cs | Implements singleton manager for tablet input with event subscription and polling mechanisms | | src/Shared.Core/Utilities/Tablet.cs | Core tablet class with WinTabAPI integration for pressure-sensitive input handling | | src/Shared.Core/Utilities/SmartRect.cs | Refactors animation system to use generic solver functions and adds new event/properties | | src/Shared.Core/Utilities/Curve.cs | New utility class containing various curve interpolation methods and templates | | src/Shared.Core/Shared.Core.projitems | Updates project file to include new tablet and curve utility classes | </details> --- <sub>**Tip:** Customize your code reviews with copilot-instructions.md. <a href="/IllusionMods/IllusionModdingAPI/new/master/.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>
@ -0,0 +192,4 @@
/// <returns>An array of <see cref="Vector3"/> containing the resampled polyline points.</returns>
/// <remarks>Does not work with <see cref="Bezier(UnityEngine.Vector4,UnityEngine.Vector4,UnityEngine.Vector4,UnityEngine.Vector4,float)"/> for <paramref name="solver"/></remarks>
public static Vector3[] ResamplePoly(Vector3[] points, int count, bool smooth = false,
RuntimeILReferenceBag.FastDelegateInvokers.Func<Vector3, Vector3, Vector3, Vector3, float, Vector3> solver = null)
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-09-11 18:42:35 +00:00

Using RuntimeILReferenceBag.FastDelegateInvokers.Func instead of the standard System.Func delegate appears unusual and may create unnecessary dependencies. Consider using the standard Func<Vector3, Vector3, Vector3, Vector3, float, Vector3> unless there's a specific performance requirement.

            System.Func<Vector3, Vector3, Vector3, Vector3, float, Vector3> solver = null)
Using `RuntimeILReferenceBag.FastDelegateInvokers.Func` instead of the standard `System.Func` delegate appears unusual and may create unnecessary dependencies. Consider using the standard `Func<Vector3, Vector3, Vector3, Vector3, float, Vector3>` unless there's a specific performance requirement. ```suggestion System.Func<Vector3, Vector3, Vector3, Vector3, float, Vector3> solver = null) ```
@ -0,0 +361,4 @@
/// </returns>
public bool QueryMulti(out Packet[] data)
{
data = new Packet[0];
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-09-11 18:42:35 +00:00

Use Array.Empty<Packet>() instead of new Packet[0] for better performance and clarity.

            data = Array.Empty<Packet>();
Use `Array.Empty<Packet>()` instead of `new Packet[0]` for better performance and clarity. ```suggestion data = Array.Empty<Packet>(); ```
@ -0,0 +1,155 @@
using System;
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-09-11 18:42:34 +00:00

Empty catch block silently swallows exceptions. Consider logging the exception or at least documenting why it's intentionally ignored.

                        Debug.LogException(e);
Empty catch block silently swallows exceptions. Consider logging the exception or at least documenting why it's intentionally ignored. ```suggestion Debug.LogException(e); ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-09-11 18:42:35 +00:00

The null-conditional operator is redundant since there's already a null check on line 76. Use _timer.Dispose(); directly.

                    _timer.Dispose();
The null-conditional operator is redundant since there's already a null check on line 76. Use `_timer.Dispose();` directly. ```suggestion _timer.Dispose(); ```
rnetiks (Migrated from github.com) reviewed 2025-09-11 19:09:28 +00:00
@ -0,0 +361,4 @@
/// </returns>
public bool QueryMulti(out Packet[] data)
{
data = new Packet[0];
rnetiks (Migrated from github.com) commented 2025-09-11 19:09:28 +00:00

Array.Empty is not available in v3.5

Array.Empty is not available in v3.5
ManlyMarco (Migrated from github.com) reviewed 2025-09-12 13:30:35 +00:00
@ -0,0 +1,155 @@
using System;
ManlyMarco (Migrated from github.com) commented 2025-09-12 13:30:35 +00:00
                        UnityEngine.Debug.LogError($"Subscriber crash! Removing subscriber {subscriber?.GetType().FullName} because of exception: {e}");
```suggestion UnityEngine.Debug.LogError($"Subscriber crash! Removing subscriber {subscriber?.GetType().FullName} because of exception: {e}"); ```
ManlyMarco (Migrated from github.com) reviewed 2025-09-12 13:31:26 +00:00
@ -0,0 +1,251 @@
using MonoMod.Cil;
ManlyMarco (Migrated from github.com) commented 2025-09-12 13:31:25 +00:00

Missing docs

Missing docs
ManlyMarco (Migrated from github.com) approved these changes 2025-09-12 13:53:02 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
IllusionMods/IllusionModdingAPI!84
No description provided.