Commit: 9720402fca17f7fe1a6ebde8f8cdbe180dbd0483
Author: Antony Riakiotakis
Date:   Mon Dec 1 14:52:25 2014 +0100
Branches: wiggly-widgets
https://developer.blender.org/rB9720402fca17f7fe1a6ebde8f8cdbe180dbd0483

Placeholder operator

===================================================================

M       release/scripts/startup/bl_ui/properties_data_mesh.py
M       source/blender/editors/object/object_intern.h
M       source/blender/editors/object/object_ops.c
M       source/blender/editors/object/object_shapekey.c
M       source/blender/makesdna/DNA_key_types.h

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py 
b/release/scripts/startup/bl_ui/properties_data_mesh.py
index 7178e17..a0d601f 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -297,6 +297,8 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
                     row = layout.row()
                     row.active = enable_edit_value
                     row.prop(kb, "value")
+                    if ob.mode == 'EDIT':
+                        row.operator("OBJECT_OT_shape_key_dorito_set")
 
                     split = layout.split()
 
diff --git a/source/blender/editors/object/object_intern.h 
b/source/blender/editors/object/object_intern.h
index c9dae5b..659ff53 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -247,6 +247,7 @@ void OBJECT_OT_shape_key_clear(struct wmOperatorType *ot);
 void OBJECT_OT_shape_key_retime(struct wmOperatorType *ot);
 void OBJECT_OT_shape_key_mirror(struct wmOperatorType *ot);
 void OBJECT_OT_shape_key_move(struct wmOperatorType *ot);
+void OBJECT_OT_shape_key_dorito_set(struct wmOperatorType *ot);
 
 /* object_group.c */
 void OBJECT_OT_group_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_ops.c 
b/source/blender/editors/object/object_ops.c
index 72870ad..5e3654a 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -216,6 +216,7 @@ void ED_operatortypes_object(void)
        WM_operatortype_append(OBJECT_OT_shape_key_retime);
        WM_operatortype_append(OBJECT_OT_shape_key_mirror);
        WM_operatortype_append(OBJECT_OT_shape_key_move);
+       WM_operatortype_append(OBJECT_OT_shape_key_dorito_set);
 
        WM_operatortype_append(LATTICE_OT_select_all);
        WM_operatortype_append(LATTICE_OT_select_more);
diff --git a/source/blender/editors/object/object_shapekey.c 
b/source/blender/editors/object/object_shapekey.c
index 6bb23a4..146ab7a 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -53,6 +53,7 @@
 
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
+#include "BKE_editmesh.h"
 #include "BKE_key.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
@@ -558,3 +559,47 @@ void OBJECT_OT_shape_key_move(wmOperatorType *ot)
        RNA_def_enum(ot->srna, "type", slot_move, 0, "Type", "");
 }
 
+static int shape_key_dorito_set_poll(bContext *C)
+{
+       /* Same as shape_key_mode_exists_poll above, but ensure we have at 
least two shapes! */
+       Object *ob = ED_object_context(C);
+       ID *data = (ob) ? ob->data : NULL;
+       Key *key = BKE_key_from_object(ob);
+
+       return (ob && !ob->id.lib && data && !data->lib && ob->mode == 
OB_MODE_EDIT && key && key->totkey > 1);
+}
+
+static int shape_key_dorito_set_exec(bContext *C, wmOperator *op)
+{
+       Object *ob = ED_object_context(C);
+       BMesh *bm = BKE_editmesh_from_object(ob)->bm;
+       BMVert *v = BM_mesh_active_vert_get(bm);
+
+       Key *key = BKE_key_from_object(ob);
+       KeyBlock *kb = BKE_keyblock_from_object(ob);
+       
+       const int totkey = key->totkey;
+       const int act_index = ob->shapenr - 1;
+       int new_index;
+
+
+       DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_shape_key_dorito_set(struct wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name = "Set Dorito";
+       ot->idname = "OBJECT_OT_shape_key_dorito_set";
+       ot->description = "Set vertex that influences the dorito";
+
+       /* api callbacks */
+       ot->poll = shape_key_dorito_set_poll;
+       ot->exec = shape_key_dorito_set_exec;
+
+       /* flags */
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
diff --git a/source/blender/makesdna/DNA_key_types.h 
b/source/blender/makesdna/DNA_key_types.h
index 16e40fa..3cf9640 100644
--- a/source/blender/makesdna/DNA_key_types.h
+++ b/source/blender/makesdna/DNA_key_types.h
@@ -66,7 +66,10 @@ typedef struct KeyBlock {
        /* ranges, for RNA and UI only to clamp 'curval' */
        float slidermin;
        float slidermax;
-
+       
+       /* dorito relevant code */
+       int dorito_index;       /* index of dorito vertex in mesh */
+       int pad;
 } KeyBlock;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to