Skip to content

Commit e5d9513

Browse files
committed
Joint input actions draft impl
1 parent 015755d commit e5d9513

File tree

7 files changed

+482
-106
lines changed

7 files changed

+482
-106
lines changed

KinectHandler/KinectHandler.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@ namespace KinectHandler
9898
return trackedKinectJoints;
9999
}
100100

101+
property bool LeftHandClosed
102+
{
103+
bool get() { return kinect_->left_hand_state(); }
104+
}
105+
106+
property bool RightHandClosed
107+
{
108+
bool get() { return kinect_->right_hand_state(); }
109+
}
110+
101111
property bool IsInitialized
102112
{
103113
bool get() { return kinect_->is_initialized(); }

KinectHandler/KinectHandler.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
</ItemGroup>
9696
<ItemGroup>
9797
<PackageReference Include="Amethyst.Plugins.Contract">
98-
<Version>0.2.25</Version>
98+
<Version>0.3.32-alpha</Version>
9999
</PackageReference>
100100
<PackageReference Include="System.ComponentModel">
101101
<Version>4.3.0</Version>

KinectHandler/KinectWrapper.h

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class KinectWrapper
2626
JointOrientation boneOrientations[JointType_Count];
2727
IBody* kinectBodies[BODY_COUNT] = {nullptr};
2828

29+
HandState leftHandState = HandState_Unknown;
30+
HandState rightHandState = HandState_Unknown;
31+
2932
WAITABLE_HANDLE h_statusChangedEvent;
3033
WAITABLE_HANDLE h_multiFrameEvent;
3134

@@ -82,18 +85,25 @@ class KinectWrapper
8285

8386
// Copy joint positions & orientations
8487
std::copy(std::begin(joints), std::end(joints),
85-
skeleton_positions_.begin());
88+
skeleton_positions_.begin());
8689
std::copy(std::begin(boneOrientations), std::end(boneOrientations),
87-
bone_orientations_.begin());
90+
bone_orientations_.begin());
91+
92+
// Get hand states
93+
i->get_HandLeftState(&leftHandState);
94+
i->get_HandRightState(&rightHandState);
8895

89-
break;
96+
break; // Enough
9097
}
98+
9199
skeleton_tracked_ = false;
100+
leftHandState = HandState_Unknown;
101+
rightHandState = HandState_Unknown;
92102
}
93103

94104
// Don't process color if not requested
95105
if (!camera_enabled()) return;
96-
106+
97107
// Get the color frame and process it
98108
IColorFrameReference* colorFrameReference = nullptr;
99109
multiFrame->get_ColorFrameReference(&colorFrameReference);
@@ -451,6 +461,16 @@ class KinectWrapper
451461
return KinectJointTypeDictionary.at(static_cast<JointType>(kinectJointType));
452462
}
453463

464+
bool left_hand_state()
465+
{
466+
return kinectSensor && leftHandState == HandState_Closed;
467+
}
468+
469+
bool right_hand_state()
470+
{
471+
return kinectSensor && rightHandState == HandState_Closed;
472+
}
473+
454474
std::pair<int, int> CameraImageSize()
455475
{
456476
return std::make_pair(1920, 1080);
Lines changed: 158 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,161 @@
11
{
22
"language": "en",
3-
"messages": [
4-
{
5-
"id": "/Plugins/KinectOne/Statuses/Success",
6-
"translation": "Success!\nS_OK\nEverything's good!"
7-
},
8-
{
9-
"id": "/Plugins/KinectOne/Statuses/NotAvailable",
10-
"translation": "Sensor Unavailable!\nE_NOTAVAILABLE\nCheck if the Kinect is plugged in to your PC's USB and power plugs."
11-
},
12-
{
13-
"id": "/Plugins/KinectOne/Stages/Downloading/WiX",
14-
"translation": "Downloading WiX Toolset..."
15-
},
16-
{
17-
"id": "/Plugins/KinectOne/Stages/Exceptions/WiX/Extraction",
18-
"translation": "Toolset extraction failed! Exception: {0}"
19-
},
20-
{
21-
"id": "/Plugins/KinectOne/Stages/Exceptions/WiX/Installation",
22-
"translation": "Toolset installation failed! Exception: {0}"
23-
},
24-
{
25-
"id": "/Plugins/KinectOne/Stages/Downloading/Runtime",
26-
"translation": "Downloading Kinect for Xbox One Runtime..."
27-
},
28-
{
29-
"id": "/Plugins/KinectOne/Stages/Exceptions/Runtime/Installation",
30-
"translation": "Runtime installation failed! Exception: {0}"
31-
},
32-
{
33-
"id": "/Plugins/KinectOne/Stages/Unpacking",
34-
"translation": "Unpacking {0}..."
35-
},
36-
{
37-
"id": "/Plugins/KinectOne/Stages/Installing",
38-
"translation": "Installing {0}..."
39-
},
40-
{
41-
"id": "/Plugins/KinectOne/Stages/Exceptions/Other",
42-
"translation": "Exception: {0}"
43-
},
44-
{
45-
"id": "/Plugins/KinectOne/Stages/Dark/Error/Timeout",
46-
"translation": "Failed to execute dark.exe in the allocated time!"
47-
},
48-
{
49-
"id": "/Plugins/KinectOne/Stages/Dark/Error/Result",
50-
"translation": "Dark.exe exited with error code: {0}"
51-
},
52-
{
53-
"id": "/Plugins/KinectOne/Dependencies/Runtime/Name",
54-
"translation": "Kinect for Xbox One Runtime"
55-
}
56-
]
3+
"messages": [
4+
{
5+
"id": "/Plugins/KinectOne/Statuses/Success",
6+
"translation": "Success!\nS_OK\nEverything's good!"
7+
},
8+
{
9+
"id": "/Plugins/KinectOne/Statuses/NotAvailable",
10+
"translation": "Sensor Unavailable!\nE_NOTAVAILABLE\nCheck if the Kinect is plugged in to your PC's USB and power plugs."
11+
},
12+
{
13+
"id": "/Plugins/KinectOne/Stages/Downloading/WiX",
14+
"translation": "Downloading WiX Toolset..."
15+
},
16+
{
17+
"id": "/Plugins/KinectOne/Stages/Exceptions/WiX/Extraction",
18+
"translation": "Toolset extraction failed! Exception: {0}"
19+
},
20+
{
21+
"id": "/Plugins/KinectOne/Stages/Exceptions/WiX/Installation",
22+
"translation": "Toolset installation failed! Exception: {0}"
23+
},
24+
{
25+
"id": "/Plugins/KinectOne/Stages/Downloading/Runtime",
26+
"translation": "Downloading Kinect for Xbox One Runtime..."
27+
},
28+
{
29+
"id": "/Plugins/KinectOne/Stages/Exceptions/Runtime/Installation",
30+
"translation": "Runtime installation failed! Exception: {0}"
31+
},
32+
{
33+
"id": "/Plugins/KinectOne/Stages/Unpacking",
34+
"translation": "Unpacking {0}..."
35+
},
36+
{
37+
"id": "/Plugins/KinectOne/Stages/Installing",
38+
"translation": "Installing {0}..."
39+
},
40+
{
41+
"id": "/Plugins/KinectOne/Stages/Exceptions/Other",
42+
"translation": "Exception: {0}"
43+
},
44+
{
45+
"id": "/Plugins/KinectOne/Stages/Dark/Error/Timeout",
46+
"translation": "Failed to execute dark.exe in the allocated time!"
47+
},
48+
{
49+
"id": "/Plugins/KinectOne/Stages/Dark/Error/Result",
50+
"translation": "Dark.exe exited with error code: {0}"
51+
},
52+
{
53+
"id": "/Plugins/KinectOne/Dependencies/Runtime/Name",
54+
"translation": "Kinect for Xbox One Runtime"
55+
},
56+
{
57+
"id": "/JointsEnum/JointHead",
58+
"translation": "Head"
59+
},
60+
{
61+
"id": "/JointsEnum/JointNeck",
62+
"translation": "Neck"
63+
},
64+
{
65+
"id": "/JointsEnum/JointSpineShoulder",
66+
"translation": "Spine (Shoulders)"
67+
},
68+
{
69+
"id": "/JointsEnum/JointShoulderLeft",
70+
"translation": "Left Shoulder"
71+
},
72+
{
73+
"id": "/JointsEnum/JointElbowLeft",
74+
"translation": "Left Elbow"
75+
},
76+
{
77+
"id": "/JointsEnum/JointWristLeft",
78+
"translation": "Left Wrist"
79+
},
80+
{
81+
"id": "/JointsEnum/JointHandLeft",
82+
"translation": "Left Hand"
83+
},
84+
{
85+
"id": "/JointsEnum/JointHandTipLeft",
86+
"translation": "Left Hand Tip"
87+
},
88+
{
89+
"id": "/JointsEnum/JointThumbLeft",
90+
"translation": "Left Thumb"
91+
},
92+
{
93+
"id": "/JointsEnum/JointShoulderRight",
94+
"translation": "Right Shoulder"
95+
},
96+
{
97+
"id": "/JointsEnum/JointElbowRight",
98+
"translation": "Right Elbow"
99+
},
100+
{
101+
"id": "/JointsEnum/JointWristRight",
102+
"translation": "Right Wrist"
103+
},
104+
{
105+
"id": "/JointsEnum/JointHandRight",
106+
"translation": "Right Hand"
107+
},
108+
{
109+
"id": "/JointsEnum/JointHandTipRight",
110+
"translation": "Right Hand Tip"
111+
},
112+
{
113+
"id": "/JointsEnum/JointThumbRight",
114+
"translation": "Right Thumb"
115+
},
116+
{
117+
"id": "/JointsEnum/JointSpineMiddle",
118+
"translation": "Spine (Middle)"
119+
},
120+
{
121+
"id": "/JointsEnum/JointSpineWaist",
122+
"translation": "Waist"
123+
},
124+
{
125+
"id": "/JointsEnum/JointHipLeft",
126+
"translation": "Left Hip"
127+
},
128+
{
129+
"id": "/JointsEnum/JointKneeLeft",
130+
"translation": "Left Knee"
131+
},
132+
{
133+
"id": "/JointsEnum/JointFootLeft",
134+
"translation": "Left Foot"
135+
},
136+
{
137+
"id": "/JointsEnum/JointFootTipLeft",
138+
"translation": "Left Foot Tip"
139+
},
140+
{
141+
"id": "/JointsEnum/JointHipRight",
142+
"translation": "Right Hip"
143+
},
144+
{
145+
"id": "/JointsEnum/JointKneeRight",
146+
"translation": "Right Knee"
147+
},
148+
{
149+
"id": "/JointsEnum/JointFootRight",
150+
"translation": "Right Foot"
151+
},
152+
{
153+
"id": "/JointsEnum/JointFootTipRight",
154+
"translation": "Right Foot Tip"
155+
},
156+
{
157+
"id": "/JointsEnum/JointManual",
158+
"translation": "Manual"
159+
}
160+
]
57161
}

0 commit comments

Comments
 (0)