diff options
author | Ove Murberg Henriksen <sorayasilvermoon@hotmail.com> | 2012-03-02 17:33:14 +0400 |
---|---|---|
committer | Ove Murberg Henriksen <sorayasilvermoon@hotmail.com> | 2012-03-02 17:33:14 +0400 |
commit | 5b29a7bd2f9e3503c06e0e97a1fc75bca106dc6c (patch) | |
tree | 79cef942a8ea672930777b123f0ac7266c39246b /source/blender/editors | |
parent | 42dfd8292821bdf079eb4cde97dc396aca59fb32 (diff) |
from first change up until including this: added two buttons to gui,
transfer weight and trtransfer weight all, made the basic structure, redy to implement the contents of the functions in object_vgroup.c
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 42 |
3 files changed, 41 insertions, 3 deletions
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 29f46f93315..bb87bd5de2e 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -200,6 +200,7 @@ void OBJECT_OT_vertex_group_copy_to_selected(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_copy(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_normalize(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_normalize_all(struct wmOperatorType *ot); +void OBJECT_OT_vertex_group_transfer_weight_all(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_transfer_weight(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_levels(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_lock(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index d6b5861fa66..08df069fbf1 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -173,6 +173,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_vertex_group_copy); WM_operatortype_append(OBJECT_OT_vertex_group_normalize); WM_operatortype_append(OBJECT_OT_vertex_group_normalize_all); + WM_operatortype_append(OBJECT_OT_vertex_group_transfer_weight_all); WM_operatortype_append(OBJECT_OT_vertex_group_transfer_weight); WM_operatortype_append(OBJECT_OT_vertex_group_lock); WM_operatortype_append(OBJECT_OT_vertex_group_fix); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index f14177ae3a3..d8aead9fdc9 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -20,7 +20,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Ove M Henriksen * * ***** END GPL LICENSE BLOCK ***** */ @@ -75,6 +75,7 @@ #include "UI_resources.h" #include "object_intern.h" +#include <stdio.h> /************************ Exported Functions **********************/ static void vgroup_remap_update_users(Object *ob, int *map); @@ -1176,8 +1177,16 @@ static void vgroup_normalize_all(Object *ob, int lock_active) } } -static void vgroup_transfer_weight() -{} +static void vgroup_transfer_weight_all(Object *ob_act, Object *ob_other) +{ + /* for each vertex group {vgroup_transfer_weight()} */ + printf("Not implemented yet!"); +} + +static void vgroup_transfer_weight(Object *ob_act, Object *ob_other) +{ + printf("not implemented yet!"); +} static void vgroup_lock_all(Object *ob, int action) { @@ -2369,6 +2378,33 @@ void OBJECT_OT_vertex_group_normalize_all(wmOperatorType *ot) "Keep the values of the active group while normalizing others"); } +static int vertex_group_transfer_weight_all_exec(bContext *C, wmOperator *op) +{ + Object *ob= ED_object_context(C); + + vgroup_transfer_weight_all(); + + 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; +} + +void OBJECT_OT_vertex_group_transfer_weight_all(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Transfer Weight"; + ot->idname= "OBJECT_OT_vertex_group_transfer_weight"; + + /* api callbacks */ + ot->poll= vertex_group_poll; + ot->exec= vertex_group_transfer_weight_all_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op) { Object *ob= ED_object_context(C); |