* Re-implemented/refactored 3D View hooks menu.
[blender.git] / source / blender / editors / object / object_modifier.c
index b84fb47e5ee81b99526f30bdcd4c992d80b81292..f65153d09ad399e98bcf71d9203bbc07815f0a7e 100644 (file)
@@ -822,157 +822,6 @@ void OBJECT_OT_meshdeform_bind(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-/******************** hook operators ************************/
-
-static int hook_poll(bContext *C)
-{
-       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
-       ID *id= ptr.id.data;
-       return (ptr.data && id && !id->lib);
-}
-
-static int hook_reset_exec(bContext *C, wmOperator *op)
-{
-       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
-       Object *ob= ptr.id.data;
-       HookModifierData *hmd= ptr.data;
-
-       if(hmd->object) {
-               bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget);
-               
-               if(hmd->subtarget[0] && pchan) {
-                       float imat[4][4], mat[4][4];
-                       
-                       /* calculate the world-space matrix for the pose-channel target first, then carry on as usual */
-                       mul_m4_m4m4(mat, pchan->pose_mat, hmd->object->obmat);
-                       
-                       invert_m4_m4(imat, mat);
-                       mul_serie_m4(hmd->parentinv, imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
-               }
-               else {
-                       invert_m4_m4(hmd->object->imat, hmd->object->obmat);
-                       mul_serie_m4(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
-               }
-       }
-
-       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-       
-       return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_hook_reset(wmOperatorType *ot)
-{
-       ot->name= "Hook Reset";
-       ot->description= "Recalculate and and clear offset transformation.";
-       ot->idname= "OBJECT_OT_hook_reset";
-
-       ot->exec= hook_reset_exec;
-       ot->poll= hook_poll;
-       
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-static int hook_recenter_exec(bContext *C, wmOperator *op)
-{
-       Scene *scene= CTX_data_scene(C);
-       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
-       Object *ob= ptr.id.data;
-       HookModifierData *hmd= ptr.data;
-       float bmat[3][3], imat[3][3];
-
-       copy_m3_m4(bmat, ob->obmat);
-       invert_m3_m3(imat, bmat);
-
-       VECSUB(hmd->cent, scene->cursor, ob->obmat[3]);
-       mul_m3_v3(imat, hmd->cent);
-
-       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-       
-       return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_hook_recenter(wmOperatorType *ot)
-{
-       ot->name= "Hook Recenter";
-       ot->description= "Set hook center to cursor position.";
-       ot->idname= "OBJECT_OT_hook_recenter";
-
-       ot->exec= hook_recenter_exec;
-       ot->poll= hook_poll;
-       
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-static int hook_select_exec(bContext *C, wmOperator *op)
-{
-       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
-       Object *ob= ptr.id.data;
-       HookModifierData *hmd= ptr.data;
-
-       object_hook_select(ob, hmd);
-
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
-       
-       return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_hook_select(wmOperatorType *ot)
-{
-       ot->name= "Hook Select";
-       ot->description= "Selects effected vertices on mesh.";
-       ot->idname= "OBJECT_OT_hook_select";
-
-       ot->exec= hook_select_exec;
-       ot->poll= hook_poll;
-       
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-static int hook_assign_exec(bContext *C, wmOperator *op)
-{
-       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
-       Object *ob= ptr.id.data;
-       HookModifierData *hmd= ptr.data;
-       float cent[3];
-       char name[32];
-       int *indexar, tot;
-               
-       if(!object_hook_index_array(ob, &tot, &indexar, name, cent)) {
-               BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group");
-               return OPERATOR_CANCELLED;
-       }
-
-       if(hmd->indexar)
-               MEM_freeN(hmd->indexar);
-
-       VECCOPY(hmd->cent, cent);
-       hmd->indexar= indexar;
-       hmd->totindex= tot;
-
-       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-       
-       return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_hook_assign(wmOperatorType *ot)
-{
-       ot->name= "Hook Assign";
-       ot->description= "Reassigns selected vertices to hook.";
-       ot->idname= "OBJECT_OT_hook_assign";
-
-       ot->exec= hook_assign_exec;
-       ot->poll= hook_poll;
-       
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
 /****************** explode refresh operator *********************/
 
 static int explode_refresh_poll(bContext *C)