Shape Propagate to all back in vertex menu
authorCampbell Barton <ideasman42@gmail.com>
Tue, 27 Oct 2009 15:40:56 +0000 (15:40 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 27 Oct 2009 15:40:56 +0000 (15:40 +0000)
release/scripts/ui/space_view3d.py
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c

index 144944e6452175ecfa759f1e7653e458fb839d2b..e630ca0b6bd682deebafa4478c33f2acf65c9f39 100644 (file)
@@ -808,7 +808,7 @@ class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
                layout.itemO("mesh.faces_shade_smooth")
                layout.itemO("mesh.faces_shade_flat")
                layout.itemO("mesh.blend_from_shape")
-               layout.itemO("mesh.shape_propagate_to_all")
+               layout.itemO("mesh.shape_propagate_to_all")
                layout.itemO("mesh.select_vertex_path")
 
 class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
@@ -833,7 +833,7 @@ class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
                layout.itemO("mesh.blend_from_shape")
                
                layout.itemO("object.vertex_group_blend")
-               # uiItemO(layout, "Propagate to All Shapes", 0, "mesh.shape_propagate_to_all");
+               layout.itemO("mesh.shape_propagate_to_all")
 
 class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
        __label__ = "Edges"
index 1e650a59d560867c0a2cc68a1bd0e08a0f115518..eae6f47a12249b504a45cd1c15ace22d0fb9bfb1 100644 (file)
@@ -5023,14 +5023,12 @@ void MESH_OT_rip(wmOperatorType *ot)
 
 /************************ Shape Operators *************************/
 
-#if 0
-void shape_propagate(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op)
+static void shape_propagate(Object *obedit, EditMesh *em, wmOperator *op)
 {
        EditVert *ev = NULL;
        Mesh* me = (Mesh*)obedit->data;
        Key*  ky = NULL;
        KeyBlock* kb = NULL;
-       Base* base=NULL;
 
 
        if(me->key){
@@ -5055,17 +5053,49 @@ void shape_propagate(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op)
                return;
        }
 
+#if 0
        //TAG Mesh Objects that share this data
        for(base = scene->base.first; base; base = base->next){
                if(base->object && base->object->data == me){
                        base->object->recalc = OB_RECALC_DATA;
                }
        }
+#endif
 
        DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        return;
 }
-#endif
+
+
+static int shape_propagate_to_all_exec(bContext *C, wmOperator *op)
+{
+       Object *obedit= CTX_data_edit_object(C);
+       Mesh *me= obedit->data;
+       EditMesh *em= BKE_mesh_get_editmesh(me);
+
+       shape_propagate(obedit, em, op);
+
+       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+
+       return OPERATOR_FINISHED;
+}
+
+
+void MESH_OT_shape_propagate_to_all(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Shape Propagate";
+       ot->description= "Apply selected vertex locations to all other shape keys.";
+       ot->idname= "MESH_OT_shape_propagate_to_all";
+
+       /* api callbacks */
+       ot->exec= shape_propagate_to_all_exec;
+       ot->poll= ED_operator_editmesh;
+
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
 
 static int blend_from_shape_exec(bContext *C, wmOperator *op)
 {
index cab56ad5110f66bd5f1c56f91ab18b91e0282335..9ff3a3b684c618625e9b4f940acad433b445a0f7 100644 (file)
@@ -226,6 +226,7 @@ void MESH_OT_colors_mirror(struct wmOperatorType *ot);
 void MESH_OT_delete(struct wmOperatorType *ot);
 void MESH_OT_rip(struct wmOperatorType *ot);
 
+void MESH_OT_shape_propagate_to_all(struct wmOperatorType *ot);
 void MESH_OT_blend_from_shape(struct wmOperatorType *ot);
 
 /* ******************* mesh_layers.c */
index 7159feced037d96c3bee635ade38ef4924dedd23..457e3823ab3c1dfabae0994f3006aa41e1410c18 100644 (file)
@@ -139,6 +139,7 @@ void ED_operatortypes_mesh(void)
        WM_operatortype_append(MESH_OT_knife_cut);
        WM_operatortype_append(MESH_OT_rip);
        WM_operatortype_append(MESH_OT_blend_from_shape);
+       WM_operatortype_append(MESH_OT_shape_propagate_to_all);
        
        WM_operatortype_append(MESH_OT_uv_texture_add);
        WM_operatortype_append(MESH_OT_uv_texture_remove);