69 for (defgroup = inbase->
first; defgroup; defgroup = defgroup->
next) {
96 const bool *vgroup_subset,
100 for (defgroup = 0; defgroup < vgroup_tot; defgroup++) {
101 if (vgroup_subset[defgroup]) {
109 const bool *vgroup_subset,
110 const int vgroup_tot,
112 const int flip_map_len)
115 for (defgroup = 0; defgroup < vgroup_tot && defgroup < flip_map_len; defgroup++) {
116 if (vgroup_subset[defgroup] && (dvert_dst != dvert_src || flip_map[defgroup] != defgroup)) {
146 const int defgroup_dst,
148 const int defgroup_src)
173 for (
int i = 0; i < dvert_src->
totweight; i++, dw_src++) {
192 const int flip_map_len,
193 const bool use_ensure)
197 for (
int i = 0; i < dvert_src->
totweight; i++, dw_src++) {
198 if (dw_src->
def_nr < flip_map_len) {
218 for (
int i = dvert->
totweight; i != 0; i--, dw++) {
219 if (dw->
def_nr < map_len) {
228 const bool *vgroup_subset,
229 const int vgroup_tot)
236 if ((dw->
def_nr < vgroup_tot) && vgroup_subset[dw->
def_nr]) {
242 float tot_weight = 0.0f;
243 for (
int i = dvert->
totweight; i != 0; i--, dw++) {
244 if ((dw->
def_nr < vgroup_tot) && vgroup_subset[dw->
def_nr]) {
249 if (tot_weight > 0.0f) {
250 float scalar = 1.0f / tot_weight;
252 for (
int i = dvert->
totweight; i != 0; i--, dw++) {
253 if ((dw->
def_nr < vgroup_tot) && vgroup_subset[dw->
def_nr]) {
275 float tot_weight = 0.0f;
277 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
281 if (tot_weight > 0.0f) {
282 float scalar = 1.0f / tot_weight;
283 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
294 const bool *vgroup_subset,
295 const int vgroup_tot,
296 const uint def_nr_lock)
303 if ((dw->
def_nr < vgroup_tot) && vgroup_subset[dw->
def_nr]) {
304 if (def_nr_lock != dw->
def_nr) {
313 float tot_weight = 0.0f;
314 float lock_iweight = 1.0f;
316 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
317 if ((dw->
def_nr < vgroup_tot) && vgroup_subset[dw->
def_nr]) {
318 if (dw->
def_nr != def_nr_lock) {
323 lock_iweight = (1.0f - dw_lock->
weight);
324 CLAMP(lock_iweight, 0.0f, 1.0f);
329 if (tot_weight > 0.0f) {
332 float scalar = (1.0f / tot_weight) * lock_iweight;
333 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
334 if ((dw->
def_nr < vgroup_tot) && vgroup_subset[dw->
def_nr]) {
348 const bool *vgroup_subset,
349 const int vgroup_tot,
350 const bool *lock_flags,
351 const int defbase_tot)
358 if ((dw->
def_nr < vgroup_tot) && vgroup_subset[dw->
def_nr]) {
359 if ((dw->
def_nr < defbase_tot) && (lock_flags[dw->
def_nr] ==
false)) {
367 float tot_weight = 0.0f;
368 float lock_iweight = 0.0f;
370 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
371 if ((dw->
def_nr < vgroup_tot) && vgroup_subset[dw->
def_nr]) {
372 if ((dw->
def_nr < defbase_tot) && (lock_flags[dw->
def_nr] ==
false)) {
377 lock_iweight += dw->
weight;
382 lock_iweight =
max_ff(0.0f, 1.0f - lock_iweight);
384 if (tot_weight > 0.0f) {
387 float scalar = (1.0f / tot_weight) * lock_iweight;
388 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
389 if ((dw->
def_nr < vgroup_tot) && vgroup_subset[dw->
def_nr]) {
390 if ((dw->
def_nr < defbase_tot) && (lock_flags[dw->
def_nr] ==
false)) {
407 for (dw = dvert->
dw, i = 0; i < dvert->totweight; dw++, i++) {
408 if (dw->
def_nr < flip_map_len) {
409 if (flip_map[dw->
def_nr] >= 0) {
423 for (dw = dvert->
dw, i = 0; i < totweight; dw++, i++) {
424 if (dw->
def_nr < flip_map_len) {
425 if (flip_map[dw->
def_nr] >= 0) {
443 const ID *
id = (
const ID *)ob->
data;
501 if (name ==
NULL || name[0] ==
'\0') {
522 if (name ==
NULL || name[0] ==
'\0') {
528 if (
STREQ(name, group->name)) {
529 if (r_index !=
NULL) {
532 if (r_group !=
NULL) {
580 if (defbase_tot == 0) {
585 char name_flip[
sizeof(dg->
name)];
586 int i, flip_num, *
map =
MEM_mallocN(defbase_tot *
sizeof(
int), __func__);
588 for (i = 0; i < defbase_tot; i++) {
592 for (dg = defbase->
first, i = 0; dg; dg = dg->
next, i++) {
616 const bool use_default,
622 if (defbase_tot == 0) {
627 char name_flip[
sizeof(dg->
name)];
628 int i, flip_num, *
map =
MEM_mallocN(defbase_tot *
sizeof(
int), __func__);
630 for (i = 0; i < defbase_tot; i++) {
631 map[i] = use_default ? i : -1;
640 if (flip_num != -1) {
641 map[defgroup] = flip_num;
642 map[flip_num] = defgroup;
656 char name_flip[
sizeof(dg->
name)];
664 return (flip_index == -1 && use_default) ? index : flip_index;
672 for (curdef = defbase->
first; curdef; curdef = curdef->
next) {
707 return dw ? dw->
weight : 0.0f;
719 if (defgroup == -1) {
731 if (dvert && defgroup >= 0) {
735 for (i = dvert->
totweight; i != 0; i--, dw++) {
736 if (dw->
def_nr == defgroup) {
753 if (!dvert || defgroup < 0) {
771 dw_new->
def_nr = defgroup;
786 if (!dvert || defgroup < 0) {
792 "defvert_add_to group, new deformWeight");
800 dw_new->
def_nr = defgroup;
807 int i = dw - dvert->
dw;
848 for (i = dvert_a->
totweight; i != 0; i--, dw++) {
861 for (
int i = dvert->
totweight; i != 0; i--, dw++) {
874 const bool *defbase_sel)
879 if (defbase_sel ==
NULL) {
883 for (
int i = dv->
totweight; i != 0; i--, dw++) {
884 if (dw->
def_nr < defbase_tot) {
885 if (defbase_sel[dw->
def_nr]) {
896 const bool *defbase_sel,
904 if (!is_normalized) {
905 total /= defbase_tot_sel;
913 float unlocked_weight)
916 if (unlocked_weight > 0.0f) {
917 return weight / unlocked_weight;
921 if (locked_weight <= 0.0f) {
927 if (weight != 0.0f) {
936 return weight / (1.0f - locked_weight);
942 const bool *defbase_locked,
943 const bool *defbase_unlocked)
947 if (unlocked > 0.0f) {
948 return weight / unlocked;
970 for (
int i = 0; i < totvert; i++) {
989 for (
int i = 0; i < totvert; i++) {
1013 const int num_verts,
1014 const bool invert_vgroup,
1017 if (dvert && defgroup != -1) {
1022 r_weights[i] = invert_vgroup ? (1.0f -
w) :
w;
1026 copy_vn_fl(r_weights, num_verts, invert_vgroup ? 1.0f : 0.0f);
1032 const int num_verts,
1034 const int num_edges,
1035 const bool invert_vgroup,
1038 if (dvert && defgroup != -1) {
1040 float *tmp_weights =
MEM_mallocN(
sizeof(*tmp_weights) * (
size_t)num_verts, __func__);
1043 dvert, defgroup, num_verts, invert_vgroup, tmp_weights);
1046 MEdge *me = &edges[i];
1048 r_weights[i] = (tmp_weights[me->
v1] + tmp_weights[me->
v2]) * 0.5f;
1060 const int num_verts,
1062 const int num_loops,
1063 const bool invert_vgroup,
1066 if (dvert && defgroup != -1) {
1068 float *tmp_weights =
MEM_mallocN(
sizeof(*tmp_weights) * (
size_t)num_verts, __func__);
1071 dvert, defgroup, num_verts, invert_vgroup, tmp_weights);
1074 MLoop *ml = &loops[i];
1076 r_weights[i] = tmp_weights[ml->
v];
1088 const int num_verts,
1090 const int UNUSED(num_loops),
1092 const int num_polys,
1093 const bool invert_vgroup,
1096 if (dvert && defgroup != -1) {
1098 float *tmp_weights =
MEM_mallocN(
sizeof(*tmp_weights) * (
size_t)num_verts, __func__);
1101 dvert, defgroup, num_verts, invert_vgroup, tmp_weights);
1104 MPoly *mp = &polys[i];
1110 w += tmp_weights[ml->
v];
1130 const void **sources,
1131 const float *weights,
1133 const float mix_factor)
1140 const int mix_mode = laymap->
mix_mode;
1146 float weight_src = 0.0f, weight_dst = 0.0f;
1148 bool has_dw_sources =
false;
1150 for (i =
count; i--;) {
1151 for (j = data_src[i]->totweight; j--;) {
1152 if ((dw_src = &data_src[i]->dw[j])->def_nr == idx_src) {
1153 weight_src += dw_src->
weight * weights[i];
1154 has_dw_sources =
true;
1162 weight_dst = dw_dst->
weight;
1170 CLAMP(weight_src, 0.0f, 1.0f);
1173 if (!has_dw_sources) {
1176 dw_dst->
weight = weight_src;
1183 dw_dst->
weight = weight_src;
1189 const float mix_factor,
1190 const float *mix_weights,
1191 const int num_elem_dst,
1192 const bool use_create,
1193 const bool use_delete,
1200 const bool UNUSED(use_dupref_dst),
1202 const bool *use_layers_src,
1203 const int num_layers_src)
1219 idx_src = num_layers_src;
1220 while (idx_src-- && !use_layers_src[idx_src]) {
1225 if (idx_dst < idx_src) {
1228 for (; idx_dst < idx_src; idx_dst++) {
1237 else if (use_delete && idx_dst > idx_src) {
1238 while (idx_dst-- > idx_src) {
1250 if (!use_layers_src[idx_src]) {
1276 for (dg_dst = dst_defbase->
first; dg_dst;) {
1282 dg_dst = dg_dst_next;
1286 for (idx_src = 0, dg_src = src_list->
first; idx_src < num_layers_src;
1287 idx_src++, dg_src = dg_src->
next) {
1288 if (!use_layers_src[idx_src]) {
1337 const float mix_factor,
1338 const float *mix_weights,
1339 const int num_elem_dst,
1340 const bool use_create,
1341 const bool use_delete,
1346 const bool use_dupref_dst,
1347 const int fromlayers,
1350 int idx_src, idx_dst;
1375 if (data_dst && use_dupref_dst && r_map) {
1383 if (fromlayers >= 0) {
1384 idx_src = fromlayers;
1396 if (tolayers >= 0) {
1417 if (num <= idx_dst) {
1422 for (; num <= idx_dst; num++) {
1466 int num_src, num_sel_unused;
1467 bool *use_layers_src =
NULL;
1470 switch (fromlayers) {
1485 if (use_layers_src) {
1520 const float blend = ((weight / 2.0f) + 0.5f);
1522 if (weight <= 0.25f) {
1524 r_rgb[1] =
blend * weight * 4.0f;
1527 else if (weight <= 0.50f) {
1530 r_rgb[2] =
blend * (1.0f - ((weight - 0.25f) * 4.0f));
1532 else if (weight <= 0.75f) {
1533 r_rgb[0] =
blend * ((weight - 0.50f) * 4.0f);
1537 else if (weight <= 1.0f) {
1539 r_rgb[1] =
blend * (1.0f - ((weight - 0.75f) * 4.0f));
1566 if (dvlist ==
NULL) {
1574 for (
int i = 0; i <
count; i++) {
1583 if (mdverts ==
NULL) {
1587 for (
int i =
count; i > 0; i--, mdverts++) {
1593 memcpy(dw_tmp, dw, dw_len);
1594 mdverts->
dw = dw_tmp;
typedef float(TangentPoint)[2]
CustomData interface, see also DNA_customdata_types.h.
void * CustomData_get_layer(const struct CustomData *data, int type)
@ CDT_MIX_REPLACE_ABOVE_THRESHOLD
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
void * CustomData_duplicate_referenced_layer(struct CustomData *data, int type, int totelem)
@ DT_LAYERS_VGROUP_SRC_BONE_SELECT
@ DT_LAYERS_VGROUP_SRC_BONE_DEFORM
General operations, lookup, etc. for blender objects.
void BKE_object_batch_cache_dirty_tag(struct Object *ob)
#define BLI_assert_unreachable()
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
void copy_vn_fl(float *array_tar, int size, float val)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
bool BLI_uniquename_cb(UniquenameCheckCallback unique_check, void *arg, const char *defname, char delim, char *name, size_t name_len)
size_t BLI_string_flip_side_name(char *r_name, const char *from_name, bool strip_number, size_t name_len)
#define UNUSED_VARS_NDEBUG(...)
#define BLO_write_struct(writer, struct_name, data_ptr)
void * BLO_read_get_new_data_address(BlendDataReader *reader, const void *old_address)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
struct MDeformWeight MDeformWeight
Object is a sort of wrapper for general info.
#define OB_TYPE_SUPPORT_VGROUP(_type)
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
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
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void data_transfer_layersmapping_add_item(ListBase *r_map, const int cddata_type, const int mix_mode, const float mix_factor, const float *mix_weights, const void *data_src, void *data_dst, const int data_src_n, const int data_dst_n, const size_t elem_size, const size_t data_size, const size_t data_offset, const uint64_t data_flag, cd_datatransfer_interp interp, void *interp_data)
float data_transfer_interp_float_do(const int mix_mode, const float val_dst, const float val_src, const float mix_factor)
SyclQueue void void * src
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
SocketIndexByIdentifierMap * map
ListBase vertex_group_names
int vertex_group_active_index
ListBase vertex_group_names
int vertex_group_active_index
ListBase vertex_group_names
int vertex_group_active_index
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)