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:
authorAlexander Pinzon <apinzonf@gmail.com>2013-11-24 00:00:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-11-24 00:10:42 +0400
commit673bd9a009062807c16cc31a263018737c148a96 (patch)
tree4ab6bc0cf8d9a7f6fb60b4ea2d61a6374c97794d /source/blender/editors/object/object_modifier.c
parent4c52e737df39e538d3b41a232035a4a1e240505d (diff)
Mesh Modifiers: Added Laplacian Deform
Part of soc-2013-sketch_mesh branch See: http://wiki.blender.org/index.php/User:Apinzonf/Doc:2.6/Manual/Modifiers/Deform/Laplacian_Deform
Diffstat (limited to 'source/blender/editors/object/object_modifier.c')
-rw-r--r--source/blender/editors/object/object_modifier.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 01dafe69d31..d4c64552b38 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2209,3 +2209,52 @@ void OBJECT_OT_ocean_bake(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "free", FALSE, "Free", "Free the bake, rather than generating it");
}
+/************************ LaplacianDeform bind operator *********************/
+
+static int laplaciandeform_poll(bContext *C)
+{
+ return edit_modifier_poll_generic(C, &RNA_LaplacianDeformModifier, 0);
+}
+
+static int laplaciandeform_bind_exec(bContext *C, wmOperator *op)
+{
+ Object *ob = ED_object_active_context(C);
+ LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)edit_modifier_property_get(op, ob, eModifierType_LaplacianDeform);
+
+ if (!lmd)
+ return OPERATOR_CANCELLED;
+ if (lmd->flag & MOD_LAPLACIANDEFORM_BIND) {
+ lmd->flag &= ~MOD_LAPLACIANDEFORM_BIND;
+ }
+ else {
+ lmd->flag |= MOD_LAPLACIANDEFORM_BIND;
+ }
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
+ return OPERATOR_FINISHED;
+}
+
+static int laplaciandeform_bind_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
+{
+ if (edit_modifier_invoke_properties(C, op))
+ return laplaciandeform_bind_exec(C, op);
+ else
+ return OPERATOR_CANCELLED;
+}
+
+void OBJECT_OT_laplaciandeform_bind(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Laplacian Deform Bind";
+ ot->description = "Bind mesh to system in laplacian deform modifier";
+ ot->idname = "OBJECT_OT_laplaciandeform_bind";
+
+ /* api callbacks */
+ ot->poll = laplaciandeform_poll;
+ ot->invoke = laplaciandeform_bind_invoke;
+ ot->exec = laplaciandeform_bind_exec;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
+ edit_modifier_properties(ot);
+}