Blender  V3.3
Classes
editmesh_add_gizmo.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "BKE_scene.h"
#include "ED_gizmo_library.h"
#include "ED_gizmo_utils.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_undo.h"
#include "ED_view3d.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_resources.h"
#include "BLT_translation.h"
#include "mesh_intern.h"

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])
 
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 *UNUSED(event))
 
void MESH_OT_primitive_cube_add_gizmo (wmOperatorType *ot)
 

Placement Gizmo

typedef struct GizmoPlacementGroup GizmoPlacementGroup
 
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 *UNUSED(C), wmGizmoGroup *gzgroup)
 
static void MESH_GGT_add_bounds (struct wmGizmoGroupType *gzgt)
 

Detailed Description

Creation gizmos.

Definition in file editmesh_add_gizmo.c.

Typedef Documentation

◆ GizmoPlacementGroup

Function Documentation

◆ add_primitive_cube_gizmo_exec()

static int add_primitive_cube_gizmo_exec ( bContext C,
wmOperator op 
)
static

◆ add_primitive_cube_gizmo_invoke()

static int add_primitive_cube_gizmo_invoke ( bContext C,
wmOperator op,
const wmEvent UNUSEDevent 
)
static

◆ 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 51 of file editmesh_add_gizmo.c.

References axis_dominant_v3_single(), BKE_scene_cursor_to_mat4(), C, copy_m3_m3(), copy_v3_v3(), CTX_data_scene(), CTX_wm_region(), Scene::cursor, dot_v3v3(), ED_view3d_win_to_3d_on_plane(), is_negative_m3(), negate_v3(), plane_from_point_normal_v3(), ARegion::regiondata, scene, swap_v3_v3(), and RegionView3D::viewinv.

Referenced by gizmo_mesh_placement_modal_from_setup().

◆ gizmo_mesh_placement_draw_prepare()

static void gizmo_mesh_placement_draw_prepare ( const bContext UNUSEDC,
wmGizmoGroup gzgroup 
)
static

◆ gizmo_mesh_placement_modal_from_setup()

static void gizmo_mesh_placement_modal_from_setup ( const bContext C,
wmGizmoGroup gzgroup 
)
static

◆ gizmo_mesh_placement_poll()

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

Definition at line 176 of file editmesh_add_gizmo.c.

References C, and ED_gizmo_poll_or_unlink_delayed_from_operator().

Referenced by MESH_GGT_add_bounds().

◆ gizmo_mesh_placement_setup()

static void gizmo_mesh_placement_setup ( const bContext C,
wmGizmoGroup gzgroup 
)
static

◆ gizmo_mesh_placement_update_from_op()

static void gizmo_mesh_placement_update_from_op ( GizmoPlacementGroup ggd)
static

◆ 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 119 of file editmesh_add_gizmo.c.

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()

static void gizmo_placement_prop_matrix_get ( const wmGizmo gz,
wmGizmoProperty gz_prop,
void value_p 
)
static

◆ gizmo_placement_prop_matrix_set()

static void gizmo_placement_prop_matrix_set ( const wmGizmo gz,
wmGizmoProperty gz_prop,
const void value 
)
static

◆ MESH_GGT_add_bounds()

static void MESH_GGT_add_bounds ( struct wmGizmoGroupType gzgt)
static

◆ MESH_OT_primitive_cube_add_gizmo()

void MESH_OT_primitive_cube_add_gizmo ( wmOperatorType ot)