56#include "RNA_prototypes.hh"
105 float ob_obmat_orig[4][4];
106 float ob_dims_orig[3];
107 float ob_scale_orig[3];
115#define TRANSFORM_MEDIAN_ARRAY_LEN (sizeof(TransformMedian) / sizeof(float))
129 params->unique_retval_ids,
params->unique_retval_ids_len, &retval_test) == -1)
136 int verts_mask_count = 0;
147 verts_mask_count += 1;
152 update_params.do_normals =
true;
154 em->
bm, &update_params, verts_mask, verts_mask_count);
167 if (bmpinfo ==
nullptr) {
179 if (bmpinfo ==
nullptr) {
204 if (ve_median <= 0.0f) {
207 if (ve_median >= 1.0f) {
212 float median_new = ve_median;
213 float median_orig = ve_median - median;
216 CLAMP(median_orig, 0.0f, 1.0f);
217 CLAMP(median_new, 0.0f, 1.0f);
219 if (median_new <= median_orig) {
221 return median_new / median_orig;
225 return -(1.0f - median_new) / (1.0f - median_orig);
234static void apply_raw_diff(
float *val,
const int tot,
const float ve_median,
const float median)
236 *val = (tot == 1) ? ve_median : (*val + median);
241 const float ve_median[3],
242 const float median[3])
253 float *val,
const int tot,
const float ve_median,
const float median,
const float sca)
255 if (tot == 1 || ve_median == median) {
265 const float ve_median,
270 CLAMP(*val, 0.0f, 1.0f);
272 else if (
ELEM(sca, 0.0f, 1.0f)) {
276 *val = (sca > 0.0f) ? (*val * sca) : (1.0f + ((1.0f - *val) * sca));
277 CLAMP(*val, 0.0f, 1.0f);
303 int tot, totedgedata, totcurvedata, totlattdata, totcurvebweight;
304 bool has_meshdata =
false;
305 bool has_skinradius =
false;
309 tot = totedgedata = totcurvedata = totlattdata = totcurvebweight = 0;
314 BMEditMesh *em = mesh->runtime->edit_mesh.get();
330 has_skinradius = (cd_vert_skin_offset != -1);
338 if (cd_vert_bweight_offset != -1) {
342 if (cd_vert_crease_offset != -1) {
346 if (has_skinradius) {
355 if ((cd_edge_bweight_offset != -1) || (cd_edge_crease_offset != -1)) {
359 if (cd_edge_bweight_offset != -1) {
363 if (cd_edge_crease_offset != -1) {
376 has_meshdata = (tot || totedgedata);
386 void *selp =
nullptr;
401 seltype = &RNA_BezierSplinePoint;
420 a = nu->pntsu * nu->pntsv;
432 seltype = &RNA_SplinePoint;
441 if (totcurvedata == 1) {
451 void *selp =
nullptr;
462 seltype = &RNA_LatticePoint;
469 if (totlattdata == 1) {
476 block,
UI_BTYPE_LABEL, 0,
IFACE_(
"Nothing selected"), 0, 130, 200, 20,
nullptr, 0, 0,
"");
495 if (has_skinradius) {
501 else if (totcurvedata) {
503 if (totcurvebweight) {
510 else if (totlattdata) {
519 const int butw = 200;
521 const int but_margin = 2;
530 c =
IFACE_(
"Control Point:");
540 uiDefBut(block,
UI_BTYPE_LABEL, 0, c, 0, yi -= buth, butw, buth,
nullptr, 0, 0,
"");
591 if (totcurvebweight == tot) {
615 yi -= buth + but_margin,
621 TIP_(
"Displays global values"));
634 TIP_(
"Displays local values"));
644 tot == 1 ?
IFACE_(
"Vertex Data:") :
IFACE_(
"Vertices Data:"),
646 yi -= buth + but_margin,
657 tot == 1 ?
IFACE_(
"Bevel Weight:") :
IFACE_(
"Mean Bevel Weight:"),
659 yi -= buth + but_margin,
665 TIP_(
"Vertex weight used by Bevel modifier"));
672 tot == 1 ?
IFACE_(
"Vertex Crease:") :
IFACE_(
"Mean Vertex Crease:"),
674 yi -= buth + but_margin,
680 TIP_(
"Weight used by the Subdivision Surface modifier"));
684 if (has_skinradius) {
689 tot == 1 ?
IFACE_(
"Radius X:") :
IFACE_(
"Mean Radius X:"),
691 yi -= buth + but_margin,
697 TIP_(
"X radius used by Skin modifier"));
703 tot == 1 ?
IFACE_(
"Radius Y:") :
IFACE_(
"Mean Radius Y:"),
705 yi -= buth + but_margin,
711 TIP_(
"Y radius used by Skin modifier"));
720 totedgedata == 1 ?
IFACE_(
"Edge Data:") :
IFACE_(
"Edges Data:"),
722 yi -= buth + but_margin,
733 totedgedata == 1 ?
IFACE_(
"Bevel Weight:") :
IFACE_(
"Mean Bevel Weight:"),
735 yi -= buth + but_margin,
741 TIP_(
"Edge weight used by Bevel modifier"));
748 totedgedata == 1 ?
IFACE_(
"Crease:") :
IFACE_(
"Mean Crease:"),
750 yi -= buth + but_margin,
756 TIP_(
"Weight used by the Subdivision Surface modifier"));
762 else if (totcurvedata) {
764 if (totcurvedata == 1) {
770 yi -= buth + but_margin,
786 yi -= buth + but_margin,
802 yi -= buth + but_margin,
814 else if (totcurvedata > 1) {
820 yi -= buth + but_margin,
826 TIP_(
"Weight used for Soft Body Goal"));
834 yi -= buth + but_margin,
840 TIP_(
"Radius of curve control points"));
848 yi -= buth + but_margin,
854 TIP_(
"Tilt of curve control points"));
861 else if (totlattdata) {
863 if (totlattdata == 1) {
869 yi -= buth + but_margin,
881 else if (totlattdata > 1) {
887 yi -= buth + but_margin,
893 TIP_(
"Weight used for Soft Body Goal"));
903 if (
BMEditMesh *em = mesh->runtime->edit_mesh.get()) {
908 callback_data.arg1 = em;
922 (
float *)&ve_median_basis,
923 (
float *)&median_basis,
927 const bool apply_vcos = (tot == 1) || (
len_squared_v3(median_basis.generic.location) != 0.0f);
930 (apply_vcos || median_basis.mesh.bv_weight || median_basis.mesh.v_crease ||
931 median_basis.mesh.skin[0] || median_basis.mesh.skin[1] || median_basis.mesh.be_weight ||
932 median_basis.mesh.e_crease))
936 BMEditMesh *em = mesh->runtime->edit_mesh.get();
942 int cd_vert_bweight_offset = -1;
943 int cd_vert_crease_offset = -1;
944 int cd_vert_skin_offset = -1;
945 int cd_edge_bweight_offset = -1;
946 int cd_edge_crease_offset = -1;
948 float scale_bv_weight = 1.0f;
949 float scale_v_crease = 1.0f;
950 float scale_skin[2] = {1.0f, 1.0f};
951 float scale_be_weight = 1.0f;
952 float scale_e_crease = 1.0f;
981 for (
int i = 0; i < 2; i++) {
982 if (median->
skin[i]) {
986 if (ve_median->skin[i] != median->
skin[i]) {
987 scale_skin[i] = ve_median->skin[i] / (ve_median->skin[i] - median->
skin[i]);
998 if (cd_vert_bweight_offset != -1) {
999 float *b_weight =
static_cast<float *
>(
1004 if (cd_vert_crease_offset != -1) {
1005 float *crease =
static_cast<float *
>(
1010 if (cd_vert_skin_offset != -1) {
1015 for (
int i = 0; i < 2; i++) {
1016 if (median->
skin[i] != 0.0f) {
1018 &vs->
radius[i], tot, ve_median->skin[i], median->
skin[i], scale_skin[i]);
1059 float *b_weight =
static_cast<float *
>(
1065 float *crease =
static_cast<float *
>(
1074 (apply_vcos || median_basis.curve.b_weight || median_basis.curve.weight ||
1075 median_basis.curve.radius || median_basis.curve.tilt))
1078 *ve_median = &ve_median_basis.curve;
1088 for (a = nu->pntsu, bezt = nu->bezt; a--; bezt++) {
1109 else if (apply_vcos) {
1121 for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a--; bp++) {
1146 if ((nu->type ==
CU_BEZIER) && apply_vcos) {
1151 else if ((ob->
type ==
OB_LATTICE) && (apply_vcos || median_basis.lattice.weight)) {
1153 *ve_median = &ve_median_basis.lattice;
1178#undef TRANSFORM_MEDIAN_ARRAY_LEN
1188 const int butw = 200;
1210 for (
int i = 0; i < 3; i++) {
1212 const char text[3] = {char(
'X' + i),
':',
'\0'};
1233 for (
int i = 0; i < 3; i++) {
1235 axis_mask |= (1 << i);
1247#define B_VGRP_PNL_EDIT_SINGLE 8
1319 int subset_count, vgroup_tot;
1320 const bool *vgroup_validmap;
1336 ob, subset_type, &vgroup_tot, &subset_count);
1343 if (vgroup_validmap[i]) {
1378 vertex_weight = dw->
weight;
1401 icon = (locked) ? ICON_BLANK1 : ICON_PASTEDOWN;
1403 "OBJECT_OT_vertex_weight_paste",
1413 icon = (locked) ? ICON_LOCKED : ICON_X;
1415 "OBJECT_OT_vertex_weight_delete",
1446 TIP_(
"Normalize weights of active vertex (if affected groups are unlocked)"));
1462 TIP_(
"Copy active vertex to other selected vertices (if affected groups are unlocked)"));
1475 if (
ptr->
type == &RNA_PoseBone) {
1480 bone =
static_cast<Bone *
>(boneptr.
data);
1487 uiItemL(colsub,
"", ICON_NONE);
1493 ICON_DECORATE_UNLOCKED);
1510 ICON_DECORATE_UNLOCKED);
1513 uiItemL(colsub,
"", ICON_NONE);
1520 ICON_DECORATE_UNLOCKED);
1534 ICON_DECORATE_UNLOCKED);
1537 uiItemL(colsub,
"", ICON_NONE);
1544 ICON_DECORATE_UNLOCKED);
1551 uiItemL(colsub,
"", ICON_NONE);
1557 ICON_DECORATE_UNLOCKED);
1567 uiItemL(colsub,
"", ICON_NONE);
1573 ICON_DECORATE_UNLOCKED);
1636 if (!mball || !(mball->
lastelem)) {
1801 if (ob ==
nullptr) {
1816 ot->
name =
"Object Mode Menu";
1817 ot->
idname =
"VIEW3D_OT_object_mode_pie_or_toggle";
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)
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_active_if_bonecoll_visible(Object *ob) ATTR_WARN_UNUSED_RESULT
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void BKE_nurb_project_2d(Nurb *nu)
void BKE_nurb_handles_test(Nurb *nu, eNurbHandleTest_Mode handle_mode, bool use_around_local)
ListBase * BKE_curve_editNurbs_get(Curve *cu)
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset(const CustomData *data, eCustomDataType type)
bool CustomData_has_layer_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
void BKE_editmesh_looptris_and_normals_calc_with_partial(BMEditMesh *em, BMPartialUpdate *bmpinfo)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
General operations, lookup, etc. for blender objects.
void BKE_object_dimensions_set_ex(Object *ob, const float value[3], int axis_mask, const float ob_scale_orig[3], const float ob_obmat_orig[4][4])
bool BKE_object_is_in_wpaint_select_vert(const Object *ob)
void BKE_object_dimensions_eval_cached_get(Object *ob, float r_vec[3])
bool BKE_object_is_in_editmode_vgroup(const Object *ob)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Generic array manipulation API.
#define BLI_array_findindex(arr, arr_len, p)
#define BLI_BITMAP_NEW(_num, _alloc_string)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
#define LISTBASE_FOREACH(type, var, list)
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)
void mul_m4_v3(const float M[4][4], float r[3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_fl(float r[3], float f)
void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, int size)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void copy_vn_fl(float *array_tar, int size, float val)
MINLINE void add_v2_v2(float r[2], const float a[2])
MINLINE void add_v3_v3(float r[3], const float a[3])
#define STRNCPY(dst, src)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
void DEG_id_tag_update(ID *id, unsigned int flags)
Object is a sort of wrapper for general info.
#define OB_TYPE_SUPPORT_EDITMODE(_type)
#define OBEDIT_FROM_OBACT(ob)
MDeformVert * ED_mesh_active_dvert_get_only(Object *ob)
void ED_area_tag_redraw(ScrArea *area)
bool ED_operator_view3d_active(bContext *C)
static void split(const char *text, const char *seps, char ***str, int *count)
Read Guarded memory(de)allocation.
#define RNA_TRANSLATION_PREC_DEFAULT
void UI_but_func_set(uiBut *but, std::function< void(bContext &)> func)
void uiLayoutSetActive(uiLayout *layout, bool active)
@ UI_EMBOSS_NONE_OR_STATUS
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
void UI_block_interaction_set(uiBlock *block, uiBlockInteraction_CallbackData *callbacks)
uiBut * uiDefBut(uiBlock *block, int type, int retval, blender::StringRef str, int x, int y, short width, short height, void *poin, float min, float max, const char *tip)
void uiItemL(uiLayout *layout, const char *name, int icon)
void uiItemFullO(uiLayout *layout, const char *opname, const char *name, int icon, IDProperty *properties, wmOperatorCallContext context, eUI_Item_Flag flag, PointerRNA *r_opptr)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void UI_but_drawflag_enable(uiBut *but, int flag)
void UI_but_number_step_size_set(uiBut *but, float step_size)
void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg)
uiBut * uiDefButO_ptr(uiBlock *block, int type, wmOperatorType *ot, wmOperatorCallContext opcontext, blender::StringRef str, int x, int y, short width, short height, const char *tip)
uiBut * uiDefButF(uiBlock *block, int type, int retval, blender::StringRef str, int x, int y, short width, short height, float *poin, float min, float max, const char *tip)
uiBut * uiDefButBitS(uiBlock *block, int type, int bit, int retval, blender::StringRef str, int x, int y, short width, short height, short *poin, float min, float max, const char *tip)
PointerRNA * UI_but_operator_ptr_ensure(uiBut *but)
void UI_block_align_begin(uiBlock *block)
void uiLayoutSetEmboss(uiLayout *layout, eUIEmbossType emboss)
void UI_but_number_precision_set(uiBut *but, float precision)
int UI_pie_menu_invoke(bContext *C, const char *idname, const wmEvent *event)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
uiLayout * uiLayoutSplit(uiLayout *layout, float percentage, bool align)
uiBlock * uiLayoutAbsoluteBlock(uiLayout *layout)
uiBut * uiDefButR(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, PointerRNA *ptr, const char *propname, int index, float min, float max, const char *tip)
void UI_but_unit_type_set(uiBut *but, int unit_type)
void UI_but_flag_enable(uiBut *but, int flag)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
void UI_block_align_end(uiBlock *block)
#define BM_ELEM_CD_GET_FLOAT(ele, offset)
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_flag_test(ele, hflag)
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
BMPartialUpdate * BM_mesh_partial_create_from_verts_group_single(BMesh *bm, const BMPartialUpdate_Params *params, const BLI_bitmap *verts_mask, const int verts_mask_count)
void BM_mesh_partial_destroy(BMPartialUpdate *bmpinfo)
void resize(const int64_t new_size)
draw_view in_light_buf[] float
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void collection_hide_menu_draw(const bContext *C, uiLayout *layout)
bool mode_set(bContext *C, eObjectMode mode)
void vgroup_vert_active_mirror(Object *ob, int def_nr)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_id_pointer_create(ID *id)
static const float tilt_limit
struct EditLatt * editlatt
ObjectRuntimeHandle * runtime
void(* draw)(const bContext *C, Panel *panel)
char idname[BKE_ST_MAXNAME]
bool(* poll)(const bContext *C, PanelType *pt)
char translation_context[BKE_ST_MAXNAME]
char category[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
void * properties_storage
void(* properties_storage_free)(void *properties_storage)
struct EditBone * act_edbone
uiBlockInteractionBeginFn begin_fn
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)