[Bf-blender-cvs] [2ef120ace0e] asset-browser-snap-dragging: Fix merge error after last merge

Julian Eisel noreply at git.blender.org
Sun Jun 13 22:10:55 CEST 2021


Commit: 2ef120ace0eb60ce29f07998dc7f12211aba6aef
Author: Julian Eisel
Date:   Sun Jun 13 22:03:43 2021 +0200
Branches: asset-browser-snap-dragging
https://developer.blender.org/rB2ef120ace0eb60ce29f07998dc7f12211aba6aef

Fix merge error after last merge

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

M	source/blender/editors/space_view3d/view3d_placement.c

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

diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c
index 0e91888c2ab..3fcddd3a1f7 100644
--- a/source/blender/editors/space_view3d/view3d_placement.c
+++ b/source/blender/editors/space_view3d/view3d_placement.c
@@ -1851,6 +1851,44 @@ static void WIDGETGROUP_placement_setup(const bContext *UNUSED(C), wmGizmoGroup
     gizmo->flag |= WM_GIZMO_HIDDEN_KEYMAP;
   }
 
+  {
+    const wmGizmoType *gzt_plane = WM_gizmotype_find("GIZMO_GT_placement_plane_3d", true);
+    gizmo = WM_gizmo_new_ptr(gzt_plane, gzgroup, NULL);
+
+    WM_gizmo_set_color(gizmo, (float[4]){1.0f, 1.0f, 1.0f, 1.0f});
+
+    /* Don't handle any events, this is for display only. */
+    gizmo->flag |= WM_GIZMO_HIDDEN_KEYMAP;
+  }
+}
+
+static void WIDGETGROUP_placement_draw_prepare(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
+{
+  /* TODO only set for drag & drop. */
+  if (!gzgroup->ptr) {
+    return;
+  }
+
+  wmGizmo *gizmo_plane = ((wmGizmo *)gzgroup->gizmos.first)->next;
+
+  PropertyRNA *boundbox_prop = RNA_struct_find_property(gzgroup->ptr, "bound_box");
+  if (boundbox_prop && RNA_property_is_set(gzgroup->ptr, boundbox_prop)) {
+    float array[8][3];
+    RNA_property_float_get_array(gzgroup->ptr, boundbox_prop, (float *)array);
+    RNA_float_set_array(gizmo_plane->ptr, "bound_box", (float *)array);
+  }
+
+  PropertyRNA *matrix_basis_prop = RNA_struct_find_property(gzgroup->ptr, "matrix_basis");
+  if (matrix_basis_prop && RNA_property_is_set(gzgroup->ptr, matrix_basis_prop)) {
+    float array[4][4];
+    RNA_property_float_get_array(gzgroup->ptr, matrix_basis_prop, (float *)array);
+    RNA_float_set_array(gizmo_plane->ptr, "matrix_basis", (float *)array);
+  }
+}
+
+static bool WIDGETGROUP_placement_poll(const bContext *C, wmGizmoGroupType *gzgt)
+{
+  return ED_gizmo_poll_from_dropbox(C, gzgt) || ED_gizmo_poll_from_tool(C, gzgt);
 }
 
 void VIEW3D_GGT_placement(wmGizmoGroupType *gzgt)



More information about the Bf-blender-cvs mailing list