[Bf-blender-cvs] [4ec85983af6] xr-actions-D9124: XR: Remove controller overlay object

Peter Kim noreply at git.blender.org
Sun Nov 8 14:56:03 CET 2020


Commit: 4ec85983af6d914c3808c5a30f0c57d2fdd804f1
Author: Peter Kim
Date:   Sat Nov 7 21:08:17 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rB4ec85983af6d914c3808c5a30f0c57d2fdd804f1

XR: Remove controller overlay object

Object was originally meant to visualize the controller and be drawn
by the overlay engine, however it was unused since controllers are
now drawn via draw handlers. It might be added again in the future
for drawing more complex controller geometry.

===================================================================

M	source/blender/blenloader/intern/writefile.c
M	source/blender/draw/CMakeLists.txt
M	source/blender/draw/engines/overlay/overlay_engine.c
M	source/blender/draw/engines/overlay/overlay_private.h
D	source/blender/draw/engines/overlay/overlay_xr.c
M	source/blender/makesdna/DNA_object_types.h
M	source/blender/windowmanager/xr/intern/wm_xr_actions.c
M	source/blender/windowmanager/xr/intern/wm_xr_intern.h
M	source/blender/windowmanager/xr/intern/wm_xr_session.c

===================================================================

diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index c235d0a3823..7cce2950a0f 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1170,13 +1170,6 @@ static void write_shaderfxs(BlendWriter *writer, ListBase *fxbase)
 
 static void write_object(BlendWriter *writer, Object *ob, const void *id_address)
 {
-#if 1
-  /* Don't write XR objects. */
-  if (ob->runtime.is_xr) {
-    return;
-  }
-#endif
-
   const bool is_undo = BLO_write_is_undo(writer);
   if (ob->id.us > 0 || is_undo) {
     /* Clean up, important in undo case to reduce false detection of changed data-blocks. */
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index 232ea9c3eab..665cc11c5a0 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -152,7 +152,6 @@ set(SRC
   engines/overlay/overlay_shader.c
   engines/overlay/overlay_volume.c
   engines/overlay/overlay_wireframe.c
-  engines/overlay/overlay_xr.c
 
   DRW_engine.h
   DRW_engine_types.h
diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c
index 0343b1cb9f9..e49b2e45580 100644
--- a/source/blender/draw/engines/overlay/overlay_engine.c
+++ b/source/blender/draw/engines/overlay/overlay_engine.c
@@ -209,7 +209,6 @@ static void OVERLAY_cache_init(void *vedata)
   OVERLAY_particle_cache_init(vedata);
   OVERLAY_wireframe_cache_init(vedata);
   OVERLAY_volume_cache_init(vedata);
-  OVERLAY_xr_cache_init(vedata);
 }
 
 BLI_INLINE OVERLAY_DupliData *OVERLAY_duplidata_get(Object *ob, void *vedata, bool *do_init)
@@ -422,10 +421,6 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
     OVERLAY_motion_path_cache_populate(vedata, ob);
   }
 
-  if (ob->runtime.is_xr) {
-    OVERLAY_xr_cache_populate(vedata, ob);
-  }
-
   if (!pd->hide_overlays) {
     switch (ob->type) {
       case OB_ARMATURE:
@@ -651,8 +646,6 @@ static void OVERLAY_draw_scene(void *vedata)
       break;
   }
 
-  OVERLAY_xr_draw(vedata);
-
   OVERLAY_antialiasing_end(vedata);
 }
 
diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h
index 9734394b1fd..d5ba0a5423f 100644
--- a/source/blender/draw/engines/overlay/overlay_private.h
+++ b/source/blender/draw/engines/overlay/overlay_private.h
@@ -124,7 +124,6 @@ typedef struct OVERLAY_PassList {
   DRWPass *volume_ps;
   DRWPass *wireframe_ps;
   DRWPass *wireframe_xray_ps;
-  DRWPass *xr_controllers_ps;
   DRWPass *xray_fade_ps;
 } OVERLAY_PassList;
 
@@ -294,7 +293,6 @@ typedef struct OVERLAY_PrivateData {
   DRWShadingGroup *wires_all_grp[2][2];  /* With and without coloring. */
   DRWShadingGroup *wires_hair_grp[2][2]; /* With and without coloring. */
   DRWShadingGroup *wires_sculpt_grp[2];
-  DRWShadingGroup *xr_controllers_grp;
 
   DRWView *view_default;
   DRWView *view_wires;
@@ -641,10 +639,6 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
 void OVERLAY_wireframe_draw(OVERLAY_Data *vedata);
 void OVERLAY_wireframe_in_front_draw(OVERLAY_Data *vedata);
 
-void OVERLAY_xr_cache_init(OVERLAY_Data *vedata);
-void OVERLAY_xr_cache_populate(OVERLAY_Data *vedata, Object *ob);
-void OVERLAY_xr_draw(OVERLAY_Data *vedata);
-
 void OVERLAY_shader_library_ensure(void);
 GPUShader *OVERLAY_shader_antialiasing(void);
 GPUShader *OVERLAY_shader_armature_degrees_of_freedom_wire(void);
diff --git a/source/blender/draw/engines/overlay/overlay_xr.c b/source/blender/draw/engines/overlay/overlay_xr.c
deleted file mode 100644
index ba9c8c16646..00000000000
--- a/source/blender/draw/engines/overlay/overlay_xr.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.
- *
- * Copyright 2019, Blender Foundation.
- */
-
-/** \file
- * \ingroup draw_engine
- */
-
-#include "DRW_render.h"
-
-#include "GPU_batch.h"
-
-#include "overlay_private.h"
-
-void OVERLAY_xr_cache_init(OVERLAY_Data *vedata)
-{
-  OVERLAY_PassList *psl = vedata->psl;
-  OVERLAY_PrivateData *pd = vedata->stl->pd;
-  DRWShadingGroup *grp;
-  const float color[4] = {0.211f, 0.219f, 0.223f, 0.4f};
-
-  DRWState state = DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL |
-                   DRW_STATE_BLEND_ALPHA;
-  DRW_PASS_CREATE(psl->xr_controllers_ps, state | pd->clipping_state);
-
-  GPUShader *sh = OVERLAY_shader_uniform_color();
-  pd->xr_controllers_grp = grp = DRW_shgroup_create(sh, psl->xr_controllers_ps);
-  DRW_shgroup_uniform_vec4_copy(grp, "color", color);
-}
-
-void OVERLAY_xr_cache_populate(OVERLAY_Data *vedata, Object *ob)
-{
-  OVERLAY_PrivateData *pd = vedata->stl->pd;
-  GPUBatch *xr_controllers = DRW_cache_mesh_all_verts_get(ob);
-
-  if (xr_controllers && xr_controllers->verts[0] &&
-      (GPU_vertbuf_get_vertex_len(xr_controllers->verts[0]) > 0)) {
-    DRW_shgroup_call_obmat(pd->xr_controllers_grp, xr_controllers, ob->obmat);
-  }
-  else {
-    /* Fallback to primitive sphere. */
-    const float scale[3] = {0.05f, 0.05f, 0.05f};
-    float obmat[4][4];
-    copy_m4_m4(obmat, ob->obmat);
-    rescale_m4(obmat, scale);
-    DRW_shgroup_call_obmat(pd->xr_controllers_grp, DRW_cache_sphere_get(), obmat);
-  }
-}
-
-void OVERLAY_xr_draw(OVERLAY_Data *vedata)
-{
-  const DRWContextState *draw_ctx = DRW_context_state_get();
-  if ((draw_ctx->v3d->flag2 & V3D_XR_SHOW_CONTROLLERS) == 0) {
-    return;
-  }
-
-  OVERLAY_PassList *psl = vedata->psl;
-  DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
-
-  if (DRW_state_is_fbo()) {
-    GPU_framebuffer_bind(dfbl->overlay_fb);
-  }
-
-  DRW_draw_pass(psl->xr_controllers_ps);
-}
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 36811b34891..345d1287ab1 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -128,7 +128,7 @@ typedef struct Object_Runtime {
 
   /** Selection id of this object; only available in the original object */
   int select_id;
-  char _pad1[2];
+  char _pad1[3];
 
   /**
    * Denotes whether the evaluated data is owned by this object or is referenced and owned by
@@ -136,12 +136,6 @@ typedef struct Object_Runtime {
    */
   char is_data_eval_owned;
 
-  /**
-   * Denotes whether the object is tied to the lifetime of an XR session. This is used for
-   * drawing and also to prevent temporary XR objects from being saved in files.
-   */
-  char is_xr;
-
   /** Axis aligned boundbox (in localspace). */
   struct BoundBox *bb;
 
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_actions.c b/source/blender/windowmanager/xr/intern/wm_xr_actions.c
index f87badcf7b1..ed6b870b2c3 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_actions.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_actions.c
@@ -194,10 +194,7 @@ void WM_xr_action_set_destroy(wmXrData *xr, const char *action_set_name, bool re
 
   if (action_set == session_state->active_action_set) {
     if (action_set->controller_pose_action) {
-      wm_xr_session_controller_data_clear(
-          action_set->controller_pose_action->count_subaction_paths,
-          xr->runtime->bcontext,
-          &xr->runtime->session_state);
+      wm_xr_session_controller_data_clear(&xr->runtime->session_state);
       action_set->controller_pose_action = NULL;
     }
     session_state->active_action_set = NULL;
@@ -267,8 +264,6 @@ void WM_xr_actions_destroy(wmXrData *xr,
   /* Save name of controller pose action in case the action is removed from the GHash. */
   char controller_pose_name[64];
   strcpy(controller_pose_name, action_set->controller_pose_action->name);
-  const unsigned int controller_pose_count =
-      action_set->controller_pose_action->count_subaction_paths;
 
   GHash *actions = action_set->actions;
   for (unsigned int i = 0; i < count; ++i) {
@@ -277,8 +272,7 @@ void WM_xr_actions_destroy(wmXrData *xr,
 
   if (!action_find(action_set, controller_pose_name)) {
     if (action_set == xr->runtime->session_state.active_action_set) {
-      wm_xr_session_controller_data_clear(
-          controller_pose_count, xr->runtime->bcontext, &xr->runtime->session_state);
+      wm_xr_session_controller_data_clear(&xr->runtime->session_state);
     }
     action_set->controller_pose_action = NULL;
   }
@@ -327,8 +321,8 @@ bool WM_xr_active_action_set_set(wmXrData *xr, const char *action_set_name)
   xr->runtime->session_state.active_action_set = action_set;
 
   if (action_set->controller_pose_action) {
-    wm_xr_session_controller_data_populate(
-        action_set->controller_pose_action, xr->runtime->bcontext, &xr->runtime->session_state);
+    wm_xr_session_controller_data_populate(action_set->controller_pose_action,
+                                           &xr->runtime->session_state);
   }
 
   return true;
@@ -351,8 +345,7 @@ bool WM_xr_controller_pose_action_set(wmXrData *xr,
   action_set->controller_pose_action = action;
 
   if (action_set == xr->runtime->session_state.active_action_set) {
-    wm_xr_session_controller_data_populate(
-        action, xr->runtime->bcontext, &xr->runtime->session_state);
+    wm_xr_session_controller_data_populate(action, &xr->runtime->session_state);
   }
 
   return true;
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_intern.h b/source/blender/windowmanager/xr/intern/wm_xr_intern.h
index 4a3a29b1a0a..b1fc581a4fd 100644
--- a/source/blender/windowmanager/xr/intern/w

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list