svn merge ^/trunk/blender -r44562:45364
authorOve Murberg Henriksen <sorayasilvermoon@hotmail.com>
Tue, 3 Apr 2012 11:55:39 +0000 (11:55 +0000)
committerOve Murberg Henriksen <sorayasilvermoon@hotmail.com>
Tue, 3 Apr 2012 11:55:39 +0000 (11:55 +0000)
1  2 
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_ops.c
source/blender/editors/object/object_vgroup.c

@@@ -2276,18 -2282,17 +2319,18 @@@ static int vertex_group_deselect_exec(b
  void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot)
  {
        /* identifiers */
-       ot->name= "Deselect Vertex Group";
-       ot->idname= "OBJECT_OT_vertex_group_deselect";
+       ot->name = "Deselect Vertex Group";
+       ot->idname = "OBJECT_OT_vertex_group_deselect";
  
        /* api callbacks */
-       ot->poll= vertex_group_poll_edit_or_wpaint_vert_select;
-       ot->exec= vertex_group_deselect_exec;
+       ot->poll = vertex_group_poll_edit_or_wpaint_vert_select;
+       ot->exec = vertex_group_deselect_exec;
  
        /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
  }
  
 +/*Adds a copy of selected vertex group from source object to source object*/
  static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op))
  {
        Object *ob= ED_object_context(C);
@@@ -2653,19 -2693,18 +2731,19 @@@ static int vertex_group_copy_to_linked_
  void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot)
  {
        /* identifiers */
-       ot->name= "Copy Vertex Groups to Linked";
-       ot->idname= "OBJECT_OT_vertex_group_copy_to_linked";
-       ot->description= "Copy Vertex Groups to all users of the same Geometry data";
+       ot->name = "Copy Vertex Groups to Linked";
+       ot->idname = "OBJECT_OT_vertex_group_copy_to_linked";
+       ot->description = "Copy Vertex Groups to all users of the same Geometry data";
  
        /* api callbacks */
-       ot->poll= vertex_group_poll;
-       ot->exec= vertex_group_copy_to_linked_exec;
+       ot->poll = vertex_group_poll;
+       ot->exec = vertex_group_copy_to_linked_exec;
  
        /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
  }
  
 +/*Copy vertex groups from source to target*/ /*warning! overwrites list*/
  static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
  {
        Object *obact= ED_object_context(C);
  void OBJECT_OT_vertex_group_copy_to_selected(wmOperatorType *ot)
  {
        /* identifiers */
-       ot->name= "Copy Vertex Group to Selected";
-       ot->idname= "OBJECT_OT_vertex_group_copy_to_selected";
-       ot->description= "Copy Vertex Groups to other selected objects with matching indices";
+       ot->name = "Copy Vertex Group to Selected";
+       ot->idname = "OBJECT_OT_vertex_group_copy_to_selected";
+       ot->description = "Copy Vertex Groups to other selected objects with matching indices";
  
        /* api callbacks */
-       ot->poll= vertex_group_poll;
-       ot->exec= vertex_group_copy_to_selected_exec;
+       ot->poll = vertex_group_poll;
+       ot->exec = vertex_group_copy_to_selected_exec;
  
        /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
  }
  
 +static int vertex_group_copy_to_selected_single_exec(bContext *C, wmOperator *op)
 +{
 +      Object *obact= CTX_data_active_object(C);
 +      int change= 0;
 +      int fail= 0;
 +
 +      /*Macro to loop through selected objects and perform operation*/
 +      CTX_DATA_BEGIN(C, Object*, obslc, selected_editable_objects)
 +      {
 +              if(obact != obslc) {
 +                      if(ED_vgroup_copy_single(obslc, obact)) change++;
 +                      else                                fail++;
 +                      /*event notifiers for correct display of data*/
 +                      DAG_id_tag_update(&obslc->id, OB_RECALC_DATA);
 +                      WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obslc);
 +                      WM_event_add_notifier(C, NC_GEOM|ND_DATA, obslc->data);
 +              }
 +      }
 +      CTX_DATA_END;
 +      if((change == 0 && fail == 0) || fail) {
 +              BKE_reportf(op->reports, RPT_ERROR,
 +                          "Copy to VGroups to Selected warning done %d, failed %d, object data must have matching indicies",
 +                          change, fail);
 +      }
 +
 +      return OPERATOR_FINISHED;
 +}
 +
 +/*Transfer vertex group with weight to selected*/
 +void OBJECT_OT_vertex_group_copy_to_selected_single(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Copy a Vertex Group to Selected";
 +      ot->idname= "OBJECT_OT_vertex_group_copy_to_selected_single";
 +      ot->description= "Copy a vertex group to other selected objects with matching indices";
 +
 +      /* api callbacks */
 +      ot->poll= vertex_group_poll;
 +      ot->exec= vertex_group_copy_to_selected_single_exec;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +}
 +
  static EnumPropertyItem vgroup_items[]= {
        {0, NULL, 0, NULL, NULL}};