60 if (mesh ==
nullptr || mesh->faces_num == 0) {
65 if (mesh->deform_verts().is_empty()) {
73 if (mesh->vertex_group_active_index <= 0) {
90 mesh->vertex_group_active_index = actdef;
102 if (mesh->vertex_group_active_index <= 0) {
108 vgroup_index->
active = mesh->vertex_group_active_index - 1;
115 vgroup_index->
mirror = mirror;
155 const float talpha = std::min(alpha, 1.0f);
156 return (paintval * talpha) + (weight * (1.0f - talpha));
160 return weight + (paintval * alpha);
164 return weight - (paintval * alpha);
168 return ((1.0f - alpha) + (alpha * paintval)) * weight;
172 return (weight < paintval) ?
wval_blend(weight, paintval, alpha) : weight;
176 return (weight > paintval) ?
wval_blend(weight, paintval, alpha) : weight;
187 temp = (paintval == 1.0f) ? 1.0f :
188 std::min((weight * (225.0f / 255.0f)) / (1.0f - paintval), 1.0f);
189 return mfac * weight + temp * fac;
198 temp =
fabsf(weight - paintval);
199 return mfac * weight + temp * fac;
208 temp = std::max(1.0f - ((1.0f - weight) * (1.0f - paintval)), 0.0f);
209 return mfac * weight + temp * fac;
218 if (paintval > 0.5f) {
219 temp = 1.0f - ((1.0f - 2.0f * (paintval - 0.5f)) * (1.0f - weight));
222 temp = (2.0f * paintval * weight);
224 return mfac * weight + temp * fac;
234 temp = 1.0f - ((1.0f - 2.0f * (weight - 0.5f)) * (1.0f - paintval));
237 temp = (2.0f * paintval * weight);
239 return mfac * weight + temp * fac;
249 temp = ((2.0f * ((paintval / 2.0f) + 0.25f)) * weight);
252 temp = 1.0f - (2.0f * (1.0f - ((paintval / 2.0f) + 0.25f)) * (1.0f - weight));
254 return temp * fac + weight * mfac;
263 temp = 0.5f - (2.0f * (weight - 0.5f) * (paintval - 0.5f));
264 return temp * fac + weight * mfac;
269 const float paintval,
276 return wval_add(weight, paintval, alpha);
278 return wval_sub(weight, paintval, alpha);
280 return wval_mul(weight, paintval, alpha);
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
Object * CTX_data_active_object(const bContext *C)
Main * CTX_data_main(const bContext *C)
Mesh * BKE_mesh_from_object(Object *ob)
Object * BKE_modifiers_is_deformed_by_armature(Object *ob)
General operations, lookup, etc. for blender objects.
bool BKE_object_is_in_editmode(const Object *ob)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
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
void DEG_relations_tag_update(Main *bmain)
#define ME_USING_MIRROR_X_VERTEX_GROUPS(_me)
Object is a sort of wrapper for general info.
BLI_INLINE float wval_screen(float weight, float paintval, float fac)
BLI_INLINE float wval_softlight(float weight, float paintval, float fac)
BLI_INLINE float wval_difference(float weight, float paintval, float fac)
bool ED_wpaint_ensure_data(bContext *C, ReportList *reports, eWPaintFlag flag, WPaintVGroupIndex *vgroup_index)
BLI_INLINE float wval_colordodge(float weight, float paintval, float fac)
float ED_wpaint_blend_tool(const int tool, const float weight, const float paintval, const float alpha)
BLI_INLINE float wval_blend(const float weight, const float paintval, const float alpha)
BLI_INLINE float wval_lighten(const float weight, const float paintval, const float alpha)
BLI_INLINE float wval_overlay(float weight, float paintval, float fac)
BLI_INLINE float wval_mul(const float weight, const float paintval, const float alpha)
BLI_INLINE float wval_darken(const float weight, const float paintval, const float alpha)
BLI_INLINE float wval_add(const float weight, const float paintval, const float alpha)
BLI_INLINE float wval_exclusion(float weight, float paintval, float fac)
BLI_INLINE float wval_hardlight(float weight, float paintval, float fac)
BLI_INLINE float wval_sub(const float weight, const float paintval, const float alpha)
int ED_wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)