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
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')
-rw-r--r--source/blender/editors/object/object_intern.h1
-rw-r--r--source/blender/editors/object/object_modifier.c49
-rw-r--r--source/blender/editors/object/object_ops.c1
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c2
4 files changed, 53 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index bfed1f2f982..ce509e2ffe7 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -173,6 +173,7 @@ void OBJECT_OT_skin_root_mark(struct wmOperatorType *ot);
void OBJECT_OT_skin_loose_mark_clear(struct wmOperatorType *ot);
void OBJECT_OT_skin_radii_equalize(struct wmOperatorType *ot);
void OBJECT_OT_skin_armature_create(struct wmOperatorType *ot);
+void OBJECT_OT_laplaciandeform_bind(struct wmOperatorType *ot);
/* object_constraint.c */
void OBJECT_OT_constraint_add(struct wmOperatorType *ot);
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);
+}
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 6d760acb698..74ac487b687 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -241,6 +241,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_bake_image);
WM_operatortype_append(OBJECT_OT_drop_named_material);
+ WM_operatortype_append(OBJECT_OT_laplaciandeform_bind);
}
void ED_operatormacros_object(void)
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 5168c3c873a..ebaeb9ccb6a 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -965,6 +965,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
UI_icon_draw(x, y, ICON_MOD_TRIANGULATE); break;
case eModifierType_MeshCache:
UI_icon_draw(x, y, ICON_MOD_MESHDEFORM); break; /* XXX, needs own icon */
+ case eModifierType_LaplacianDeform:
+ UI_icon_draw(x, y, ICON_MOD_MESHDEFORM); break; /* XXX, needs own icon */
/* Default */
case eModifierType_None:
case eModifierType_ShapeKey: