This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/blenkernel/BKE_callbacks.h
Peter Kim cb12fb78ca XR Controller Support Step 1: Internal Abstractions for OpenXR Actions
Adds internal API for creating and managing OpenXR actions at the
GHOST and WM layers. Does not bring about any changes for users since
XR action functionality is not yet exposed in the Python API (will be
added in a subsequent patch).

OpenXR actions are a means to communicate with XR input devices and
can be used to retrieve button/pose states or apply haptic feedback.
Actions are bound to device inputs via a semantic path binding
(https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#semantic-path-interaction-profiles),
which serves as an XR version of keymaps.

Main features:

- Abstraction of OpenXR action management functions to GHOST-XR,
  WM-XR APIs.
- New "xr_session_start_pre" callback for creating actions at
  appropriate point in the XR session.
- Creation of name-identifiable action sets/actions.
- Binding of actions to controller inputs.
- Acquisition of controller button states.
- Acquisition of controller poses.
- Application of controller haptic feedback.
- Carefully designed error handling and useful error reporting
  (e.g. action set/action name included in error message).

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D10942
2021-05-16 03:36:31 +09:00

91 lines
2.7 KiB
C++

/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/** \file
* \ingroup bke
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
struct Depsgraph;
struct ID;
struct Main;
struct PointerRNA;
/**
* Common suffix uses:
* - ``_PRE/_POST``:
* For handling discrete non-interactive events.
* - ``_INIT/_COMPLETE/_CANCEL``:
* For handling jobs (which may in turn cause other handlers to be called).
*/
typedef enum {
BKE_CB_EVT_FRAME_CHANGE_PRE,
BKE_CB_EVT_FRAME_CHANGE_POST,
BKE_CB_EVT_RENDER_PRE,
BKE_CB_EVT_RENDER_POST,
BKE_CB_EVT_RENDER_WRITE,
BKE_CB_EVT_RENDER_STATS,
BKE_CB_EVT_RENDER_INIT,
BKE_CB_EVT_RENDER_COMPLETE,
BKE_CB_EVT_RENDER_CANCEL,
BKE_CB_EVT_LOAD_PRE,
BKE_CB_EVT_LOAD_POST,
BKE_CB_EVT_SAVE_PRE,
BKE_CB_EVT_SAVE_POST,
BKE_CB_EVT_UNDO_PRE,
BKE_CB_EVT_UNDO_POST,
BKE_CB_EVT_REDO_PRE,
BKE_CB_EVT_REDO_POST,
BKE_CB_EVT_DEPSGRAPH_UPDATE_PRE,
BKE_CB_EVT_DEPSGRAPH_UPDATE_POST,
BKE_CB_EVT_VERSION_UPDATE,
BKE_CB_EVT_LOAD_FACTORY_USERDEF_POST,
BKE_CB_EVT_LOAD_FACTORY_STARTUP_POST,
BKE_CB_EVT_XR_SESSION_START_PRE,
BKE_CB_EVT_TOT,
} eCbEvent;
typedef struct bCallbackFuncStore {
struct bCallbackFuncStore *next, *prev;
void (*func)(struct Main *, struct PointerRNA **, const int num_pointers, void *arg);
void *arg;
short alloc;
} bCallbackFuncStore;
void BKE_callback_exec(struct Main *bmain,
struct PointerRNA **pointers,
const int num_pointers,
eCbEvent evt);
void BKE_callback_exec_null(struct Main *bmain, eCbEvent evt);
void BKE_callback_exec_id(struct Main *bmain, struct ID *id, eCbEvent evt);
void BKE_callback_exec_id_depsgraph(struct Main *bmain,
struct ID *id,
struct Depsgraph *depsgraph,
eCbEvent evt);
void BKE_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt);
void BKE_callback_global_init(void);
void BKE_callback_global_finalize(void);
#ifdef __cplusplus
}
#endif