Blender  V3.3
Classes
paint_vertex_weight_ops.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_bitmap.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "DNA_brush_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "BKE_brush.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
#include "BKE_modifier.h"
#include "BKE_object_deform.h"
#include "BKE_paint.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_armature.h"
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "paint_intern.h"

Go to the source code of this file.

Classes

struct  WPaintPrev
 
struct  WPGradient_vertStore
 
struct  WPGradient_vertStoreBase
 
struct  WPGradient_userData
 

Functions

Store Previous Weights

Use to avoid feedback loop w/ mirrored edits.

static void wpaint_prev_init (struct WPaintPrev *wpp)
 
static void wpaint_prev_create (struct WPaintPrev *wpp, MDeformVert *dverts, int dcount)
 
static void wpaint_prev_destroy (struct WPaintPrev *wpp)
 
Weight from Bones Operator
static bool weight_from_bones_poll (bContext *C)
 
static int weight_from_bones_exec (bContext *C, wmOperator *op)
 
void PAINT_OT_weight_from_bones (wmOperatorType *ot)
 
Sample Weight Operator
static int weight_sample_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void PAINT_OT_weight_sample (wmOperatorType *ot)
 
Weight Paint Sample Group Operator
static bool weight_paint_sample_enum_itemf__helper (const MDeformVert *dvert, const int defbase_tot, int *groups)
 
static const EnumPropertyItemweight_paint_sample_enum_itemf (bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
 
static int weight_sample_group_exec (bContext *C, wmOperator *op)
 
void PAINT_OT_weight_sample_group (wmOperatorType *ot)
 
Weight Set Operator
static bool weight_paint_set (Object *ob, float paintweight)
 
static int weight_paint_set_exec (bContext *C, wmOperator *op)
 
void PAINT_OT_weight_set (wmOperatorType *ot)
 

Interactive Weight Gradient Operator

typedef struct WPGradient_vertStore WPGradient_vertStore
 
typedef struct WPGradient_vertStoreBase WPGradient_vertStoreBase
 
typedef struct WPGradient_userData WPGradient_userData
 
static void gradientVert_update (WPGradient_userData *grad_data, int index)
 
static void gradientVertUpdate__mapFunc (void *userData, int index, const float UNUSED(co[3]), const float UNUSED(no[3]))
 
static void gradientVertInit__mapFunc (void *userData, int index, const float co[3], const float UNUSED(no[3]))
 
static int paint_weight_gradient_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static int paint_weight_gradient_exec (bContext *C, wmOperator *op)
 
static int paint_weight_gradient_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void PAINT_OT_weight_gradient (wmOperatorType *ot)
 

Typedef Documentation

◆ WPGradient_userData

◆ WPGradient_vertStore

◆ WPGradient_vertStoreBase

Function Documentation

◆ gradientVert_update()

static void gradientVert_update ( WPGradient_userData grad_data,
int  index 
)
static

◆ gradientVertInit__mapFunc()

static void gradientVertInit__mapFunc ( void userData,
int  index,
const float  co[3],
const float   UNUSEDno[3] 
)
static

◆ gradientVertUpdate__mapFunc()

static void gradientVertUpdate__mapFunc ( void userData,
int  index,
const float   UNUSEDco[3],
const float   UNUSEDno[3] 
)
static

◆ PAINT_OT_weight_from_bones()

void PAINT_OT_weight_from_bones ( wmOperatorType ot)

◆ PAINT_OT_weight_gradient()

void PAINT_OT_weight_gradient ( wmOperatorType ot)

◆ PAINT_OT_weight_sample()

void PAINT_OT_weight_sample ( wmOperatorType ot)

◆ PAINT_OT_weight_sample_group()

void PAINT_OT_weight_sample_group ( wmOperatorType ot)

◆ PAINT_OT_weight_set()

void PAINT_OT_weight_set ( wmOperatorType ot)

◆ paint_weight_gradient_exec()

static int paint_weight_gradient_exec ( bContext C,
wmOperator op 
)
static

Definition at line 748 of file paint_vertex_weight_ops.c.

References ToolSettings::auto_normalize, BKE_brush_weight_get(), BKE_curvemapping_init(), BKE_defvert_normalize_lock_map(), BKE_defvert_normalize_lock_single(), BKE_mesh_flush_select_from_polys(), BKE_mesh_foreach_mapped_vert(), BKE_object_defgroup_active_index_get(), BKE_object_defgroup_lock_flags_get(), BKE_object_defgroup_validmap_get(), BKE_paint_brush(), BLI_BITMAP_NEW, BLI_listbase_count(), C, CD_MASK_ORIGINDEX, CTX_data_active_object(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_scene(), CTX_data_tool_settings(), CTX_wm_region(), Brush::curve, wmOperator::customdata, Scene::customdata_mask, data, Object::data, wmGenericUserData::data, DEG_get_evaluated_object(), DEG_get_evaluated_scene(), DEG_id_tag_update(), depsgraph, Mesh::dvert, ED_view3d_init_mats_rv3d(), ED_wpaint_ensure_data(), Mesh::editflag, CustomData_MeshMasks::emask, VPaint::flag, gradientVertInit__mapFunc(), gradientVertUpdate__mapFunc(), Object::id, ID_RECALC_GEOMETRY, len_v2v2(), ME_EDIT_PAINT_FACE_SEL, ME_EDIT_PAINT_VERT_SEL, MEM_freeN, MEM_mallocN, MESH_FOREACH_NOP, mesh_get_eval_final(), NC_OBJECT, ND_DRAW, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, VPaint::paint, CustomData_MeshMasks::pmask, wmOperator::ptr, ARegion::regiondata, wmOperator::reports, RNA_enum_get(), RNA_int_get(), scene, Scene::toolsettings, Mesh::totvert, wmGenericUserData::use_free, wmGesture::user_data, Mesh::vertex_group_names, CustomData_MeshMasks::vmask, VP_FLAG_VGROUP_RESTRICT, WM_event_add_notifier(), ToolSettings::wpaint, and wpaint_prev_create().

Referenced by PAINT_OT_weight_gradient().

◆ paint_weight_gradient_invoke()

static int paint_weight_gradient_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ paint_weight_gradient_modal()

static int paint_weight_gradient_modal ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ weight_from_bones_exec()

static int weight_from_bones_exec ( bContext C,
wmOperator op 
)
static

◆ weight_from_bones_poll()

static bool weight_from_bones_poll ( bContext C)
static

◆ weight_paint_sample_enum_itemf()

static const EnumPropertyItem* weight_paint_sample_enum_itemf ( bContext C,
PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
bool r_free 
)
static

◆ weight_paint_sample_enum_itemf__helper()

static bool weight_paint_sample_enum_itemf__helper ( const MDeformVert dvert,
const int  defbase_tot,
int *  groups 
)
static

◆ weight_paint_set()

static bool weight_paint_set ( Object ob,
float  paintweight 
)
static

◆ weight_paint_set_exec()

static int weight_paint_set_exec ( bContext C,
wmOperator op 
)
static

◆ weight_sample_group_exec()

static int weight_sample_group_exec ( bContext C,
wmOperator op 
)
static

◆ weight_sample_invoke()

static int weight_sample_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

Sets wp->weight to the closest weight value to vertex.

Note
we can't sample front-buffer, weight colors are interpolated too unpredictable.

Definition at line 162 of file paint_vertex_weight_ops.c.

References ToolSettings::auto_normalize, BKE_brush_weight_set(), BKE_defvert_find_weight(), BKE_defvert_lock_relative_weight(), BKE_defvert_multipaint_collective_weight(), BKE_mesh_from_object(), BKE_object_defgroup_check_lock_relative(), BKE_object_defgroup_check_lock_relative_multi(), BKE_object_defgroup_lock_flags_get(), BKE_object_defgroup_mirror_selection(), BKE_object_defgroup_selected_get(), BKE_object_defgroup_split_locked_validmap(), BKE_object_defgroup_validmap_get(), BKE_paint_brush(), BKE_report(), BLI_listbase_count(), C, CLAMP, CTX_data_ensure_evaluated_depsgraph(), depsgraph, Mesh::dvert, ED_MESH_PICK_DEFAULT_FACE_DIST, ED_MESH_PICK_DEFAULT_VERT_DIST, ED_mesh_pick_face(), ED_mesh_pick_face_vert(), ED_mesh_pick_vert(), ED_view3d_init_mats_rv3d(), ED_view3d_viewcontext_init(), Mesh::editflag, ME_EDIT_PAINT_VERT_SEL, ME_USING_MIRROR_X_VERTEX_GROUPS, MEM_freeN, MEM_SAFE_FREE, ToolSettings::multipaint, wmEvent::mval, NA_EDITED, NC_BRUSH, NULL, ViewContext::obact, OPERATOR_CANCELLED, OPERATOR_FINISHED, VPaint::paint, wmOperator::reports, RPT_WARNING, ViewContext::rv3d, ViewContext::scene, Scene::toolsettings, ViewContext::v3d, Mesh::vertex_group_active_index, Mesh::vertex_group_names, view3d_operator_needs_opengl(), WM_main_add_notifier(), ToolSettings::wpaint, and ToolSettings::wpaint_lock_relative.

Referenced by PAINT_OT_weight_sample().

◆ wpaint_prev_create()

static void wpaint_prev_create ( struct WPaintPrev wpp,
MDeformVert dverts,
int  dcount 
)
static

◆ wpaint_prev_destroy()

static void wpaint_prev_destroy ( struct WPaintPrev wpp)
static

◆ wpaint_prev_init()

static void wpaint_prev_init ( struct WPaintPrev wpp)
static

Definition at line 61 of file paint_vertex_weight_ops.c.

References NULL, WPaintPrev::tot, and WPaintPrev::wpaint_prev.

Referenced by wpaint_prev_create().