Skip to content

Commit

Permalink
Joint input actions draft impl
Browse files Browse the repository at this point in the history
  • Loading branch information
KimihikoAkayasaki committed Nov 1, 2024
1 parent 015755d commit e5d9513
Show file tree
Hide file tree
Showing 7 changed files with 482 additions and 106 deletions.
10 changes: 10 additions & 0 deletions KinectHandler/KinectHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ namespace KinectHandler
return trackedKinectJoints;
}

property bool LeftHandClosed
{
bool get() { return kinect_->left_hand_state(); }
}

property bool RightHandClosed
{
bool get() { return kinect_->right_hand_state(); }
}

property bool IsInitialized
{
bool get() { return kinect_->is_initialized(); }
Expand Down
2 changes: 1 addition & 1 deletion KinectHandler/KinectHandler.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Amethyst.Plugins.Contract">
<Version>0.2.25</Version>
<Version>0.3.32-alpha</Version>
</PackageReference>
<PackageReference Include="System.ComponentModel">
<Version>4.3.0</Version>
Expand Down
28 changes: 24 additions & 4 deletions KinectHandler/KinectWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class KinectWrapper
JointOrientation boneOrientations[JointType_Count];
IBody* kinectBodies[BODY_COUNT] = {nullptr};

HandState leftHandState = HandState_Unknown;
HandState rightHandState = HandState_Unknown;

WAITABLE_HANDLE h_statusChangedEvent;
WAITABLE_HANDLE h_multiFrameEvent;

Expand Down Expand Up @@ -82,18 +85,25 @@ class KinectWrapper

// Copy joint positions & orientations
std::copy(std::begin(joints), std::end(joints),
skeleton_positions_.begin());
skeleton_positions_.begin());
std::copy(std::begin(boneOrientations), std::end(boneOrientations),
bone_orientations_.begin());
bone_orientations_.begin());

// Get hand states
i->get_HandLeftState(&leftHandState);
i->get_HandRightState(&rightHandState);

break;
break; // Enough
}

skeleton_tracked_ = false;
leftHandState = HandState_Unknown;
rightHandState = HandState_Unknown;
}

// Don't process color if not requested
if (!camera_enabled()) return;

// Get the color frame and process it
IColorFrameReference* colorFrameReference = nullptr;
multiFrame->get_ColorFrameReference(&colorFrameReference);
Expand Down Expand Up @@ -451,6 +461,16 @@ class KinectWrapper
return KinectJointTypeDictionary.at(static_cast<JointType>(kinectJointType));
}

bool left_hand_state()
{
return kinectSensor && leftHandState == HandState_Closed;
}

bool right_hand_state()
{
return kinectSensor && rightHandState == HandState_Closed;
}

std::pair<int, int> CameraImageSize()
{
return std::make_pair(1920, 1080);
Expand Down
212 changes: 158 additions & 54 deletions plugin_KinectOne/Assets/Strings/en.json
Original file line number Diff line number Diff line change
@@ -1,57 +1,161 @@
{
"language": "en",
"messages": [
{
"id": "/Plugins/KinectOne/Statuses/Success",
"translation": "Success!\nS_OK\nEverything's good!"
},
{
"id": "/Plugins/KinectOne/Statuses/NotAvailable",
"translation": "Sensor Unavailable!\nE_NOTAVAILABLE\nCheck if the Kinect is plugged in to your PC's USB and power plugs."
},
{
"id": "/Plugins/KinectOne/Stages/Downloading/WiX",
"translation": "Downloading WiX Toolset..."
},
{
"id": "/Plugins/KinectOne/Stages/Exceptions/WiX/Extraction",
"translation": "Toolset extraction failed! Exception: {0}"
},
{
"id": "/Plugins/KinectOne/Stages/Exceptions/WiX/Installation",
"translation": "Toolset installation failed! Exception: {0}"
},
{
"id": "/Plugins/KinectOne/Stages/Downloading/Runtime",
"translation": "Downloading Kinect for Xbox One Runtime..."
},
{
"id": "/Plugins/KinectOne/Stages/Exceptions/Runtime/Installation",
"translation": "Runtime installation failed! Exception: {0}"
},
{
"id": "/Plugins/KinectOne/Stages/Unpacking",
"translation": "Unpacking {0}..."
},
{
"id": "/Plugins/KinectOne/Stages/Installing",
"translation": "Installing {0}..."
},
{
"id": "/Plugins/KinectOne/Stages/Exceptions/Other",
"translation": "Exception: {0}"
},
{
"id": "/Plugins/KinectOne/Stages/Dark/Error/Timeout",
"translation": "Failed to execute dark.exe in the allocated time!"
},
{
"id": "/Plugins/KinectOne/Stages/Dark/Error/Result",
"translation": "Dark.exe exited with error code: {0}"
},
{
"id": "/Plugins/KinectOne/Dependencies/Runtime/Name",
"translation": "Kinect for Xbox One Runtime"
}
]
"messages": [
{
"id": "/Plugins/KinectOne/Statuses/Success",
"translation": "Success!\nS_OK\nEverything's good!"
},
{
"id": "/Plugins/KinectOne/Statuses/NotAvailable",
"translation": "Sensor Unavailable!\nE_NOTAVAILABLE\nCheck if the Kinect is plugged in to your PC's USB and power plugs."
},
{
"id": "/Plugins/KinectOne/Stages/Downloading/WiX",
"translation": "Downloading WiX Toolset..."
},
{
"id": "/Plugins/KinectOne/Stages/Exceptions/WiX/Extraction",
"translation": "Toolset extraction failed! Exception: {0}"
},
{
"id": "/Plugins/KinectOne/Stages/Exceptions/WiX/Installation",
"translation": "Toolset installation failed! Exception: {0}"
},
{
"id": "/Plugins/KinectOne/Stages/Downloading/Runtime",
"translation": "Downloading Kinect for Xbox One Runtime..."
},
{
"id": "/Plugins/KinectOne/Stages/Exceptions/Runtime/Installation",
"translation": "Runtime installation failed! Exception: {0}"
},
{
"id": "/Plugins/KinectOne/Stages/Unpacking",
"translation": "Unpacking {0}..."
},
{
"id": "/Plugins/KinectOne/Stages/Installing",
"translation": "Installing {0}..."
},
{
"id": "/Plugins/KinectOne/Stages/Exceptions/Other",
"translation": "Exception: {0}"
},
{
"id": "/Plugins/KinectOne/Stages/Dark/Error/Timeout",
"translation": "Failed to execute dark.exe in the allocated time!"
},
{
"id": "/Plugins/KinectOne/Stages/Dark/Error/Result",
"translation": "Dark.exe exited with error code: {0}"
},
{
"id": "/Plugins/KinectOne/Dependencies/Runtime/Name",
"translation": "Kinect for Xbox One Runtime"
},
{
"id": "/JointsEnum/JointHead",
"translation": "Head"
},
{
"id": "/JointsEnum/JointNeck",
"translation": "Neck"
},
{
"id": "/JointsEnum/JointSpineShoulder",
"translation": "Spine (Shoulders)"
},
{
"id": "/JointsEnum/JointShoulderLeft",
"translation": "Left Shoulder"
},
{
"id": "/JointsEnum/JointElbowLeft",
"translation": "Left Elbow"
},
{
"id": "/JointsEnum/JointWristLeft",
"translation": "Left Wrist"
},
{
"id": "/JointsEnum/JointHandLeft",
"translation": "Left Hand"
},
{
"id": "/JointsEnum/JointHandTipLeft",
"translation": "Left Hand Tip"
},
{
"id": "/JointsEnum/JointThumbLeft",
"translation": "Left Thumb"
},
{
"id": "/JointsEnum/JointShoulderRight",
"translation": "Right Shoulder"
},
{
"id": "/JointsEnum/JointElbowRight",
"translation": "Right Elbow"
},
{
"id": "/JointsEnum/JointWristRight",
"translation": "Right Wrist"
},
{
"id": "/JointsEnum/JointHandRight",
"translation": "Right Hand"
},
{
"id": "/JointsEnum/JointHandTipRight",
"translation": "Right Hand Tip"
},
{
"id": "/JointsEnum/JointThumbRight",
"translation": "Right Thumb"
},
{
"id": "/JointsEnum/JointSpineMiddle",
"translation": "Spine (Middle)"
},
{
"id": "/JointsEnum/JointSpineWaist",
"translation": "Waist"
},
{
"id": "/JointsEnum/JointHipLeft",
"translation": "Left Hip"
},
{
"id": "/JointsEnum/JointKneeLeft",
"translation": "Left Knee"
},
{
"id": "/JointsEnum/JointFootLeft",
"translation": "Left Foot"
},
{
"id": "/JointsEnum/JointFootTipLeft",
"translation": "Left Foot Tip"
},
{
"id": "/JointsEnum/JointHipRight",
"translation": "Right Hip"
},
{
"id": "/JointsEnum/JointKneeRight",
"translation": "Right Knee"
},
{
"id": "/JointsEnum/JointFootRight",
"translation": "Right Foot"
},
{
"id": "/JointsEnum/JointFootTipRight",
"translation": "Right Foot Tip"
},
{
"id": "/JointsEnum/JointManual",
"translation": "Manual"
}
]
}
Loading

0 comments on commit e5d9513

Please sign in to comment.