63 ListBaseT<TransformOrientation> *transform_orientations = &scene->
transform_spaces;
65 transform_orientations->free_no_destruct();
117 name =
DATA_(
"Custom View");
127 const bool overwrite)
133 if (base ==
nullptr) {
153 const bool overwrite)
156 float normal[3], plane[3];
175 const bool overwrite)
178 float normal[3], plane[3];
188 name =
DATA_(
"Curve");
197 const bool overwrite)
200 float normal[3], plane[3];
213 name =
DATA_(
"Vertex");
223 name =
DATA_(
"Edge");
233 name =
DATA_(
"Face");
260 cross_vec[0] = axis[1];
261 cross_vec[1] = axis[2];
262 cross_vec[2] = axis[0];
283 float mat[3][3], tmat[3][3], obmat[3][3];
295 const Bone *pchan_bone = pchan->bone_get(*ob);
299 float parent_mat[3][3];
307 copy_m3_m4(obmat, ob->object_to_world().ptr());
312 copy_m3_m4(obmat, ob->object_to_world().ptr());
333 float parent_mat[3][3];
346 bool is_zero[3] = {
true,
true,
true};
359 if (zero_axis == 0) {
363 if (zero_axis == 1) {
365 cross_v3_v3v3(mat[axis], mat[(axis + 1) % 3], mat[(axis + 2) % 3]);
370 else if (zero_axis == 2) {
391 float tangent[3] = {0.0f, 0.0f, 1.0f};
401 tangent[1] = tangent[2] = 0.0f;
453 const float normal[3],
454 const float tangent[3])
473 const bool overwrite)
505 return (ts !=
nullptr);
511 const bool overwrite)
515 ListBaseT<TransformOrientation> *transform_orientations = &scene->
transform_spaces;
516 char name_unique[
sizeof(ts->
name)];
529 ts = MEM_new<TransformOrientation>(
"UserTransSpace from matrix");
565 ListBaseT<TransformOrientation> *transform_orientations = &scene->
transform_spaces;
566 return transform_orientations->count();
581 if (&child == &pose_bone) {
634 *bmain, scene, view_layer, v3d, rv3d, ob, obedit, orient_index, pivot_point, r_mat);
642 if (active_pchan && active_pchan->
parent) {
645 float ob_orientations_mat[3][3];
647 UNPACK3(ob->object_to_world().ptr()));
675 const short orientation_index,
676 const int pivot_point,
679 switch (orientation_index) {
714 bmain, scene, view_layer, v3d, ob, obedit, pivot_point, r_mat);
728 bmain, scene, view_layer, v3d, ob, obedit, pivot_point, r_mat);
743 if (rv3d !=
nullptr) {
765 scene, orientation_index_custom);
771 return orientation_index;
777 const float custom[3][3],
778 float r_spacemtx[3][3])
791 r_spacemtx,
'Z', strip->
data->transform->rotation * mirror[0] * mirror[1]);
829 return orient_index_result;
834 switch (orient_type) {
836 return RPT_(
"global");
838 return RPT_(
"gimbal");
840 return RPT_(
"normal");
842 return RPT_(
"local");
846 return RPT_(
"cursor");
848 return RPT_(
"parent");
850 return RPT_(
"custom");
862 const short orientation = t->
orient[orient_index].type;
892 if (ese.htype != htype) {
897 elems[i++] = ese.ele;
932 reinterpret_cast<BMElem **
>(elems),
940 reinterpret_cast<BMElem **
>(elems),
970 float imat[3][3], mat[3][3];
973 copy_m3_m4(imat, ob->object_to_world().ptr());
1006 float normal[3] = {0.0f};
1007 float plane_pair[2][3] = {{0.0f}};
1012 float tangent_pair[2][3];
1015 add_v3_v3(plane_pair[0], tangent_pair[0]);
1016 add_v3_v3(plane_pair[1], tangent_pair[1]);
1024 if (face_count == 1) {
1030 float normal_unit[3];
1031 float plane_unit_pair[2][3], plane_ortho_pair[2][3];
1037 cross_v3_v3v3(plane_ortho_pair[0], normal_unit, plane_unit_pair[0]);
1038 cross_v3_v3v3(plane_ortho_pair[1], normal_unit, plane_unit_pair[1]);
1047 add_v3_v3(r_plane, plane_pair[plane_index]);
1058 normal_tri_v3(r_normal, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co);
1061 no_test[0] = v_tri[0]->
no[0] + v_tri[1]->
no[0] + v_tri[2]->
no[0];
1062 no_test[1] = v_tri[0]->
no[1] + v_tri[1]->
no[1] + v_tri[2]->
no[1];
1063 no_test[2] = v_tri[0]->
no[2] + v_tri[1]->
no[2] + v_tri[2]->
no[2];
1064 if (
dot_v3v3(no_test, r_normal) < 0.0f) {
1073 for (j = 0; j < 3; j++) {
1077 if ((
e ==
nullptr) || (e_length < e_test_length)) {
1079 e_length = e_test_length;
1094 sub_v3_v3v3(r_plane, v_pair[0]->co, v_pair[1]->co);
1107 BMVert *v_pair[2] = {
nullptr,
nullptr};
1112 v_pair[0] = eed->
v1;
1113 v_pair[1] = eed->
v2;
1122 if (v_pair[0] && v_pair[1]) [[likely]] {
1123 bool v_pair_swap =
false;
1141 if (eed->
l->
v != v_pair[0]) {
1147 std::swap(v_pair[0], v_pair[1]);
1150 add_v3_v3v3(r_normal, v_pair[1]->no, v_pair[0]->no);
1151 sub_v3_v3v3(r_plane, v_pair[1]->co, v_pair[0]->co);
1175 bool v_pair_swap =
false;
1180 float dir_pair[2][3];
1183 if (e_pair[0]->
l->
v !=
v) {
1196 std::swap(v_pair[0], v_pair[1]);
1231 Curve *cu = id_cast<Curve *>(obedit->
data);
1236 void *vert_act =
nullptr;
1252 for (nu = nurbs->first(); nu; nu = nu->
next) {
1260#define SEL_F1 (1 << 0)
1261#define SEL_F2 (1 << 1)
1262#define SEL_F3 (1 << 2)
1313 else if (nu->
bp && (nu->
pntsv == 1)) {
1323 const bool is_prev_sel = bp_prev && (bp_prev->
f1 &
SELECT);
1324 const bool is_next_sel = bp_next && (bp_next->
f1 &
SELECT);
1325 if (is_prev_sel ==
false && is_next_sel ==
false) {
1330 else if (is_next_sel) {
1356 if (activeOnly && (ml = mb->
lastelem)) {
1385 if (activeOnly && (ebone = arm->
act_edbone)) {
1393 bool fallback_ok =
false;
1394 float fallback_normal[3];
1395 float fallback_plane[3];
1419 if ((ok ==
false) && fallback_ok) {
1454 float imat[3][3], mat[3][3];
1458 float pose_mat[3][3];
1467 if (transformed_len) {
1471 float pose_mat[3][3];
1485 copy_m3_m4(imat, ob->object_to_world().ptr());
1497 if (ob !=
nullptr) {
1506 if (base ==
nullptr) [[unlikely]] {
1517 copy_v3_v3(r_normal, ob->object_to_world().ptr()[2]);
1518 copy_v3_v3(r_plane, ob->object_to_world().ptr()[1]);
1544 *bmain, scene, view_layer, v3d, obact, obedit, around, r_normal, r_plane);
1554 float r_orientation_mat[3][3])
1556 float normal[3] = {0.0, 0.0, 0.0};
1557 float plane[3] = {0.0, 0.0, 0.0};
1562 bmain, scene, view_layer, v3d, ob, obedit, around, normal, plane);
Functions to deal with Armatures.
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
Blender kernel action and pose functionality.
#define BLI_ASSERT_UNIT_V3(v)
#define STRNCPY_UTF8(dst, src)
#define CTX_DATA_(context, msgid)
#define BLT_I18NCONTEXT_ID_SCENE
#define OB_MODE_ALL_PAINT_MESH
#define OB_MODE_ALL_WEIGHT_PAINT
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_MESH(ele, iter, bm, itype)
void activate(bool forceActivation=false) const
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
constexpr const char * c_str() const
const T & data(const Action &owning_action) const
bool bone_is_visible(const bArmature *armature, const Bone *bone)
constexpr char bone_default_name[]
void pose_bone_descendent_iterator(Object &pose_ob, bPoseChannel &pchan, FunctionRef< void(bPoseChannel &child_bone)> callback)
float2 image_transform_mirror_factor_get(const Strip *strip)
Strip * select_active_get(const Scene *scene)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE void negate_v3_v3(float r[3], const float a[3])
void mul_m3_v3(const float M[3][3], float r[3])
bPoseChannel * BKE_pose_channel_active(Object *ob, bool check_bonecoll)
void mul_m3_m3_pre(float R[3][3], const float A[3][3])
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
BMesh * BKE_editmesh_bmesh_get_for_write(Mesh *mesh)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
@ V3D_ORIENT_CUSTOM_MATRIX
ATTR_WARN_UNUSED_RESULT const BMLoop * l
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
void void BKE_reports_prepend(ReportList *reports, const char *prepend)
void copy_m3_m3(float m1[3][3], const float m2[3][3])
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
void mul_m3_m4m3(float R[3][3], const float A[4][4], const float B[3][3])
void normalize_m3(float R[3][3]) ATTR_NONNULL()
@ V3D_AROUND_CENTER_BOUNDS
@ V3D_AROUND_LOCAL_ORIGINS
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool ANIM_bone_in_visible_collection(const bArmature *armature, const Bone *bone)
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
int BKE_scene_orientation_get_index(Scene *scene, int slot_index)
void BKE_nurb_bezt_calc_normal(Nurb *nu, BezTriple *bezt, float r_normal[3])
void project_plane_normalized_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
ATTR_WARN_UNUSED_RESULT const BMVert * v
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void BKE_pose_channel_transform_orientation(const bArmature *arm, const bPoseChannel *pose_bone, float r_pose_orientation[3][3])
Base * CTX_data_active_base(const bContext *C)
void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], short order)
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ViewLayer * CTX_data_view_layer(const bContext *C)
void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
void mul_qt_v3(const float q[4], float r[3])
void quat_to_mat3(float m[3][3], const float q[4])
size_t void BLI_uniquename_cb(FunctionRef< bool(StringRefNull)> unique_check, const char *defname, char delim, char *name, size_t name_maxncpy) ATTR_NONNULL(2
VecBase< float, 2 > float2
void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3])
void transpose_m3(float R[3][3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
Object * CTX_data_edit_object(const bContext *C)
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])
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
MINLINE void negate_v3(float r[3])
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BM_edge_ordered_verts(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
MINLINE void zero_v3(float r[3])
MatBase< float, 3, 3 > float3x3
void invert_m3_m3_safe_ortho(float inverse[3][3], const float mat[3][3])
TransformOrientation * BKE_scene_transform_orientation_find(const Scene *scene, int index)
void ortho_v3_v3(float out[3], const float v[3])
int BKE_scene_transform_orientation_get_index(const Scene *scene, const TransformOrientation *orientation)
void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
void BKE_scene_transform_orientation_remove(Scene *scene, TransformOrientation *orientation)
MINLINE float normalize_v3_v3(float r[3], const float a[3])
bool invert_m3(float mat[3][3])
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
MINLINE float normalize_v3(float n[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
BPoint * BKE_nurb_bpoint_get_prev(Nurb *nu, BPoint *bp)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
float BM_edge_calc_length_squared(const BMEdge *e)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Main * CTX_data_main(const bContext *C)
void unit_m3(float m[3][3])
bool BKE_curve_nurb_vert_active_get(Curve *cu, Nurb **r_nu, void **r_vert)
void BKE_nurb_bpoint_calc_plane(Nurb *nu, BPoint *bp, float r_plane[3])
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
void BKE_nurb_bpoint_calc_normal(Nurb *nu, BPoint *bp, float r_normal[3])
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
bool BM_vert_edge_pair(const BMVert *v, BMEdge **r_e_a, BMEdge **r_e_b)
void zero_m3(float m[3][3])
ListBaseT< Nurb > * BKE_curve_editNurbs_get(Curve *cu)
bPoseChannel * BKE_pose_channel_active_if_bonecoll_visible(Object *ob) ATTR_WARN_UNUSED_RESULT
Scene * CTX_data_scene(const bContext *C)
BPoint * BKE_nurb_bpoint_get_next(Nurb *nu, BPoint *bp)
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
bool BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
void BKE_nurb_bezt_calc_plane(Nurb *nu, BezTriple *bezt, float r_plane[3])
MINLINE int min_ii(int a, int b)
Object * CTX_data_active_object(const bContext *C)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
ARegion * CTX_wm_region(const bContext *C)
void BM_editselection_normal(BMEditSelection *ese, float r_normal[3])
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
BMVert * BM_mesh_active_vert_get(BMesh *bm)
View3D * CTX_wm_view3d(const bContext *C)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
Normal to x,y matrix.
void axis_angle_to_mat3_single(float R[3][3], char axis, float angle)
ListBaseT< BMEditSelection > selected
const c_style_mat & ptr() const
eRegionView3D_Persp persp
TransformOrientationSlot orientation_slots[4]
ListBaseT< TransformOrientation > transform_spaces
struct ToolSettings * toolsettings
eHandleDisplay handle_display
ListBaseT< EditBone > * edbo
struct EditBone * act_edbone
bPoseChannelRuntimeFlag flag
struct bPoseChannel_Runtime runtime
struct bPoseChannel * parent
ListBaseT< bPoseChannel > chanbase