diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-21 18:55:10 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-21 18:55:10 +0300 |
commit | 29ea21e6bd6d6813a6b8fd58d7085e9efce9b494 (patch) | |
tree | ef8a9cd7c9ccdf4b6d62fe455ebcd29e61354b76 /source/blender/editors | |
parent | 4d32e002edf9075c168a61b5ea4657c982ff23e2 (diff) |
Multires: added back Reshape function, to copy vertex locations
from another mesh.
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_modifier.c | 45 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 1 |
3 files changed, 47 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 848855da1b0..562216e5890 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -142,6 +142,7 @@ void OBJECT_OT_modifier_apply(struct wmOperatorType *ot); void OBJECT_OT_modifier_convert(struct wmOperatorType *ot); void OBJECT_OT_modifier_copy(struct wmOperatorType *ot); void OBJECT_OT_multires_subdivide(struct wmOperatorType *ot); +void OBJECT_OT_multires_reshape(struct wmOperatorType *ot); void OBJECT_OT_multires_higher_levels_delete(struct wmOperatorType *ot); void OBJECT_OT_multires_save_external(struct wmOperatorType *ot); void OBJECT_OT_multires_pack_external(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 06c31e9f1a9..552de1f8f60 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -814,6 +814,51 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/****************** multires reshape operator *********************/ + +static int multires_reshape_exec(bContext *C, wmOperator *op) +{ + PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_MultiresModifier); + Object *ob= ptr.id.data, *secondob= NULL; + MultiresModifierData *mmd= ptr.data; + + CTX_DATA_BEGIN(C, Object*, selob, selected_editable_objects) { + if(selob->type == OB_MESH && selob != ob) { + secondob= selob; + break; + } + } + CTX_DATA_END; + + if(!secondob) { + BKE_report(op->reports, RPT_ERROR, "Second selected mesh object require to copy shape from."); + return OPERATOR_CANCELLED; + } + + if(!multiresModifier_reshape(mmd, ob, secondob)) { + BKE_report(op->reports, RPT_ERROR, "Objects do not have the same number of vertices."); + return OPERATOR_CANCELLED; + } + + DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_multires_reshape(wmOperatorType *ot) +{ + ot->name= "Multires Reshape"; + ot->description= "Copy vertex coordinates from other object."; + ot->idname= "OBJECT_OT_multires_reshape"; + + ot->poll= multires_poll; + ot->exec= multires_reshape_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /****************** multires save external operator *********************/ static int multires_save_external_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index dbd03561c20..bd43e9c24c4 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -135,6 +135,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_modifier_convert); WM_operatortype_append(OBJECT_OT_modifier_copy); WM_operatortype_append(OBJECT_OT_multires_subdivide); + WM_operatortype_append(OBJECT_OT_multires_reshape); WM_operatortype_append(OBJECT_OT_multires_higher_levels_delete); WM_operatortype_append(OBJECT_OT_multires_save_external); WM_operatortype_append(OBJECT_OT_multires_pack_external); |