59 ListBase *transform_orientations = &scene->transform_spaces;
63 for (
int i = 0; i <
ARRAY_SIZE(scene->orientation_slots); i++) {
115 name =
DATA_(
"Custom View");
125 const bool overwrite)
131 if (base ==
nullptr) {
151 const bool overwrite)
154 float normal[3], plane[3];
164 name =
DATA_(
"Bone");
173 const bool overwrite)
176 float normal[3], plane[3];
186 name =
DATA_(
"Curve");
195 const bool overwrite)
198 float normal[3], plane[3];
211 name =
DATA_(
"Vertex");
221 name =
DATA_(
"Edge");
231 name =
DATA_(
"Face");
257 cross_vec[0] = axis[1];
258 cross_vec[1] = axis[2];
259 cross_vec[2] = axis[0];
280 float mat[3][3], tmat[3][3], obmat[3][3];
295 float parent_mat[3][3];
303 copy_m3_m4(obmat, ob->object_to_world().ptr());
308 copy_m3_m4(obmat, ob->object_to_world().ptr());
329 float parent_mat[3][3];
342 bool is_zero[3] = {
true,
true,
true};
355 if (zero_axis == 0) {
359 if (zero_axis == 1) {
361 cross_v3_v3v3(mat[axis], mat[(axis + 1) % 3], mat[(axis + 2) % 3]);
366 else if (zero_axis == 2) {
387 float tangent[3] = {0.0f, 0.0f, 1.0f};
397 tangent[1] = tangent[2] = 0.0f;
440 const bool overwrite)
472 return (ts !=
nullptr);
478 const bool overwrite)
482 ListBase *transform_orientations = &scene->transform_spaces;
483 char name_unique[
sizeof(ts->
name)];
533 ListBase *transform_orientations = &scene->transform_spaces;
556 bone->flag &= ~BONE_TRANSFORM;
586 const int pivot_point = scene->toolsettings->transform_pivot_point;
589 scene, view_layer, v3d, rv3d, ob, obedit, orient_index, pivot_point, r_mat);
597 if (active_pchan && active_pchan->
parent) {
600 float ob_orientations_mat[3][3];
602 UNPACK3(ob->object_to_world().ptr()));
629 const short orientation_index,
630 const int pivot_point,
633 switch (orientation_index) {
694 if (rv3d !=
nullptr) {
716 scene, orientation_index_custom);
722 return orientation_index;
728 const float custom[3][3],
729 float r_spacemtx[3][3])
765 scene, t->
view_layer, v3d, rv3d, ob, obedit, orient_index, t->
around, r_spacemtx);
778 return r_orient_index;
783 switch (orient_type) {
785 return RPT_(
"global");
787 return RPT_(
"gimbal");
789 return RPT_(
"normal");
791 return RPT_(
"local");
795 return RPT_(
"cursor");
797 return RPT_(
"parent");
799 return RPT_(
"custom");
811 const short orientation = t->
orient[orient_index].
type;
841 if (ese->htype != htype) {
846 elems[i++] = ese->ele;
912 float imat[3][3], mat[3][3];
915 copy_m3_m4(imat, ob->object_to_world().ptr());
925 float vec[3] = {0, 0, 0};
966 normal_tri_v3(normal, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co);
969 no_test[0] = v_tri[0]->
no[0] + v_tri[1]->
no[0] + v_tri[2]->
no[0];
970 no_test[1] = v_tri[0]->
no[1] + v_tri[1]->
no[1] + v_tri[2]->
no[1];
971 no_test[2] = v_tri[0]->
no[2] + v_tri[1]->
no[2] + v_tri[2]->
no[2];
972 if (
dot_v3v3(no_test, normal) < 0.0f) {
981 for (j = 0; j < 3; j++) {
985 if ((
e ==
nullptr) || (e_length < e_test_length)) {
987 e_length = e_test_length;
1015 BMVert *v_pair[2] = {
nullptr,
nullptr};
1020 v_pair[0] = eed->
v1;
1021 v_pair[1] = eed->
v2;
1030 if (
LIKELY(v_pair[0] && v_pair[1])) {
1031 bool v_pair_swap =
false;
1049 if (eed->
l->
v != v_pair[0]) {
1055 std::swap(v_pair[0], v_pair[1]);
1058 add_v3_v3v3(normal, v_pair[1]->no, v_pair[0]->no);
1083 bool v_pair_swap =
false;
1088 float dir_pair[2][3];
1091 if (e_pair[0]->
l->
v !=
v) {
1104 std::swap(v_pair[0], v_pair[1]);
1144 void *vert_act =
nullptr;
1160 for (nu =
static_cast<Nurb *
>(nurbs->
first); nu; nu = nu->
next) {
1168#define SEL_F1 (1 << 0)
1169#define SEL_F2 (1 << 1)
1170#define SEL_F3 (1 << 2)
1221 else if (nu->
bp && (nu->
pntsv == 1)) {
1231 const bool is_prev_sel = bp_prev && (bp_prev->
f1 &
SELECT);
1232 const bool is_next_sel = bp_next && (bp_next->
f1 &
SELECT);
1233 if (is_prev_sel ==
false && is_next_sel ==
false) {
1238 else if (is_next_sel) {
1264 if (activeOnly && (ml = mb->
lastelem)) {
1293 if (activeOnly && (ebone = arm->
act_edbone)) {
1301 bool fallback_ok =
false;
1302 float fallback_normal[3];
1303 float fallback_plane[3];
1327 if ((ok ==
false) && fallback_ok) {
1362 float imat[3][3], mat[3][3];
1371 int transformed_len;
1373 if (transformed_len) {
1388 copy_m3_m4(imat, ob->object_to_world().ptr());
1400 if (ob !=
nullptr) {
1420 copy_v3_v3(normal, ob->object_to_world().ptr()[2]);
1421 copy_v3_v3(plane, ob->object_to_world().ptr()[1]);
1451 float r_orientation_mat[3][3])
1453 float normal[3] = {0.0, 0.0, 0.0};
1454 float plane[3] = {0.0, 0.0, 0.0};
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
bool ANIM_bonecoll_is_visible_editbone(const bArmature *armature, const EditBone *ebone)
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)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int min_ii(int a, int b)
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])
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 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])
#define STRNCPY(dst, src)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
size_t void BLI_uniquename_cb(UniquenameCheckCallback unique_check, void *arg, const char *defname, char delim, char *name, size_t name_maxncpy) ATTR_NONNULL(1
#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
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.
ATTR_WARN_UNUSED_RESULT BMesh const char itype
ATTR_WARN_UNUSED_RESULT BMesh * bm
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_edge(BMVert *verts[3], float r_tangent[3])
void BM_face_calc_tangent_auto(const BMFace *f, float r_tangent[3])
void BM_edge_ordered_verts(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
float BM_edge_calc_length_squared(const BMEdge *e)
bool BM_vert_edge_pair(BMVert *v, BMEdge **r_e_a, BMEdge **r_e_b)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_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.
local_group_size(16, 16) .push_constant(Type b
void *(* MEM_callocN)(size_t len, const char *str)
ccl_device_inline bool is_zero(const float2 a)
Sequence * SEQ_select_active_get(const Scene *scene)
StripTransform * transform
struct TransInfo::@565 orient[3]
struct EditBone * act_edbone
struct bPoseChannel * parent
const c_style_mat & ptr() const