126 const bool overwrite)
132 if (base ==
nullptr) {
152 const bool overwrite)
155 float normal[3], plane[3];
174 const bool overwrite)
177 float normal[3], plane[3];
196 const bool overwrite)
199 float normal[3], plane[3];
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)];
578 if (&child == &pose_bone) {
632 scene, view_layer, v3d, rv3d, ob, obedit, orient_index, pivot_point, r_mat);
640 if (active_pchan && active_pchan->
parent) {
643 float ob_orientations_mat[3][3];
645 UNPACK3(ob->object_to_world().ptr()));
672 const short orientation_index,
673 const int pivot_point,
676 switch (orientation_index) {
738 if (rv3d !=
nullptr) {
760 scene, orientation_index_custom);
766 return orientation_index;
772 const float custom[3][3],
773 float r_spacemtx[3][3])
811 scene, t->
view_layer, v3d, rv3d, ob, obedit, orient_index, t->
around, r_spacemtx);
824 return orient_index_result;
829 switch (orient_type) {
831 return RPT_(
"global");
833 return RPT_(
"gimbal");
835 return RPT_(
"normal");
837 return RPT_(
"local");
841 return RPT_(
"cursor");
843 return RPT_(
"parent");
845 return RPT_(
"custom");
857 const short orientation = t->
orient[orient_index].
type;
887 if (ese->htype != htype) {
892 elems[
i++] = ese->ele;
958 float imat[3][3], mat[3][3];
961 copy_m3_m4(imat, ob->object_to_world().ptr());
994 float normal[3] = {0.0f};
995 float plane_pair[2][3] = {{0.0f}};
1000 float tangent_pair[2][3];
1003 add_v3_v3(plane_pair[0], tangent_pair[0]);
1004 add_v3_v3(plane_pair[1], tangent_pair[1]);
1012 if (face_count == 1) {
1018 float normal_unit[3];
1019 float plane_unit_pair[2][3], plane_ortho_pair[2][3];
1025 cross_v3_v3v3(plane_ortho_pair[0], normal_unit, plane_unit_pair[0]);
1026 cross_v3_v3v3(plane_ortho_pair[1], normal_unit, plane_unit_pair[1]);
1035 add_v3_v3(r_plane, plane_pair[plane_index]);
1046 normal_tri_v3(r_normal, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co);
1049 no_test[0] = v_tri[0]->
no[0] + v_tri[1]->
no[0] + v_tri[2]->
no[0];
1050 no_test[1] = v_tri[0]->
no[1] + v_tri[1]->
no[1] + v_tri[2]->
no[1];
1051 no_test[2] = v_tri[0]->
no[2] + v_tri[1]->
no[2] + v_tri[2]->
no[2];
1052 if (
dot_v3v3(no_test, r_normal) < 0.0f) {
1061 for (j = 0; j < 3; j++) {
1065 if ((
e ==
nullptr) || (e_length < e_test_length)) {
1067 e_length = e_test_length;
1082 sub_v3_v3v3(r_plane, v_pair[0]->co, v_pair[1]->co);
1095 BMVert *v_pair[2] = {
nullptr,
nullptr};
1100 v_pair[0] = eed->
v1;
1101 v_pair[1] = eed->
v2;
1110 if (
LIKELY(v_pair[0] && v_pair[1])) {
1111 bool v_pair_swap =
false;
1129 if (eed->
l->
v != v_pair[0]) {
1135 std::swap(v_pair[0], v_pair[1]);
1138 add_v3_v3v3(r_normal, v_pair[1]->no, v_pair[0]->no);
1139 sub_v3_v3v3(r_plane, v_pair[1]->co, v_pair[0]->co);
1163 bool v_pair_swap =
false;
1168 float dir_pair[2][3];
1171 if (e_pair[0]->
l->v !=
v) {
1184 std::swap(v_pair[0], v_pair[1]);
1224 void *vert_act =
nullptr;
1240 for (nu =
static_cast<Nurb *
>(nurbs->
first); nu; nu = nu->
next) {
1248#define SEL_F1 (1 << 0)
1249#define SEL_F2 (1 << 1)
1250#define SEL_F3 (1 << 2)
1301 else if (nu->
bp && (nu->
pntsv == 1)) {
1311 const bool is_prev_sel = bp_prev && (bp_prev->
f1 &
SELECT);
1312 const bool is_next_sel = bp_next && (bp_next->
f1 &
SELECT);
1313 if (is_prev_sel ==
false && is_next_sel ==
false) {
1318 else if (is_next_sel) {
1344 if (activeOnly && (ml = mb->
lastelem)) {
1373 if (activeOnly && (ebone = arm->
act_edbone)) {
1381 bool fallback_ok =
false;
1382 float fallback_normal[3];
1383 float fallback_plane[3];
1407 if ((ok ==
false) && fallback_ok) {
1442 float imat[3][3], mat[3][3];
1446 float pose_mat[3][3];
1455 if (transformed_len) {
1459 float pose_mat[3][3];
1473 copy_m3_m4(imat, ob->object_to_world().ptr());
1485 if (ob !=
nullptr) {
1505 copy_v3_v3(r_normal, ob->object_to_world().ptr()[2]);
1506 copy_v3_v3(r_plane, ob->object_to_world().ptr()[1]);
1531 scene, view_layer, v3d, obact, obedit, around, r_normal, r_plane);
1540 float r_orientation_mat[3][3])
1542 float normal[3] = {0.0, 0.0, 0.0};
1543 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.
void BKE_pose_channel_transform_orientation(const bArmature *arm, const bPoseChannel *pose_bone, float r_pose_orientation[3][3])
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 * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
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)
void pose_bone_descendent_iterator(bPose &pose, bPoseChannel &pose_bone, FunctionRef< void(bPoseChannel &child_bone)> callback)
bool bone_is_visible(const bArmature *armature, const Bone *bone)
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
struct bPoseChannel_Runtime runtime