116 name =
DATA_(
"Custom View");
126 const bool overwrite)
132 if (base ==
nullptr) {
152 const bool overwrite)
155 float normal[3], plane[3];
165 name =
DATA_(
"Bone");
174 const bool overwrite)
177 float normal[3], plane[3];
187 name =
DATA_(
"Curve");
196 const bool overwrite)
199 float normal[3], plane[3];
212 name =
DATA_(
"Vertex");
222 name =
DATA_(
"Edge");
232 name =
DATA_(
"Face");
258 cross_vec[0] = axis[1];
259 cross_vec[1] = axis[2];
260 cross_vec[2] = axis[0];
281 float mat[3][3], tmat[3][3], obmat[3][3];
296 float parent_mat[3][3];
304 copy_m3_m4(obmat, ob->object_to_world().ptr());
309 copy_m3_m4(obmat, ob->object_to_world().ptr());
330 float parent_mat[3][3];
343 bool is_zero[3] = {
true,
true,
true};
356 if (zero_axis == 0) {
360 if (zero_axis == 1) {
362 cross_v3_v3v3(mat[axis], mat[(axis + 1) % 3], mat[(axis + 2) % 3]);
367 else if (zero_axis == 2) {
388 float tangent[3] = {0.0f, 0.0f, 1.0f};
398 tangent[1] = tangent[2] = 0.0f;
450 const float normal[3],
451 const float tangent[3])
470 const bool overwrite)
502 return (ts !=
nullptr);
508 const bool overwrite)
513 char name_unique[
sizeof(ts->
name)];
618 scene, view_layer, v3d, rv3d, ob, obedit, orient_index, pivot_point, r_mat);
626 if (active_pchan && active_pchan->
parent) {
629 float ob_orientations_mat[3][3];
631 UNPACK3(ob->object_to_world().ptr()));
658 const short orientation_index,
659 const int pivot_point,
662 switch (orientation_index) {
723 if (rv3d !=
nullptr) {
745 scene, orientation_index_custom);
751 return orientation_index;
757 const float custom[3][3],
758 float r_spacemtx[3][3])
796 scene, t->
view_layer, v3d, rv3d, ob, obedit, orient_index, t->
around, r_spacemtx);
809 return r_orient_index;
814 switch (orient_type) {
816 return RPT_(
"global");
818 return RPT_(
"gimbal");
820 return RPT_(
"normal");
822 return RPT_(
"local");
826 return RPT_(
"cursor");
828 return RPT_(
"parent");
830 return RPT_(
"custom");
842 const short orientation = t->
orient[orient_index].
type;
872 if (ese->htype != htype) {
877 elems[
i++] = ese->ele;
943 float imat[3][3], mat[3][3];
946 copy_m3_m4(imat, ob->object_to_world().ptr());
979 float normal[3] = {0.0f};
980 float plane_pair[2][3] = {{0.0f}};
985 float tangent_pair[2][3];
988 add_v3_v3(plane_pair[0], tangent_pair[0]);
989 add_v3_v3(plane_pair[1], tangent_pair[1]);
997 if (face_count == 1) {
1003 float normal_unit[3];
1004 float plane_unit_pair[2][3], plane_ortho_pair[2][3];
1010 cross_v3_v3v3(plane_ortho_pair[0], normal_unit, plane_unit_pair[0]);
1011 cross_v3_v3v3(plane_ortho_pair[1], normal_unit, plane_unit_pair[1]);
1020 add_v3_v3(r_plane, plane_pair[plane_index]);
1031 normal_tri_v3(r_normal, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co);
1034 no_test[0] = v_tri[0]->
no[0] + v_tri[1]->
no[0] + v_tri[2]->
no[0];
1035 no_test[1] = v_tri[0]->
no[1] + v_tri[1]->
no[1] + v_tri[2]->
no[1];
1036 no_test[2] = v_tri[0]->
no[2] + v_tri[1]->
no[2] + v_tri[2]->
no[2];
1037 if (
dot_v3v3(no_test, r_normal) < 0.0f) {
1046 for (j = 0; j < 3; j++) {
1050 if ((
e ==
nullptr) || (e_length < e_test_length)) {
1052 e_length = e_test_length;
1067 sub_v3_v3v3(r_plane, v_pair[0]->co, v_pair[1]->co);
1080 BMVert *v_pair[2] = {
nullptr,
nullptr};
1085 v_pair[0] = eed->
v1;
1086 v_pair[1] = eed->
v2;
1095 if (
LIKELY(v_pair[0] && v_pair[1])) {
1096 bool v_pair_swap =
false;
1114 if (eed->
l->
v != v_pair[0]) {
1120 std::swap(v_pair[0], v_pair[1]);
1123 add_v3_v3v3(r_normal, v_pair[1]->no, v_pair[0]->no);
1124 sub_v3_v3v3(r_plane, v_pair[1]->co, v_pair[0]->co);
1148 bool v_pair_swap =
false;
1153 float dir_pair[2][3];
1156 if (e_pair[0]->
l->v !=
v) {
1169 std::swap(v_pair[0], v_pair[1]);
1209 void *vert_act =
nullptr;
1225 for (nu =
static_cast<Nurb *
>(nurbs->
first); nu; nu = nu->
next) {
1233#define SEL_F1 (1 << 0)
1234#define SEL_F2 (1 << 1)
1235#define SEL_F3 (1 << 2)
1286 else if (nu->
bp && (nu->
pntsv == 1)) {
1296 const bool is_prev_sel = bp_prev && (bp_prev->
f1 &
SELECT);
1297 const bool is_next_sel = bp_next && (bp_next->
f1 &
SELECT);
1298 if (is_prev_sel ==
false && is_next_sel ==
false) {
1303 else if (is_next_sel) {
1329 if (activeOnly && (ml = mb->
lastelem)) {
1358 if (activeOnly && (ebone = arm->
act_edbone)) {
1366 bool fallback_ok =
false;
1367 float fallback_normal[3];
1368 float fallback_plane[3];
1392 if ((ok ==
false) && fallback_ok) {
1427 float imat[3][3], mat[3][3];
1436 int transformed_len;
1438 if (transformed_len) {
1453 copy_m3_m4(imat, ob->object_to_world().ptr());
1465 if (ob !=
nullptr) {
1485 copy_v3_v3(r_normal, ob->object_to_world().ptr()[2]);
1486 copy_v3_v3(r_plane, ob->object_to_world().ptr()[1]);
1511 scene, view_layer, v3d, obact, obedit, around, r_normal, r_plane);
1520 float r_orientation_mat[3][3])
1522 float normal[3] = {0.0, 0.0, 0.0};
1523 float plane[3] = {0.0, 0.0, 0.0};
Functions to deal with Armatures.
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
bool ANIM_bone_in_visible_collection(const bArmature *armature, const Bone *bone)
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_active(Object *ob, bool check_bonecoll)
bPoseChannel * BKE_pose_channel_active_if_bonecoll_visible(Object *ob) ATTR_WARN_UNUSED_RESULT
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_edit_object(const bContext *C)
Base * CTX_data_active_base(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void BKE_nurb_bpoint_calc_plane(Nurb *nu, BPoint *bp, float r_plane[3])
ListBase * BKE_curve_editNurbs_get(Curve *cu)
void BKE_nurb_bezt_calc_normal(Nurb *nu, BezTriple *bezt, float r_normal[3])
bool BKE_curve_nurb_vert_active_get(Curve *cu, Nurb **r_nu, void **r_vert)
BPoint * BKE_nurb_bpoint_get_prev(Nurb *nu, BPoint *bp)
BPoint * BKE_nurb_bpoint_get_next(Nurb *nu, BPoint *bp)
void BKE_nurb_bpoint_calc_normal(Nurb *nu, BPoint *bp, float r_normal[3])
void BKE_nurb_bezt_calc_plane(Nurb *nu, BezTriple *bezt, float r_plane[3])
BMEditMesh * BKE_editmesh_from_object(Object *ob)
Return the BMEditMesh for a given object.
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
void void BKE_reports_prepend(ReportList *reports, const char *prepend)
int BKE_scene_transform_orientation_get_index(const Scene *scene, const TransformOrientation *orientation)
void BKE_scene_transform_orientation_remove(Scene *scene, TransformOrientation *orientation)
TransformOrientation * BKE_scene_transform_orientation_find(const Scene *scene, int index)
int BKE_scene_orientation_get_index(Scene *scene, int slot_index)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int min_ii(int a, int b)
#define BLI_ASSERT_UNIT_V3(v)
void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
Normal to x,y matrix.
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void mul_m3_v3(const float M[3][3], float r[3])
void mul_m3_m3_pre(float R[3][3], const float A[3][3])
void copy_m3_m3(float m1[3][3], const float m2[3][3])
void unit_m3(float m[3][3])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
void zero_m3(float m[3][3])
void normalize_m3(float R[3][3]) ATTR_NONNULL()
void invert_m3_m3_safe_ortho(float inverse[3][3], const float mat[3][3])
void transpose_m3(float R[3][3])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
bool invert_m3(float mat[3][3])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
void mul_m3_m4m3(float R[3][3], const float A[4][4], const float B[3][3])
void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], short order)
void axis_angle_to_mat3_single(float R[3][3], char axis, float angle)
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void quat_to_mat3(float m[3][3], const float q[4])
void mul_qt_v3(const float q[4], float r[3])
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
void project_plane_normalized_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
void ortho_v3_v3(float out[3], const float v[3])
MINLINE void negate_v3(float r[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
char * STRNCPY(char(&dst)[N], const char *src)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
size_t void BLI_uniquename_cb(blender::FunctionRef< bool(blender::StringRefNull)> unique_check, const char *defname, char delim, char *name, size_t name_maxncpy) ATTR_NONNULL(2
#define CTX_DATA_(context, msgid)
#define BLT_I18NCONTEXT_ID_SCENE
#define OB_MODE_ALL_PAINT
#define OB_MODE_ALL_WEIGHT_PAINT
Object is a sort of wrapper for general info.
#define BASE_SELECTED(v3d, base)
@ V3D_AROUND_CENTER_BOUNDS
@ V3D_AROUND_LOCAL_ORIGINS
@ V3D_ORIENT_CUSTOM_MATRIX
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Read Guarded memory(de)allocation.
void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3])
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_MESH(ele, iter, bm, itype)
BMIterType
BMesh Iterators.
BMVert * BM_mesh_active_vert_get(BMesh *bm)
void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
void BM_editselection_normal(BMEditSelection *ese, float r_normal[3])
bool BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
void BM_vert_tri_calc_tangent_from_edge(BMVert *verts[3], float r_tangent[3])
void BM_face_calc_tangent_pair_auto(const BMFace *f, float r_tangent_a[3], float r_tangent_b[3])
void BM_edge_ordered_verts(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
float BM_edge_calc_length_squared(const BMEdge *e)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
bool BM_vert_edge_pair(const BMVert *v, BMEdge **r_e_a, BMEdge **r_e_b)
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
void activate(bool forceActivation=false) const
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
constexpr const char * c_str() const
void * MEM_callocN(size_t len, const char *str)
ccl_device_inline bool is_zero(const float2 a)
bool bone_is_visible_editbone(const bArmature *armature, const EditBone *ebone)
float2 image_transform_mirror_factor_get(const Strip *strip)
Strip * select_active_get(const Scene *scene)
VecBase< float, 2 > float2
MatBase< float, 3, 3 > float3x3
struct ToolSettings * toolsettings
TransformOrientationSlot orientation_slots[4]
ListBase transform_spaces
StripTransform * transform
struct EditBone * act_edbone
struct bPoseChannel * parent