Skip to content

Commit a504796

Browse files
committed
Add tracking mapping features and UI components
- Updated localization files for English and Japanese to include new tracking mapping strings. - Implemented VCamSettingMappingTableView for displaying and managing tracking mappings. - Created VCamSettingTrackingMappingEditorView for editing tracking mappings with a toolbar for actions. - Introduced AppKitMinMaxSlider for selecting min and max values in the tracking mapping settings. - Added functionality for managing input and output keys, including adding, deleting, and resetting mappings. - Enhanced UI with appropriate feedback and controls for user interaction.
1 parent d06a25f commit a504796

File tree

7 files changed

+1228
-17
lines changed

7 files changed

+1228
-17
lines changed

app/xcode/Sources/VCamBridge/TrackingMappingEntry.swift

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public extension TrackingMappingEntry.Key {
8989
var id: String { key }
9090
var nameKey: LocalizedStringKey {
9191
if isVCamKey {
92-
LocalizedString(lookupKey: "trackingInput_\(key)").key
92+
L10n.key("trackingInput_\(key)").key
9393
} else {
9494
"\(key)"
9595
}
@@ -155,8 +155,8 @@ public extension TrackingMappingEntry.InputKey {
155155
static let headZ = Self(key: "_headZ", bounds: -90...90)
156156
static let eyeX = Self(key: "_eyeX", bounds: -1...1)
157157
static let eyeY = Self(key: "_eyeY", bounds: -1...1)
158-
static let blinkL = Self(key: "_blinkL", bounds: 0...1)
159-
static let blinkR = Self(key: "_blinkR", bounds: 0...1)
158+
static let blinkL = Self(key: "_blinkL", bounds: 0...1, rangeMin: 0.02, rangeMax: 0.98)
159+
static let blinkR = Self(key: "_blinkR", bounds: 0...1, rangeMin: 0.02, rangeMax: 0.98)
160160
static let mouth = Self(key: "_mouth", bounds: 0...1)
161161

162162
// ARKit BlendShapes
@@ -292,16 +292,7 @@ public extension TrackingMappingEntry {
292292
.eyeX, .eyeY
293293
]
294294
#else
295-
private static let live2DPerfectSyncKeyDefinitions: [InputKey] = [
296-
.posX, .posY, .posZ,
297-
.headX, .headY, .headZ,
298-
.eyeX, .eyeY,
299-
.eyeBlinkLeft, .eyeBlinkRight,
300-
.jawOpen,
301-
.mouthFunnel, .mouthPucker,
302-
.mouthSmileLeft, .mouthSmileRight,
303-
.mouthFrownLeft, .mouthFrownRight
304-
]
295+
private static let live2DPerfectSyncKeyDefinitions: [InputKey] = live2DBlendShapeKeyDefinitions
305296

306297
private static let live2DBlendShapeKeyDefinitions: [InputKey] = [
307298
.posX, .posY, .posZ,

app/xcode/Sources/VCamLocalization/Generated.swift

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ public enum L10n {
168168
public static let edit = LocalizedString(lookupKey: "edit")
169169
/// Edit Avatar
170170
public static let editAvatar = LocalizedString(lookupKey: "editAvatar")
171+
/// Edit Output Bounds
172+
public static let editOutputBounds = LocalizedString(lookupKey: "editOutputBounds")
173+
/// Set the minimum and maximum values for the output range.
174+
public static let editOutputBoundsMessage = LocalizedString(lookupKey: "editOutputBoundsMessage")
171175
/// Emoji
172176
public static let emoji = LocalizedString(lookupKey: "emoji")
173177
/// Enable
@@ -316,6 +320,8 @@ public enum L10n {
316320
public static let manageAccountAndSubscription = LocalizedString(lookupKey: "manageAccountAndSubscription")
317321
/// Manage Objects
318322
public static let manageObjects = LocalizedString(lookupKey: "manageObjects")
323+
/// Maximum
324+
public static let maximum = LocalizedString(lookupKey: "maximum")
319325
/// Message
320326
public static let message = LocalizedString(lookupKey: "message")
321327
/// Microphone
@@ -328,6 +334,8 @@ public enum L10n {
328334
public static let migrateToNewVirtualCamera = LocalizedString(lookupKey: "migrateToNewVirtualCamera")
329335
/// This app will migrate to a virtual camera optimized for the latest macOS.\nPlease follow the instructions to delete the old plugin and install the new virtual camera.
330336
public static let migrateToNewVirtualCameraMessage = LocalizedString(lookupKey: "migrateToNewVirtualCameraMessage")
337+
/// Minimum
338+
public static let minimum = LocalizedString(lookupKey: "minimum")
331339
/// Motion
332340
public static let motion = LocalizedString(lookupKey: "motion")
333341
/// Reset position
@@ -352,6 +360,8 @@ public enum L10n {
352360
public static let object = LocalizedString(lookupKey: "object")
353361
/// Official Website
354362
public static let officialWebsite = LocalizedString(lookupKey: "officialWebsite")
363+
/// OK
364+
public static let ok = LocalizedString(lookupKey: "ok")
355365
/// Open File
356366
public static let openFile = LocalizedString(lookupKey: "openFile")
357367
/// Open preferences
@@ -512,6 +522,36 @@ public enum L10n {
512522
public static let trackEyes = LocalizedString(lookupKey: "trackEyes")
513523
/// Tracking
514524
public static let tracking = LocalizedString(lookupKey: "tracking")
525+
/// Blink Left
526+
public static let trackingInputBlinkL = LocalizedString(lookupKey: "trackingInput__blinkL")
527+
/// Blink Right
528+
public static let trackingInputBlinkR = LocalizedString(lookupKey: "trackingInput__blinkR")
529+
/// Eye Movement X
530+
public static let trackingInputEyeX = LocalizedString(lookupKey: "trackingInput__eyeX")
531+
/// Eye Movement Y
532+
public static let trackingInputEyeY = LocalizedString(lookupKey: "trackingInput__eyeY")
533+
/// Head Rotation X
534+
public static let trackingInputHeadX = LocalizedString(lookupKey: "trackingInput__headX")
535+
/// Head Rotation Y
536+
public static let trackingInputHeadY = LocalizedString(lookupKey: "trackingInput__headY")
537+
/// Head Rotation Z
538+
public static let trackingInputHeadZ = LocalizedString(lookupKey: "trackingInput__headZ")
539+
/// Mouth
540+
public static let trackingInputMouth = LocalizedString(lookupKey: "trackingInput__mouth")
541+
/// Position X
542+
public static let trackingInputPosX = LocalizedString(lookupKey: "trackingInput__posX")
543+
/// Position Y
544+
public static let trackingInputPosY = LocalizedString(lookupKey: "trackingInput__posY")
545+
/// Position Z
546+
public static let trackingInputPosZ = LocalizedString(lookupKey: "trackingInput__posZ")
547+
/// Vowel
548+
public static let trackingInputVowel = LocalizedString(lookupKey: "trackingInput__vowel")
549+
/// Tracking Mapping
550+
public static let trackingMapping = LocalizedString(lookupKey: "trackingMapping")
551+
/// Save feature will be added in a future update.
552+
public static let trackingMappingSaveComingSoon = LocalizedString(lookupKey: "trackingMappingSaveComingSoon")
553+
/// Tracking Mode
554+
public static let trackingMode = LocalizedString(lookupKey: "trackingMode")
515555
/// Type%@
516556
public static func typeNo(_ p1: Any) -> ArgumentsLocalizedString {
517557
ArgumentsLocalizedString("typeNo %@", "typeNo \(String(describing: p1))", String(describing: p1))
@@ -590,15 +630,15 @@ extension L10n {
590630
return bundle
591631
}()
592632
}
633+
634+
public static func key(_ name: String) -> LocalizedString {
635+
LocalizedString(lookupKey: name)
636+
}
593637
}
594638

595639
public struct LocalizedString {
596640
let lookupKey: String
597641

598-
public init(lookupKey: String) {
599-
self.lookupKey = lookupKey
600-
}
601-
602642
public var key: LocalizedStringKey {
603643
LocalizedStringKey(lookupKey)
604644
}

app/xcode/Sources/VCamLocalization/VCamResources/en.lproj/Localizable.strings

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// MARK: - Common
1010

11+
"ok" = "OK";
1112
"default" = "Default";
1213
"cancel" = "Cancel";
1314
"close" = "Close";
@@ -339,3 +340,25 @@
339340

340341
"authenticationError" = "Authentication Error";
341342
"pleaseRestartAppAndTryAgain" = "Please restart the app and try again.";
343+
344+
// MARK: - Tracking Mapping
345+
346+
"trackingMapping" = "Tracking Mapping";
347+
"trackingMode" = "Tracking Mode";
348+
"trackingMappingSaveComingSoon" = "Save feature will be added in a future update.";
349+
"trackingInput__posX" = "Position X";
350+
"trackingInput__posY" = "Position Y";
351+
"trackingInput__posZ" = "Position Z";
352+
"trackingInput__headX" = "Head Rotation X";
353+
"trackingInput__headY" = "Head Rotation Y";
354+
"trackingInput__headZ" = "Head Rotation Z";
355+
"trackingInput__eyeX" = "Eye Movement X";
356+
"trackingInput__eyeY" = "Eye Movement Y";
357+
"trackingInput__blinkL" = "Blink Left";
358+
"trackingInput__blinkR" = "Blink Right";
359+
"trackingInput__mouth" = "Mouth";
360+
"trackingInput__vowel" = "Vowel";
361+
"editOutputBounds" = "Edit Output Bounds";
362+
"editOutputBoundsMessage" = "Set the minimum and maximum values for the output range.";
363+
"minimum" = "Minimum";
364+
"maximum" = "Maximum";

app/xcode/Sources/VCamLocalization/VCamResources/ja.lproj/Localizable.strings

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// MARK: - Common
1010

11+
"ok" = "OK";
1112
"default" = "デフォルト";
1213
"cancel" = "キャンセル";
1314
"close" = "閉じる";
@@ -339,3 +340,25 @@
339340

340341
"authenticationError" = "認証エラー";
341342
"pleaseRestartAppAndTryAgain" = "アプリを再起動してもう一度お試しください。";
343+
344+
// MARK: - Tracking Mapping
345+
346+
"trackingMapping" = "トラッキングマッピング";
347+
"trackingMode" = "トラッキングモード";
348+
"trackingMappingSaveComingSoon" = "設定の保存機能は今後追加されます";
349+
"trackingInput__posX" = "位置 X";
350+
"trackingInput__posY" = "位置 Y";
351+
"trackingInput__posZ" = "位置 Z";
352+
"trackingInput__headX" = "頭の回転 X";
353+
"trackingInput__headY" = "頭の回転 Y";
354+
"trackingInput__headZ" = "頭の回転 Z";
355+
"trackingInput__eyeX" = "目の動き X";
356+
"trackingInput__eyeY" = "目の動き Y";
357+
"trackingInput__blinkL" = "まばたき 左";
358+
"trackingInput__blinkR" = "まばたき 右";
359+
"trackingInput__mouth" = "口";
360+
"trackingInput__vowel" = "母音";
361+
"editOutputBounds" = "出力範囲を編集";
362+
"editOutputBoundsMessage" = "出力範囲の最小値と最大値を設定します。";
363+
"minimum" = "最小値";
364+
"maximum" = "最大値";

0 commit comments

Comments
 (0)