Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
| Context not available. | |||||
| Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
ankitm: Probably a mistake to add an empty line | |||||
| WPGradient_userData data = {NULL}; | WPGradient_userData data = {NULL}; | ||||
| if (is_interactive) { | if (is_interactive) { | ||||
| Context not available. | |||||
| MEM_freeN(vert_cache); | MEM_freeN(vert_cache); | ||||
| } | } | ||||
| /*fix : Weight subtraction on using gradient tool*/ | |||||
ankitmUnsubmitted Done Inline ActionsRemove "fix". Comment to concisely describe what the code below does is fine. ankitm: Remove "fix". Comment to concisely describe what the code below does is fine. | |||||
Done Inline Actionsvc is only used to access scene use: Scene *scene = CTX_data_scene(C); instead. campbellbarton: `vc` is only used to access `scene` use: `Scene *scene = CTX_data_scene(C);` instead. | |||||
| ViewContext vc; | |||||
| int i, vGroup_tot, def_nr_lock; | |||||
| bool is_normalize; | |||||
Done Inline ActionsThis should be initialized from BKE_object_defgroup_validmap_get. campbellbarton: This should be initialized from `BKE_object_defgroup_validmap_get`. | |||||
Not Done Inline ActionsMy mistake, that functions checks bones, this should be BKE_object_defgroup_lock_flags_get - to respect the groups lock icon. campbellbarton: My mistake, that functions checks bones, this should be `BKE_object_defgroup_lock_flags_get`… | |||||
| MDeformVert *dvert, *dv , *dVert_array; | |||||
ankitmUnsubmitted Done Inline ActionsDon't declare uninitialized variables. ankitm: Don't declare uninitialized variables. | |||||
| ED_view3d_viewcontext_init(C, &vc, depsgraph); | |||||
| vGroup_tot = BLI_listbase_count(&ob->defbase); | |||||
Done Inline ActionsThis needs to be freed. campbellbarton: This needs to be freed. | |||||
| is_normalize = vc.scene->toolsettings->auto_normalize; | |||||
ankitmUnsubmitted Done Inline Actionsconst bool is_normalize ankitm: `const bool is_normalize` | |||||
| dvert = me->dvert; | |||||
| def_nr_lock = ob->actdef - 1; | |||||
| if (is_normalize) { | |||||
| for (i = 0; i < me->totvert; i++) { | |||||
| dv = (dvert + i); | |||||
Done Inline ActionsThis is unnecessary data.vert_visit is already created and freed above (line 840 without this patch applied). campbellbarton: This is unnecessary `data.vert_visit` is already created and freed above (line 840 without this… | |||||
| MDeformWeight *dw = dv->dw; | |||||
| BKE_devert_normalize_gradient_paint(dv , dw , vGroup_tot , def_nr_lock); | |||||
| } | |||||
ankitmUnsubmitted Done Inline Actions4 empty lines seem overdone here ankitm: 4 empty lines seem overdone here | |||||
Done Inline ActionsThis entire block can be in an if (is_normalized) {...} check. campbellbarton: This entire block can be in an `if (is_normalized) {...}` check. | |||||
| } | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| Context not available. | |||||
Probably a mistake to add an empty line