Skip to content

Commit da231ff

Browse files
committed
fix(trackerobjects): de-squeeze library row when binding button is added
Two cumulative changes to keep the four-button row readable: - Skip the assign-tracker button entirely for SpawnMode.Scene and SpawnMethod.Embedded rows. A disabled fourth button just pushed the Select/Teleport/Remove labels off the right of those rows, and those instances can't host a tracker binding anyway (scene spawn isn't user-owned; embedded has no pickup/rigid surface). - Shorten the labels from "Assign Tracker" / "Unbind Tracker" to "Assign" / "Unbind". Matches the brevity of Select/Remove and frees horizontal space on rows that DO get the button. The prop-row context already makes "what's being assigned" obvious. REQUIREMENTS.md and the integration README updated to match.
1 parent 3360277 commit da231ff

4 files changed

Lines changed: 19 additions & 20 deletions

File tree

Basis/Packages/com.basis.framework/BasisUI/Localization/Languages/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@
344344
{ "key": "library.share", "value": "Share" },
345345
{ "key": "library.teleportTo", "value": "Teleport To" },
346346
{ "key": "library.remove", "value": "Remove" },
347-
{ "key": "library.assignTracker", "value": "Assign Tracker" },
348-
{ "key": "library.unbindTracker", "value": "Unbind Tracker" },
347+
{ "key": "library.assignTracker", "value": "Assign" },
348+
{ "key": "library.unbindTracker", "value": "Unbind" },
349349
{ "key": "library.trackerPicker.title", "value": "Choose Tracker" },
350350
{ "key": "library.trackerPicker.empty", "value": "No trackers are currently connected." },
351351
{ "key": "library.trackerPicker.confirm", "value": "Bind" },

Basis/Packages/com.basis.integration.trackerobjects/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Basis Tracker Objects Integration
22

3-
Bridges [`com.basis.trackerobjects`](../com.basis.trackerobjects/REQUIREMENTS.md) into the Basis library menu. When a prop has been instantiated and shows up in the library's instantiated-items tab, this package adds an **Assign Tracker** button to the row. Clicking it opens a tracker picker; confirming a tracker binds the prop's GameObject to that tracker via `BasisTrackerObjectManager`. Clicking **Unbind Tracker** removes the binding.
3+
Bridges [`com.basis.trackerobjects`](../com.basis.trackerobjects/REQUIREMENTS.md) into the Basis library menu. When a prop has been instantiated and shows up in the library's instantiated-items tab, this package adds an **Assign** button to the row. Clicking it opens a tracker picker; confirming a tracker binds the prop's GameObject to that tracker via `BasisTrackerObjectManager`. Clicking **Unbind** removes the binding.
44

55
## Why a separate package
66

@@ -10,13 +10,13 @@ Bridges [`com.basis.trackerobjects`](../com.basis.trackerobjects/REQUIREMENTS.md
1010

1111
- A `[RuntimeInitializeOnLoadMethod(SubsystemRegistration)]` subscriber on `LibraryProvider.OnInstanceRowCreated`. For every instantiated-object row that `LibraryProvider` builds, this appends a `StandardButton` between the existing Select and Teleport buttons.
1212
- The button is non-interactable for `SpawnMode.Scene` and `SpawnMethod.Embedded` items — same rule the Select button applies.
13-
- Clicking **Assign Tracker** opens a `DialogBox<BasisInput>` modal listing the currently-connected trackers eligible for prop binding. Confirming a row calls `BasisTrackerObjectManager.TryCreateBinding` with the spawn instance's `LoadedNetID` and `GameObject` transform. The picker excludes:
13+
- Clicking **Assign** opens a `DialogBox<BasisInput>` modal listing the currently-connected trackers eligible for prop binding. Confirming a row calls `BasisTrackerObjectManager.TryCreateBinding` with the spawn instance's `LoadedNetID` and `GameObject` transform. The picker excludes:
1414
- `BasisVirtualMidpointInput` instances (the virtual half of an active pair).
1515
- Trackers with `BasisInput.IsLinked == true` (one half of an active pair).
1616
- Trackers whose `UniqueDeviceIdentifier` has a `BasisTrackerRoleOverride.TryGetOverride` hit.
1717
- Devices the input matcher has pinned to a fixed role (HMD, named controllers, etc.).
1818
- Trackers currently driving an avatar bone via calibration. Decalibrate first if you want to reuse a calibrated tracker for a prop.
19-
- Clicking **Unbind Tracker** calls `BasisTrackerObjectManager.TryRemoveBinding` directly — no confirmation dialog. Unbind isn't destructive; the binding just lifts.
19+
- Clicking **Unbind** calls `BasisTrackerObjectManager.TryRemoveBinding` directly — no confirmation dialog. Unbind isn't destructive; the binding just lifts.
2020

2121
## Compile guards
2222

Basis/Packages/com.basis.integration.trackerobjects/Runtime/BasisTrackerObjectsLibraryHook.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using Basis.Scripts.TransformBinders.BoneControl;
99
using Basis.TrackerObjects;
1010
using UnityEngine;
11-
using UnityEngine.UI;
1211

1312
namespace Basis.Integration.TrackerObjects
1413
{
@@ -31,20 +30,18 @@ private static void OnRowCreated(RectTransform parent, BasisRuntimeSpawnRegistry
3130
string netID = instance.LoadedNetID;
3231
if (string.IsNullOrEmpty(netID)) return;
3332

33+
// Scene-mode and embedded instances can't host a tracker binding (no
34+
// pickup/rigid surface to drive, and they're not user-owned spawns), so
35+
// skip adding the button at all — a disabled fourth button just pushes
36+
// the Select/Teleport/Remove row over.
37+
if (instance.SpawnMode == BasisRuntimeSpawnRegistry.SpawnMode.Scene) return;
38+
if (instance.SpawnMethod == BasisRuntimeSpawnRegistry.SpawnMethod.Embedded) return;
39+
3440
bool hasBinding = BasisTrackerObjectManager.TryGetBindingByLoadedNetID(netID, out _);
3541
PanelButton button = PanelButton.CreateNew(PanelButton.ButtonStyles.StandardButton, parent);
3642
button.Descriptor.SetTitle(BasisLocalization.Get(hasBinding ? "library.unbindTracker" : "library.assignTracker"));
3743
button.SetSize(RowSize);
3844

39-
bool interactable =
40-
instance.SpawnMode != BasisRuntimeSpawnRegistry.SpawnMode.Scene
41-
&& instance.SpawnMethod != BasisRuntimeSpawnRegistry.SpawnMethod.Embedded;
42-
if (button.Descriptor.gameObject.TryGetComponent(out Button buttonComponent))
43-
{
44-
buttonComponent.interactable = interactable;
45-
}
46-
if (!interactable) return;
47-
4845
button.OnClicked += async () =>
4946
{
5047
if (BasisTrackerObjectManager.TryGetBindingByLoadedNetID(netID, out BasisTrackerBinding existing))

Basis/Packages/com.basis.trackerobjects/REQUIREMENTS.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,14 @@ A new `PanelButton` is added to each instantiated-object row in `LibraryProvider
7777

7878
| Binding state for this `InstanceId` | Button style | Button label (localization key) |
7979
| ----------------------------------- | ------------------ | -------------------------------------- |
80-
| No binding | `StandardButton` | `library.assignTracker` ("Assign Tracker") |
81-
| Binding exists | `StandardButton` | `library.unbindTracker` ("Unbind Tracker") |
80+
| No binding | `StandardButton` | `library.assignTracker` ("Assign") |
81+
| Binding exists | `StandardButton` | `library.unbindTracker` ("Unbind") |
82+
83+
Labels are deliberately one word — the prop-row context already makes "what's being assigned" obvious, and the row's equal-share horizontal layout means a longer label would squeeze Select/Teleport/Remove visibly.
8284

8385
The style stays fixed; only the label flips. This matches the existing Select/Deselect pattern on the same row and avoids signalling unbind as destructive (it isn't — no data loss, the binding just lifts).
8486

85-
The button is non-interactable when the instance's `SpawnMode == Scene` or `SpawnMethod == Embedded`, mirroring the existing Select button's interactability rules.
87+
The button is skipped entirely (not added to the row) when the instance's `SpawnMode == Scene` or `SpawnMethod == Embedded`. A disabled fourth button would push Select/Teleport/Remove off the right of the row, and those instances can't host a tracker binding regardless — a scene spawn isn't user-owned and an embedded one has no pickup/rigid surface to drive.
8688

8789
### Tracker picker dialog
8890

@@ -100,8 +102,8 @@ The picker is user-initiated, so the host must always show it — if the dialogu
100102

101103
Localization strings land in every `Localization/Languages/*.json` file. English values:
102104

103-
- `library.assignTracker` — "Assign Tracker"
104-
- `library.unbindTracker` — "Unbind Tracker"
105+
- `library.assignTracker` — "Assign"
106+
- `library.unbindTracker` — "Unbind"
105107
- `library.trackerPicker.title` — "Choose Tracker"
106108
- `library.trackerPicker.empty` — "No trackers are currently connected."
107109
- `library.trackerPicker.confirm` — "Bind"

0 commit comments

Comments
 (0)