50 #include "RNA_prototypes.h"
75 float location[3], bv_weight, v_crease,
be_weight, skin[2], e_crease;
79 float location[3], weight,
b_weight, radius, tilt;
83 float location[3], weight;
96 float ob_obmat_orig[4][4];
97 float ob_dims_orig[3];
98 float ob_scale_orig[3];
105 #define TRANSFORM_MEDIAN_ARRAY_LEN (sizeof(TransformMedian) / sizeof(float))
119 params->unique_retval_ids,
params->unique_retval_ids_len, &retval_test) == -1) {
125 int verts_mask_count = 0;
136 verts_mask_count += 1;
142 .do_tessellate = true,
159 if (bmpinfo ==
NULL) {
172 if (bmpinfo ==
NULL) {
197 if (ve_median <= 0.0f) {
200 if (ve_median >= 1.0f) {
205 float median_new = ve_median;
206 float median_orig = ve_median - median;
209 CLAMP(median_orig, 0.0f, 1.0f);
210 CLAMP(median_new, 0.0f, 1.0f);
212 if (median_new <= median_orig) {
214 return median_new / median_orig;
218 return -(1.0f - median_new) / (1.0f - median_orig);
227 static void apply_raw_diff(
float *val,
const int tot,
const float ve_median,
const float median)
229 *val = (tot == 1) ? ve_median : (*val + median);
234 const float ve_median[3],
235 const float median[3])
246 float *val,
const int tot,
const float ve_median,
const float median,
const float sca)
248 if (tot == 1 || ve_median == median) {
258 const float ve_median,
263 CLAMP(*val, 0.0f, 1.0f);
265 else if (
ELEM(sca, 0.0f, 1.0f)) {
269 *val = (sca > 0.0f) ? (*val * sca) : (1.0f + ((1.0f - *val) * sca));
270 CLAMP(*val, 0.0f, 1.0f);
278 "TransformProperties");
289 int tot, totedgedata, totcurvedata, totlattdata, totcurvebweight;
290 bool has_meshdata =
false;
291 bool has_skinradius =
false;
295 tot = totedgedata = totcurvedata = totlattdata = totcurvebweight = 0;
312 has_skinradius = (cd_vert_skin_offset != -1);
320 if (cd_vert_bweight_offset != -1) {
324 if (cd_vert_crease_offset != -1) {
328 if (has_skinradius) {
336 if ((cd_edge_bweight_offset != -1) || (cd_edge_crease_offset != -1)) {
340 if (cd_edge_bweight_offset != -1) {
344 if (cd_edge_crease_offset != -1) {
357 has_meshdata = (tot || totedgedata);
382 seltype = &RNA_BezierSplinePoint;
401 a = nu->pntsu * nu->pntsv;
413 seltype = &RNA_SplinePoint;
422 if (totcurvedata == 1) {
443 seltype = &RNA_LatticePoint;
450 if (totlattdata == 1) {
459 IFACE_(
"Nothing selected"),
488 if (has_skinradius) {
494 else if (totcurvedata) {
496 if (totcurvebweight) {
503 else if (totlattdata) {
512 const int butw = 200;
514 const int but_margin = 2;
533 uiDefBut(block,
UI_BTYPE_LABEL, 0,
c, 0, yi -= buth, butw, buth,
NULL, 0, 0, 0, 0,
"");
590 if (totcurvebweight == tot) {
616 yi -= buth + but_margin,
624 TIP_(
"Displays global values"));
639 TIP_(
"Displays local values"));
649 tot == 1 ?
IFACE_(
"Vertex Data:") :
IFACE_(
"Vertices Data:"),
651 yi -= buth + but_margin,
664 tot == 1 ?
IFACE_(
"Bevel Weight:") :
IFACE_(
"Mean Bevel Weight:"),
666 yi -= buth + but_margin,
674 TIP_(
"Vertex weight used by Bevel modifier"));
681 tot == 1 ?
IFACE_(
"Vertex Crease:") :
IFACE_(
"Mean Vertex Crease:"),
683 yi -= buth + but_margin,
691 TIP_(
"Weight used by the Subdivision Surface modifier"));
695 if (has_skinradius) {
700 tot == 1 ?
IFACE_(
"Radius X:") :
IFACE_(
"Mean Radius X:"),
702 yi -= buth + but_margin,
710 TIP_(
"X radius used by Skin modifier"));
716 tot == 1 ?
IFACE_(
"Radius Y:") :
IFACE_(
"Mean Radius Y:"),
718 yi -= buth + but_margin,
726 TIP_(
"Y radius used by Skin modifier"));
735 totedgedata == 1 ?
IFACE_(
"Edge Data:") :
IFACE_(
"Edges Data:"),
737 yi -= buth + but_margin,
750 totedgedata == 1 ?
IFACE_(
"Bevel Weight:") :
IFACE_(
"Mean Bevel Weight:"),
752 yi -= buth + but_margin,
760 TIP_(
"Edge weight used by Bevel modifier"));
767 totedgedata == 1 ?
IFACE_(
"Crease:") :
IFACE_(
"Mean Crease:"),
769 yi -= buth + but_margin,
777 TIP_(
"Weight used by the Subdivision Surface modifier"));
783 else if (totcurvedata) {
785 if (totcurvedata == 1) {
791 yi -= buth + but_margin,
809 yi -= buth + but_margin,
827 yi -= buth + but_margin,
841 else if (totcurvedata > 1) {
847 yi -= buth + but_margin,
855 TIP_(
"Weight used for Soft Body Goal"));
863 yi -= buth + but_margin,
871 TIP_(
"Radius of curve control points"));
879 yi -= buth + but_margin,
887 TIP_(
"Tilt of curve control points"));
894 else if (totlattdata) {
896 if (totlattdata == 1) {
902 yi -= buth + but_margin,
916 else if (totlattdata > 1) {
922 yi -= buth + but_margin,
930 TIP_(
"Weight used for Soft Body Goal"));
961 (
float *)&ve_median_basis,
962 (
float *)&median_basis,
966 const bool apply_vcos = (tot == 1) || (
len_squared_v3(median_basis.generic.location) != 0.0f);
969 (apply_vcos || median_basis.mesh.bv_weight || median_basis.mesh.v_crease ||
970 median_basis.mesh.skin[0] || median_basis.mesh.skin[1] || median_basis.mesh.be_weight ||
971 median_basis.mesh.e_crease)) {
980 int cd_vert_bweight_offset = -1;
981 int cd_vert_crease_offset = -1;
982 int cd_vert_skin_offset = -1;
983 int cd_edge_bweight_offset = -1;
984 int cd_edge_crease_offset = -1;
986 float scale_bv_weight = 1.0f;
987 float scale_v_crease = 1.0f;
988 float scale_skin[2] = {1.0f, 1.0f};
989 float scale_be_weight = 1.0f;
990 float scale_e_crease = 1.0f;
1012 for (
int i = 0; i < 2; i++) {
1013 if (median->
skin[i]) {
1017 if (ve_median->skin[i] != median->
skin[i]) {
1018 scale_skin[i] = ve_median->skin[i] / (ve_median->skin[i] - median->
skin[i]);
1029 if (cd_vert_bweight_offset != -1) {
1034 if (cd_vert_crease_offset != -1) {
1039 if (cd_vert_skin_offset != -1) {
1043 for (
int i = 0; i < 2; i++) {
1044 if (median->
skin[i] != 0.0f) {
1046 &vs->
radius[i], tot, ve_median->skin[i], median->
skin[i], scale_skin[i]);
1094 (apply_vcos || median_basis.curve.b_weight || median_basis.curve.weight ||
1095 median_basis.curve.radius || median_basis.curve.tilt)) {
1097 *ve_median = &ve_median_basis.curve;
1107 for (
a = nu->pntsu, bezt = nu->bezt;
a--; bezt++) {
1128 else if (apply_vcos) {
1140 for (
a = nu->pntsu * nu->pntsv, bp = nu->bp;
a--; bp++) {
1166 else if ((ob->
type ==
OB_LATTICE) && (apply_vcos || median_basis.lattice.weight)) {
1168 *ve_median = &ve_median_basis.lattice;
1193 #undef TRANSFORM_MEDIAN_ARRAY_LEN
1203 const int butw = 200;
1226 const float lim = FLT_MAX;
1227 for (
int i = 0; i < 3; i++) {
1229 const char text[3] = {
'X' + i,
':',
'\0'};
1252 for (
int i = 0; i < 3; i++) {
1254 axis_mask |= (1 << i);
1267 #define B_VGRP_PNL_EDIT_SINGLE 8
1320 int subset_count, vgroup_tot;
1321 const bool *vgroup_validmap;
1337 ob, subset_type, &vgroup_tot, &subset_count);
1340 for (i = 0, dg = defbase->
first; dg; i++, dg = dg->
next) {
1342 if (vgroup_validmap[i]) {
1399 icon = (locked) ? ICON_BLANK1 : ICON_PASTEDOWN;
1401 "OBJECT_OT_vertex_weight_paste",
1411 icon = (locked) ? ICON_LOCKED : ICON_X;
1413 "OBJECT_OT_vertex_weight_delete",
1444 TIP_(
"Normalize weights of active vertex (if affected groups are unlocked)"));
1460 TIP_(
"Copy active vertex to other selected vertices (if affected groups are unlocked)"));
1473 if (
ptr->
type == &RNA_PoseBone) {
1478 bone = boneptr.
data;
1485 uiItemL(colsub,
"", ICON_NONE);
1491 ICON_DECORATE_UNLOCKED);
1498 uiItemR(colsub,
ptr,
"rotation_quaternion", 0,
IFACE_(
"Rotation"), ICON_NONE);
1508 ICON_DECORATE_UNLOCKED);
1511 uiItemL(colsub,
"", ICON_NONE);
1518 ICON_DECORATE_UNLOCKED);
1522 uiItemR(colsub,
ptr,
"rotation_axis_angle", 0,
IFACE_(
"Rotation"), ICON_NONE);
1532 ICON_DECORATE_UNLOCKED);
1535 uiItemL(colsub,
"", ICON_NONE);
1542 ICON_DECORATE_UNLOCKED);
1549 uiItemL(colsub,
"", ICON_NONE);
1555 ICON_DECORATE_UNLOCKED);
1558 uiItemR(layout,
ptr,
"rotation_mode", 0,
"", ICON_NONE);
1565 uiItemL(colsub,
"", ICON_NONE);
1571 ICON_DECORATE_UNLOCKED);
1606 if (!ebone || (ebone->
layer & arm->
layer) == 0) {
1617 uiItemR(
col, &parptr,
"tail_radius", 0,
IFACE_(
"Radius (Parent)"), ICON_NONE);
1628 uiItemR(
col, &eboneptr,
"envelope_distance", 0,
IFACE_(
"Envelope"), ICON_NONE);
1637 if (!mball || !(mball->
lastelem)) {
1770 strcpy(pt->
idname,
"VIEW3D_PT_transform");
1771 strcpy(pt->
label,
N_(
"Transform"));
1779 strcpy(pt->
idname,
"VIEW3D_PT_vgroup");
1780 strcpy(pt->
label,
N_(
"Vertex Weights"));
1790 strcpy(mt->
idname,
"VIEW3D_MT_collection");
1791 strcpy(mt->
label,
N_(
"Collection"));
1815 ot->
name =
"Object Mode Menu";
1816 ot->
idname =
"VIEW3D_OT_object_mode_pie_or_toggle";
typedef float(TangentPoint)[2]
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_active_if_layer_visible(struct Object *ob)
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
struct ListBase * BKE_curve_editNurbs_get(struct Curve *cu)
void BKE_nurb_project_2d(struct Nurb *nu)
void BKE_nurb_handles_test(struct Nurb *nu, bool use_handles, bool use_around_local)
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset(const struct CustomData *data, int type)
void BKE_editmesh_looptri_and_normals_calc_with_partial(BMEditMesh *em, struct BMPartialUpdate *bmpinfo)
General operations, lookup, etc. for blender objects.
void BKE_object_dimensions_get(struct Object *ob, float r_vec[3])
bool BKE_object_is_in_wpaint_select_vert(const struct Object *ob)
bool BKE_object_is_in_editmode_vgroup(const struct Object *ob)
void BKE_object_dimensions_set_ex(struct Object *ob, const float value[3], int axis_mask, const float ob_scale_orig[3], const float ob_obmat_orig[4][4])
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)
bool invert_m4_m4(float R[4][4], const float A[4][4])
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])
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 BLT_I18NCONTEXT_DEFAULT_BPYRNA
void DEG_id_tag_update(struct ID *id, int flag)
Object is a sort of wrapper for general info.
#define OB_TYPE_SUPPORT_EDITMODE(_type)
#define OBEDIT_FROM_OBACT(ob)
#define OBACT(_view_layer)
struct MDeformVert * ED_mesh_active_dvert_get_only(struct Object *ob)
void ED_vgroup_vert_active_mirror(struct Object *ob, int def_nr)
bool ED_object_mode_set(struct bContext *C, eObjectMode mode)
void ED_collection_hide_menu_draw(const struct bContext *C, struct uiLayout *layout)
void ED_area_tag_redraw(ScrArea *area)
bool ED_operator_view3d_active(struct bContext *C)
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
#define RNA_TRANSLATION_PREC_DEFAULT
void uiLayoutSetActive(uiLayout *layout, bool active)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
@ UI_EMBOSS_NONE_OR_STATUS
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void UI_block_interaction_set(uiBlock *block, uiBlockInteraction_CallbackData *callbacks)
uiBut * uiDefBut(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
uiBut * uiDefButF(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
struct PointerRNA * UI_but_operator_ptr_get(uiBut *but)
void uiItemL(uiLayout *layout, const char *name, int icon)
void UI_but_drawflag_enable(uiBut *but, int flag)
uiBlock * uiLayoutAbsoluteBlock(uiLayout *layout)
void UI_but_number_step_size_set(uiBut *but, float step_size)
void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
uiBut * uiDefButR(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
uiBut * uiDefButBitS(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
void UI_block_align_begin(uiBlock *block)
void uiLayoutSetEmboss(uiLayout *layout, eUIEmbossType emboss)
uiLayout * uiLayoutSplit(uiLayout *layout, float percentage, bool align)
void uiItemFullO(uiLayout *layout, const char *opname, const char *name, int icon, struct IDProperty *properties, wmOperatorCallContext context, int flag, struct PointerRNA *r_opptr)
uiBut * uiDefButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, wmOperatorCallContext opcontext, const char *str, int x, int y, short width, short height, const char *tip)
void UI_but_number_precision_set(uiBut *but, float precision)
void UI_but_unit_type_set(uiBut *but, int unit_type)
void UI_but_flag_enable(uiBut *but, int flag)
int UI_pie_menu_invoke(struct bContext *C, const char *idname, const struct wmEvent *event)
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)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_cd_flag_ensure(BMesh *bm, Mesh *mesh, const char cd_flag)
void BM_mesh_partial_destroy(BMPartialUpdate *bmpinfo)
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(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
static const float tilt_limit
struct EditLatt * editlatt
struct BMEditMesh * edit_mesh
void(* draw)(const struct bContext *C, struct Panel *panel)
bool(* poll)(const struct bContext *C, struct PanelType *pt)
char idname[BKE_ST_MAXNAME]
char translation_context[BKE_ST_MAXNAME]
char category[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
struct ToolSettings * toolsettings
void * properties_storage
struct EditBone * act_edbone
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) 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)