Blender V4.3
editmesh_add_gizmo.cc File Reference
#include "MEM_guardedalloc.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_context.hh"
#include "BKE_editmesh.hh"
#include "BKE_object_types.hh"
#include "BKE_scene.hh"
#include "BLI_math_geom.h"
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"
#include "ED_gizmo_library.hh"
#include "ED_gizmo_utils.hh"
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_screen.hh"
#include "ED_undo.hh"
#include "ED_view3d.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "UI_resources.hh"
#include "mesh_intern.hh"

Go to the source code of this file.

Classes

struct  GizmoPlacementGroup
 

Functions

Helper Functions
static void calc_initial_placement_point_from_view (bContext *C, const float mval[2], float r_location[3], float r_rotation[3][3])
 
Placement Gizmo
static void gizmo_placement_exec (GizmoPlacementGroup *ggd)
 
static void gizmo_mesh_placement_update_from_op (GizmoPlacementGroup *ggd)
 
static void gizmo_placement_prop_matrix_get (const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
 
static void gizmo_placement_prop_matrix_set (const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value)
 
static bool gizmo_mesh_placement_poll (const bContext *C, wmGizmoGroupType *gzgt)
 
static void gizmo_mesh_placement_modal_from_setup (const bContext *C, wmGizmoGroup *gzgroup)
 
static void gizmo_mesh_placement_setup (const bContext *C, wmGizmoGroup *gzgroup)
 
static void gizmo_mesh_placement_draw_prepare (const bContext *, wmGizmoGroup *gzgroup)
 
static void MESH_GGT_add_bounds (wmGizmoGroupType *gzgt)
 
Add Cube Gizmo-Operator

For now we use a separate operator to add a cube, we can try to merge then however they are invoked differently and share the same BMesh creation code.

static int add_primitive_cube_gizmo_exec (bContext *C, wmOperator *op)
 
static int add_primitive_cube_gizmo_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void MESH_OT_primitive_cube_add_gizmo (wmOperatorType *ot)
 

Detailed Description

Creation gizmos.

Definition in file editmesh_add_gizmo.cc.

Function Documentation

◆ add_primitive_cube_gizmo_exec()

◆ add_primitive_cube_gizmo_invoke()

◆ calc_initial_placement_point_from_view()

static void calc_initial_placement_point_from_view ( bContext * C,
const float mval[2],
float r_location[3],
float r_rotation[3][3] )
static

When we place a shape, pick a plane.

We may base this choice on context, for now pick the "ground" based on the 3D cursor's dominant plane pointing down relative to the view.

Definition at line 54 of file editmesh_add_gizmo.cc.

References axis_dominant_v3_single(), copy_m3_m3(), copy_v3_v3(), CTX_data_scene(), CTX_wm_region(), dot_v3v3(), ED_view3d_win_to_3d_on_plane(), is_negative_m3(), negate_v3(), plane_from_point_normal_v3(), swap_v3_v3(), and RegionView3D::viewinv.

Referenced by gizmo_mesh_placement_modal_from_setup().

◆ gizmo_mesh_placement_draw_prepare()

◆ gizmo_mesh_placement_modal_from_setup()

◆ gizmo_mesh_placement_poll()

static bool gizmo_mesh_placement_poll ( const bContext * C,
wmGizmoGroupType * gzgt )
static

◆ gizmo_mesh_placement_setup()

◆ gizmo_mesh_placement_update_from_op()

◆ gizmo_placement_exec()

static void gizmo_placement_exec ( GizmoPlacementGroup * ggd)
static
Warning
Calling redo from property updates is not great. This is needed because changing the RNA doesn't cause a redo and we're not using operator UI which does just this.

Definition at line 121 of file editmesh_add_gizmo.cc.

References GizmoPlacementGroup::context, GizmoPlacementGroup::data, ED_undo_operator_repeat(), GizmoPlacementGroup::op, and WM_operator_last_redo().

Referenced by gizmo_placement_prop_matrix_set().

◆ gizmo_placement_prop_matrix_get()

◆ gizmo_placement_prop_matrix_set()

◆ MESH_GGT_add_bounds()

◆ MESH_OT_primitive_cube_add_gizmo()