From d160891c3695042899e09ad6f39e5427dbe91d51 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Oct 2009 15:40:56 +0000 Subject: [PATCH] Shape Propagate to all back in vertex menu --- release/scripts/ui/space_view3d.py | 4 +-- source/blender/editors/mesh/editmesh_tools.c | 38 +++++++++++++++++--- source/blender/editors/mesh/mesh_intern.h | 1 + source/blender/editors/mesh/mesh_ops.c | 1 + 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 144944e6452..e630ca0b6bd 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -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" diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 1e650a59d56..eae6f47a122 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -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) { diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index cab56ad5110..9ff3a3b684c 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -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 */ diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 7159feced03..457e3823ab3 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -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);