Blender V5.3
view3d_placement.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_math_geom_c.hh"
#include "BLI_math_matrix_c.hh"
#include "BLI_math_rotation_c.hh"
#include "BKE_context.hh"
#include "BKE_lib_id.hh"
#include "BKE_modifier.hh"
#include "BKE_paint.hh"
#include "BKE_screen.hh"
#include "BLT_translation.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "WM_api.hh"
#include "WM_toolsystem.hh"
#include "ED_gizmo_utils.hh"
#include "ED_screen.hh"
#include "ED_space_api.hh"
#include "ED_view3d.hh"
#include "UI_resources.hh"
#include "GPU_immediate.hh"
#include "GPU_state.hh"
#include "view3d_intern.hh"

Go to the source code of this file.

Classes

struct  blender::InteractivePlaceData

Namespaces

namespace  blender
 BMesh Iterators.

Enumerations

Local Types
enum  blender::ePlace_PrimType {
  blender::PLACE_PRIMITIVE_TYPE_CUBE = 1 , blender::PLACE_PRIMITIVE_TYPE_CYLINDER = 2 , blender::PLACE_PRIMITIVE_TYPE_CONE = 3 , blender::PLACE_PRIMITIVE_TYPE_SPHERE_UV = 4 ,
  blender::PLACE_PRIMITIVE_TYPE_SPHERE_ICO = 5 , blender::PLACE_PRIMITIVE_TYPE_SPHERE_QUAD = 6
}
enum  blender::ePlace_Origin { blender::PLACE_ORIGIN_BASE = 1 , blender::PLACE_ORIGIN_CENTER = 2 }
enum  blender::ePlace_Aspect { blender::PLACE_ASPECT_FREE = 1 , blender::PLACE_ASPECT_FIXED = 2 }
enum  blender::StepIndex { blender::STEP_BASE = 0 , blender::STEP_DEPTH = 1 }

Functions

Internal Utilities
static bool blender::view3d_win_to_3d_on_plane_maybe_fallback (const ARegion *region, const float plane[4], const float mval[2], const float *plane_fallback, float r_out[3])
static int blender::dot_v3_array_find_max_index (const float dirs[][3], const int dirs_len, const float dir_test[3], bool is_signed)
static blender::UNUSED_FUNCTION_WITH_RETURN_TYPE (wmGizmoGroup *, idp_gizmogroup_from_region)(ARegion *region)
static bool blender::idp_snap_calc_incremental (Scene *scene, View3D *v3d, ARegion *region, const float co_relative[3], float co[3])
Primitive Drawing (Cube, Cone, Cylinder...)
static void blender::draw_line_loop (const float coords[][3], int coords_len, const float color[4])
static void blender::draw_line_pairs (const float coords_a[][3], float coords_b[][3], int coords_len, const float color[4])
static void blender::draw_line_bounds (const BoundBox *bounds, const float color[4])
static bool blender::calc_bbox (InteractivePlaceData *ipd, BoundBox *bounds)
static void blender::draw_circle_in_quad (const float v1[3], const float v2[3], const float v3[3], const float v4[3], const int resolution, const float color[4])
Drawing Callbacks
static void blender::draw_primitive_view_impl (const bContext *C, InteractivePlaceData *ipd, const float color[4], int flatten_axis)
static void blender::draw_primitive_view (const bContext *C, ARegion *, void *arg)
Calculate The Initial Placement Plane

Use by both the operator and placement cursor.

static bool blender::view3d_interactive_add_calc_snap (bContext *, const wmEvent *, float r_co_src[3], float r_matrix_orient[3][3], bool *r_is_enabled, bool *r_is_snap_invert)
Placement Gizmo Group

This is currently only used for snapping before the tool is initialized, we could show a placement plane here.

static void blender::preview_plane_free_fn (void *customdata)
static bool blender::snap_cursor_poll (ARegion *region, void *data)
static void blender::WIDGETGROUP_placement_setup (const bContext *, wmGizmoGroup *gzgroup)
static bool blender::WIDGETGROUP_placement_poll (const bContext *C, wmGizmoGroupType *gzgt)
void blender::VIEW3D_GGT_placement (wmGizmoGroupType *gzgt)

Variables

static const char * blender::view3d_gzgt_placement_id = "VIEW3D_GGT_placement"
static const float blender::eps_view_align = 1e-2f

Add Object Modal Operator

enum  {
  blender::PLACE_MODAL_SNAP_ON , blender::PLACE_MODAL_SNAP_OFF , blender::PLACE_MODAL_FIXED_ASPECT_ON , blender::PLACE_MODAL_FIXED_ASPECT_OFF ,
  blender::PLACE_MODAL_PIVOT_CENTER_ON , blender::PLACE_MODAL_PIVOT_CENTER_OFF
}
static void blender::view3d_interactive_add_begin (bContext *C, wmOperator *op, const wmEvent *event)
static void blender::view3d_interactive_add_status (wmOperator *op, bContext *C)
static wmOperatorStatus blender::view3d_interactive_add_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static void blender::view3d_interactive_add_exit (bContext *C, wmOperator *op)
static void blender::view3d_interactive_add_cancel (bContext *C, wmOperator *op)
void blender::viewplace_modal_keymap (wmKeyConfig *keyconf)
static wmOperatorStatus blender::view3d_interactive_add_modal (bContext *C, wmOperator *op, const wmEvent *event)
static bool blender::view3d_interactive_add_poll (bContext *C)
void blender::VIEW3D_OT_interactive_add (wmOperatorType *ot)

Detailed Description

Operator to interactively place data.

Currently only adds meshes, but could add other kinds of data including library assets & non-mesh types.

Definition in file view3d_placement.cc.