diff options
Diffstat (limited to 'source/blender/editors/object/object_vgroup.c')
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index c6c20182ac3..fcb2d45f73b 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -769,7 +769,7 @@ static void ED_vgroup_nr_vert_add( /* get the vert */ BKE_object_defgroup_array_get(ob->data, &dvert, &tot); - + if (dvert == NULL) return; @@ -934,7 +934,7 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum) dv = <->dvert[vertnum]; } } - + if (dv) { MDeformWeight *dw = defvert_find_index(dv, def_nr); if (dw) { @@ -1021,12 +1021,12 @@ static void vgroup_select_verts(Object *ob, int select) } else if (ob->type == OB_LATTICE) { Lattice *lt = vgroup_edit_lattice(ob); - + if (lt->dvert) { MDeformVert *dv; BPoint *bp, *actbp = BKE_lattice_active_point_get(lt); int a, tot; - + dv = lt->dvert; tot = lt->pntsu * lt->pntsv * lt->pntsw; @@ -1054,7 +1054,7 @@ static void vgroup_duplicate(Object *ob) dg = BLI_findlink(&ob->defbase, (ob->actdef - 1)); if (!dg) return; - + if (!strstr(dg->name, "_copy")) { BLI_snprintf(name, sizeof(name), "%s_copy", dg->name); } @@ -1124,7 +1124,7 @@ static bool vgroup_normalize(Object *ob) if (weight_max > 0.0f) { for (i = 0; i < dvert_tot; i++) { - + /* in case its not selected */ if (!(dv = dvert_array[i])) { continue; @@ -1133,7 +1133,7 @@ static bool vgroup_normalize(Object *ob) dw = defvert_find_index(dv, def_nr); if (dw) { dw->weight /= weight_max; - + /* in case of division errors with very low weights */ CLAMP(dw->weight, 0.0f, 1.0f); } @@ -1458,7 +1458,7 @@ static void moveCloserToDistanceFromPlane( MEM_freeN(dwIndices); } -/* this is used to try to smooth a surface by only adjusting the nonzero weights of a vertex +/* this is used to try to smooth a surface by only adjusting the nonzero weights of a vertex * but it could be used to raise or lower an existing 'bump.' */ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength, float cp) { @@ -1483,7 +1483,7 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength, dm->getVert(dm, verts[k], &m); p[k] = m; } - + if (count >= 3) { float d /*, dist */ /* UNUSED */, mag; float coord[3]; @@ -2638,7 +2638,7 @@ static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); - + return OPERATOR_FINISHED; } @@ -2648,7 +2648,7 @@ void OBJECT_OT_vertex_group_add(wmOperatorType *ot) ot->name = "Add Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_add"; ot->description = "Add a new vertex group to the active object"; - + /* api callbacks */ ot->poll = vertex_group_supported_poll; ot->exec = vertex_group_add_exec; @@ -2671,7 +2671,7 @@ static int vertex_group_remove_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); - + return OPERATOR_FINISHED; } @@ -2681,7 +2681,7 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot) ot->name = "Remove Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_remove"; ot->description = "Delete the active or all vertex groups from the active object"; - + /* api callbacks */ ot->poll = vertex_group_poll; ot->exec = vertex_group_remove_exec; @@ -2701,11 +2701,11 @@ static int vertex_group_assign_exec(bContext *C, wmOperator *UNUSED(op)) { ToolSettings *ts = CTX_data_tool_settings(C); Object *ob = ED_object_context(C); - + vgroup_assign_verts(ob, ts->vgroup_weight); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); - + return OPERATOR_FINISHED; } @@ -2715,7 +2715,7 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot) ot->name = "Assign to Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_assign"; ot->description = "Assign the selected vertices to the active vertex group"; - + /* api callbacks */ ot->poll = vertex_group_vert_select_unlocked_poll; ot->exec = vertex_group_assign_exec; @@ -2733,7 +2733,7 @@ static int vertex_group_assign_new_exec(bContext *C, wmOperator *op) /* create new group... */ Object *ob = ED_object_context(C); BKE_object_defgroup_add(ob); - + /* assign selection to new group */ return vertex_group_assign_exec(C, op); } @@ -2744,11 +2744,11 @@ void OBJECT_OT_vertex_group_assign_new(wmOperatorType *ot) ot->name = "Assign to New Group"; ot->idname = "OBJECT_OT_vertex_group_assign_new"; ot->description = "Assign the selected vertices to a new vertex group"; - + /* api callbacks */ ot->poll = vertex_group_vert_select_poll; ot->exec = vertex_group_assign_new_exec; - + /* flags */ /* redo operator will fail in this case because vertex group assignment * isn't stored in local edit mode stack and toggling "new" property will @@ -2890,7 +2890,7 @@ void OBJECT_OT_vertex_group_copy(wmOperatorType *ot) static int vertex_group_levels_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_context(C); - + float offset = RNA_float_get(op->ptr, "offset"); float gain = RNA_float_get(op->ptr, "gain"); eVGroupSelect subset_type = RNA_enum_get(op->ptr, "group_select_mode"); @@ -2900,11 +2900,11 @@ static int vertex_group_levels_exec(bContext *C, wmOperator *op) const bool *vgroup_validmap = BKE_object_defgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count); vgroup_levels_subset(ob, vgroup_validmap, vgroup_tot, subset_count, offset, gain); MEM_freeN((void *)vgroup_validmap); - + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); - + return OPERATOR_FINISHED; } @@ -2914,14 +2914,14 @@ void OBJECT_OT_vertex_group_levels(wmOperatorType *ot) ot->name = "Vertex Group Levels"; ot->idname = "OBJECT_OT_vertex_group_levels"; ot->description = "Add some offset and multiply with some gain the weights of the active vertex group"; - + /* api callbacks */ ot->poll = vertex_group_poll; ot->exec = vertex_group_levels_exec; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + vgroup_operator_subset_select_props(ot, true); RNA_def_float(ot->srna, "offset", 0.f, -1.0, 1.0, "Offset", "Value to add to weights", -1.0f, 1.f); RNA_def_float(ot->srna, "gain", 1.f, 0.f, FLT_MAX, "Gain", "Value to multiply weights by", 0.0f, 10.f); @@ -3010,7 +3010,7 @@ static int vertex_group_fix_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); Scene *scene = CTX_data_scene(C); - + float distToBe = RNA_float_get(op->ptr, "dist"); float strength = RNA_float_get(op->ptr, "strength"); float cp = RNA_float_get(op->ptr, "accuracy"); @@ -3022,17 +3022,17 @@ static int vertex_group_fix_exec(bContext *C, wmOperator *op) } md = md->next; } - + if (md && md->type == eModifierType_Mirror) { BKE_report(op->reports, RPT_ERROR_INVALID_CONTEXT, "This operator does not support an active mirror modifier"); return OPERATOR_CANCELLED; } vgroup_fix(scene, ob, distToBe, strength, cp); - + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); - + return OPERATOR_FINISHED; } @@ -3043,11 +3043,11 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot) ot->idname = "OBJECT_OT_vertex_group_fix"; ot->description = "Modify the position of selected vertices by changing only their respective " "groups' weights (this tool may be slow for many vertices)"; - + /* api callbacks */ ot->poll = vertex_group_mesh_poll; ot->exec = vertex_group_fix_exec; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_float(ot->srna, "dist", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "The distance to move to", -10.0f, 10.0f); @@ -3444,16 +3444,16 @@ static int set_active_group_exec(bContext *C, wmOperator *op) } static const EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) -{ +{ Object *ob = ED_object_context(C); EnumPropertyItem tmp = {0, "", 0, "", ""}; EnumPropertyItem *item = NULL; bDeformGroup *def; int a, totitem = 0; - + if (!ob) return DummyRNA_NULL_items; - + for (a = 0, def = ob->defbase.first; def; def = def->next, a++) { tmp.value = a; tmp.icon = ICON_GROUP_VERTEX; @@ -3578,7 +3578,7 @@ static int vgroup_do_remap(Object *ob, const char *name_array, wmOperator *op) BLI_assert(sort_map_update[ob->actdef] >= 0); ob->actdef = sort_map_update[ob->actdef]; - + MEM_freeN(sort_map_update); return OPERATOR_FINISHED; @@ -3646,7 +3646,7 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op) vgroup_sort_bone_hierarchy(ob, NULL); break; } - + /*remap vgroup data to map to correct names*/ ret = vgroup_do_remap(ob, name_array, op); |