diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-16 16:59:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-16 16:59:27 +0300 |
commit | 20043a0fc08cb92af8de796afabb78f7d64f7099 (patch) | |
tree | e0ad658cf09a94af699a27b0056909b23bfcf6e2 /source/blender/editors/object/object_hook.c | |
parent | 88fe2d187bd8a1a6e07f60b6090d302ee81c462b (diff) |
add hook in vertex and control point menu's, Ctrl+H
TODO's
- add for lattice
- break up add_hook
- add other hook operators
Diffstat (limited to 'source/blender/editors/object/object_hook.c')
-rw-r--r-- | source/blender/editors/object/object_hook.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 91aebc8b149..d2c5a14b589 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -43,18 +43,26 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_view3d_types.h" +#include "DNA_windowmanager_types.h" +#include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_depsgraph.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_object.h" +#include "RNA_define.h" +#include "RNA_access.h" + #include "ED_curve.h" #include "ED_mesh.h" #include "ED_object.h" #include "ED_view3d.h" +#include "WM_types.h" +#include "WM_api.h" + #include "object_intern.h" /* XXX operators for this are not implemented yet */ @@ -610,3 +618,42 @@ void hookmenu(Scene *scene, View3D *v3d) } } +static int object_add_hook_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + View3D *v3d = CTX_wm_view3d(C); + + int mode= RNA_enum_get(op->ptr, "type"); + + // XXX - todo, break up this function for different operators + // and detect if this finished correctly or not, + add_hook(scene, v3d, mode); + + WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); + return OPERATOR_FINISHED; +} + +void OBJECT_OT_hook_add(wmOperatorType *ot) +{ + static EnumPropertyItem prop_new_hook_types[] = { + {1, "NEW", 0, "New Object", "Create a new object and assign the verts to it."}, + {2, "SELECTED", 0, "Selection", "Add the hook to the selected object."}, + {0, NULL, 0, NULL, NULL} + }; + + /* identifiers */ + ot->name= "Add Hook"; + ot->description= "Add hook to selected verts."; + ot->idname= "OBJECT_OT_hook_add"; + + /* api callbacks */ + ot->invoke= WM_menu_invoke; + ot->exec= object_add_hook_exec; +// ot->poll= ED_operator_editmesh; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_enum(ot->srna, "type", prop_new_hook_types, 0, "Type", ""); +} + |