[Bf-blender-cvs] [cb8423838f1] soc-2020-xr-input: First code to store and manage actions in Ghost-XR
Peter Klimenko
noreply at git.blender.org
Wed Jun 10 16:19:47 CEST 2020
Commit: cb8423838f11407a8f6ef696c06307990eea7fbc
Author: Peter Klimenko
Date: Wed Jun 10 06:14:15 2020 +1000
Branches: soc-2020-xr-input
https://developer.blender.org/rBcb8423838f11407a8f6ef696c06307990eea7fbc
First code to store and manage actions in Ghost-XR
===================================================================
M intern/ghost/intern/GHOST_XrSession.cpp
M intern/ghost/intern/GHOST_XrSession.h
M release/datafiles/locale
M release/scripts/addons
M source/tools
===================================================================
diff --git a/intern/ghost/intern/GHOST_XrSession.cpp b/intern/ghost/intern/GHOST_XrSession.cpp
index edc4960cf32..7129e9b950a 100644
--- a/intern/ghost/intern/GHOST_XrSession.cpp
+++ b/intern/ghost/intern/GHOST_XrSession.cpp
@@ -24,6 +24,7 @@
#include <cstdio>
#include <list>
#include <sstream>
+#include <string>
#include "GHOST_C-api.h"
@@ -46,8 +47,58 @@ struct OpenXRSessionData {
XrSpace view_space;
std::vector<XrView> views;
std::vector<GHOST_XrSwapchain> swapchains;
+
+ std::map<std::string, GHOST_XrActionSet> actionSetMap;
};
+GHOST_XrAction::GHOST_XrAction(XrAction action, XrActionType actionType)
+{
+ this->action = action;
+ this->actionType = actionType;
+}
+
+GHOST_XrActionSet::~GHOST_XrActionSet()
+{
+ xrDestroyActionSet(actionSet);
+}
+
+void GHOST_XrActionSet::createAction(XrActionCreateInfo *info)
+{
+ XrAction action;
+
+ CHECK_XR(xrCreateAction(actionSet, info, &action),
+ "Action set creation failed.");
+
+ this->actionMap.insert({ info->actionName, GHOST_XrAction(action, info->actionType) });
+}
+
+GHOST_XrActionSet::GHOST_XrActionSet(XrActionSet actionSet)
+{
+ this->actionSet = actionSet;
+}
+
+void GHOST_XrSession::createActionSet(char *name, char *localizedName)
+{
+ XrActionSetCreateInfo actionSetInfo = {XR_TYPE_ACTION_SET_CREATE_INFO};
+ actionSetInfo.priority = 0;
+ actionSetInfo.next = NULL;
+
+ strncpy(actionSetInfo.actionSetName, name, XR_MAX_ACTION_SET_NAME_SIZE);
+ strncpy(actionSetInfo.localizedActionSetName, localizedName,
+ XR_MAX_LOCALIZED_ACTION_SET_NAME_SIZE);
+
+ XrActionSet set;
+
+ CHECK_XR(xrCreateActionSet(m_context->getInstance(), &actionSetInfo, &set),
+ "Action set creation failed.");
+
+ m_oxr->actionSetMap.insert({ name, GHOST_XrActionSet(set) });
+}
+
+void GHOST_XrSession::updateActions() {
+
+}
+
struct GHOST_XrDrawInfo {
XrFrameState frame_state;
@@ -415,6 +466,9 @@ void GHOST_XrSession::drawView(GHOST_XrSwapchain &swapchain,
XrCompositionLayerProjection GHOST_XrSession::drawLayer(
std::vector<XrCompositionLayerProjectionView> &r_proj_layer_views, void *draw_customdata)
{
+ //TODO: Temporary controller state query, should go elsewhere
+ updateActions();
+
XrViewLocateInfo viewloc_info = {XR_TYPE_VIEW_LOCATE_INFO};
XrViewState view_state = {XR_TYPE_VIEW_STATE};
XrCompositionLayerProjection layer = {XR_TYPE_COMPOSITION_LAYER_PROJECTION};
diff --git a/intern/ghost/intern/GHOST_XrSession.h b/intern/ghost/intern/GHOST_XrSession.h
index da0128b2851..24feba89d54 100644
--- a/intern/ghost/intern/GHOST_XrSession.h
+++ b/intern/ghost/intern/GHOST_XrSession.h
@@ -31,6 +31,24 @@ class GHOST_XrSwapchain;
struct GHOST_XrDrawInfo;
struct OpenXRSessionData;
+class GHOST_XrAction {
+ public:
+ XrAction action;
+ XrActionType actionType;
+ GHOST_XrAction(XrAction action, XrActionType);
+};
+
+class GHOST_XrActionSet {
+ private:
+ XrActionSet actionSet;
+ std::map<std::string, GHOST_XrAction> actionMap;
+
+ public:
+ GHOST_XrActionSet(XrActionSet actionSet);
+ ~GHOST_XrActionSet();
+ void createAction(XrActionCreateInfo *info);
+};
+
class GHOST_XrSession {
public:
enum LifeExpectancy {
@@ -41,6 +59,9 @@ class GHOST_XrSession {
GHOST_XrSession(GHOST_XrContext *xr_context);
~GHOST_XrSession();
+ void createActionSet(char *name, char *localizedName);
+ void updateActions();
+
void start(const GHOST_XrSessionBeginInfo *begin_info);
void requestEnd();
diff --git a/release/datafiles/locale b/release/datafiles/locale
index 0fd21a7cc38..1cc27d5282a 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 0fd21a7cc382066d184fda8153f925bb825af2c6
+Subproject commit 1cc27d5282aa4978ee36663aca857eb550df194b
diff --git a/release/scripts/addons b/release/scripts/addons
index 9a9832d5d7f..5d33d1a1c25 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 9a9832d5d7fe61a446516f2e2722f8356bd7e709
+Subproject commit 5d33d1a1c2531e64bda78d46b517571f2b1e98e7
diff --git a/source/tools b/source/tools
index 8a36c2833db..5cf2fc3e5dc 160000
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit 8a36c2833db48ed78c436ee19534ce5cf3b2eeee
+Subproject commit 5cf2fc3e5dc28025394b57d8743401295528f310
More information about the Bf-blender-cvs
mailing list