71 if (
mesh ==
nullptr ||
mesh->faces_num == 0) {
76 if (
mesh->deform_verts().is_empty()) {
84 if (
mesh->vertex_group_active_index <= 0) {
87 Bone *actbone = (id_cast<bArmature *>(modob->
data))->act_bone;
101 mesh->vertex_group_active_index = actdef;
107 if (defbase->is_empty()) {
113 if (
mesh->vertex_group_active_index <= 0) {
119 vgroup_index->
active =
mesh->vertex_group_active_index - 1;
126 vgroup_index->
mirror = mirror;
149 mirrdef = defbase->count() - 1;
166 const float talpha = std::min(alpha, 1.0f);
167 return (paintval * talpha) + (weight * (1.0f - talpha));
171 return weight + (paintval * alpha);
175 return weight - (paintval * alpha);
179 return ((1.0f - alpha) + (alpha * paintval)) * weight;
183 return (weight < paintval) ?
wval_blend(weight, paintval, alpha) : weight;
187 return (weight > paintval) ?
wval_blend(weight, paintval, alpha) : weight;
198 temp = (paintval == 1.0f) ? 1.0f :
199 std::min((weight * (225.0f / 255.0f)) / (1.0f - paintval), 1.0f);
200 return mfac * weight + temp * fac;
209 temp =
fabsf(weight - paintval);
210 return mfac * weight + temp * fac;
219 temp = std::max(1.0f - ((1.0f - weight) * (1.0f - paintval)), 0.0f);
220 return mfac * weight + temp * fac;
229 if (paintval > 0.5f) {
230 temp = 1.0f - ((1.0f - 2.0f * (paintval - 0.5f)) * (1.0f - weight));
233 temp = (2.0f * paintval * weight);
235 return mfac * weight + temp * fac;
245 temp = 1.0f - ((1.0f - 2.0f * (weight - 0.5f)) * (1.0f - paintval));
248 temp = (2.0f * paintval * weight);
250 return mfac * weight + temp * fac;
260 temp = ((2.0f * ((paintval / 2.0f) + 0.25f)) * weight);
263 temp = 1.0f - (2.0f * (1.0f - ((paintval / 2.0f) + 0.25f)) * (1.0f - weight));
265 return temp * fac + weight * mfac;
274 temp = 0.5f - (2.0f * (weight - 0.5f) * (paintval - 0.5f));
275 return temp * fac + weight * mfac;
280 const float paintval,
287 return wval_add(weight, paintval, alpha);
289 return wval_sub(weight, paintval, alpha);
291 return wval_mul(weight, paintval, alpha);
Blender kernel action and pose functionality.
General operations, lookup, etc. for blender objects.
#define ME_USING_MIRROR_X_VERTEX_GROUPS(_me)
Object is a sort of wrapper for general info.
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
struct MDeformVert * BKE_object_defgroup_data_create(struct ID *id)
BLI_INLINE float wval_sub(const float weight, const float paintval, const float alpha)
BLI_INLINE float wval_darken(const float weight, const float paintval, const float alpha)
bool ED_wpaint_ensure_data(bContext *C, ReportList *reports, eWPaintFlag flag, WPaintVGroupIndex *vgroup_index)
const ListBaseT< bDeformGroup > * BKE_object_defgroup_list(const Object *ob)
BLI_INLINE float wval_screen(float weight, float paintval, float fac)
BLI_INLINE float wval_lighten(const float weight, const float paintval, const float alpha)
bDeformGroup * BKE_object_defgroup_find_name(const Object *ob, StringRef name)
BLI_INLINE float wval_add(const float weight, const float paintval, const float alpha)
Object * BKE_modifiers_is_deformed_by_armature(Object *ob)
BLI_INLINE float wval_mul(const float weight, const float paintval, const float alpha)
BLI_INLINE float wval_blend(const float weight, const float paintval, const float alpha)
int ED_wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE float wval_colordodge(float weight, float paintval, float fac)
BLI_INLINE float wval_hardlight(float weight, float paintval, float fac)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Mesh * BKE_mesh_from_object(Object *ob)
BLI_INLINE float wval_overlay(float weight, float paintval, float fac)
BLI_INLINE float wval_softlight(float weight, float paintval, float fac)
int BKE_object_defgroup_name_index(const Object *ob, StringRef name)
struct bDeformGroup * BKE_object_defgroup_add_name(struct Object *ob, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
BLI_INLINE float wval_difference(float weight, float paintval, float fac)
bool BKE_object_is_in_editmode(const Object *ob)
Main * CTX_data_main(const bContext *C)
bDeformGroup * BKE_object_defgroup_new(Object *ob, StringRef name)
struct bDeformGroup * BKE_object_defgroup_add(struct Object *ob)
float ED_wpaint_blend_tool(const int tool, const float weight, const float paintval, const float alpha)
void DEG_relations_tag_update(Main *bmain)
Object * CTX_data_active_object(const bContext *C)
BLI_INLINE float wval_exclusion(float weight, float paintval, float fac)
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
size_t BLI_string_flip_side_name(char *name_dst, const char *name_src, bool strip_number, size_t name_dst_maxncpy) ATTR_NONNULL(1