Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2011-01-08 00:12:47 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2011-01-08 00:12:47 +0300
commit473838aec99d81595def7634d61a48118e84b8ff (patch)
treed1463e4d1ac4d4bef59ad7809f4651b85e748683 /source/blender/editors/object/object_modifier.c
parentab11863b2f3d8456062efc6eed5ae41081b44d72 (diff)
Fix for bug [#21534] Multires modifier strange deformations
This adds the "Apply Base" feature from my gsoc2010 branch. Apply Base partially applies the modifier, in that the mesh is reshaped to more closely match the deformed mesh. The upper-level displacements are recalculated so that the highest multires level appears unchanged. Multires does not currently deal well with too large displacements. An easy-to-reproduce example: create any mesh type, add multires, subdivide a few times, then use the sculpt grab brush to drag the entire mesh over a few units. At the highest level, and at level 0, the mesh looks fine, but all of the intervening levels will have ugly spikes on them. This patch doesn't help with situations where you can't modify the base mesh, but otherwise works around the problem fairly well (albeit with a heuristic, not an exact solution.)
Diffstat (limited to 'source/blender/editors/object/object_modifier.c')
-rw-r--r--source/blender/editors/object/object_modifier.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 13b92ed2646..57929b49839 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1177,6 +1177,48 @@ void OBJECT_OT_multires_external_pack(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/********************* multires apply base ***********************/
+static int multires_base_apply_exec(bContext *C, wmOperator *op)
+{
+ Object *ob = ED_object_active_context(C);
+ MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
+
+ if (!mmd)
+ return OPERATOR_CANCELLED;
+
+ multiresModifier_base_apply(mmd, ob);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+static int multires_base_apply_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+ if (edit_modifier_invoke_properties(C, op))
+ return multires_base_apply_exec(C, op);
+ else
+ return OPERATOR_CANCELLED;
+}
+
+
+void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
+{
+ ot->name= "Multires Apply Base";
+ ot->description= "Modify the base mesh to conform to the displaced mesh";
+ ot->idname= "OBJECT_OT_multires_base_apply";
+
+ ot->poll= multires_poll;
+ ot->invoke= multires_base_apply_invoke;
+ ot->exec= multires_base_apply_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ edit_modifier_properties(ot);
+}
+
+
/************************ mdef bind operator *********************/
static int meshdeform_poll(bContext *C)