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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-05-22 15:36:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-22 15:36:56 +0400
commit04e157304acddd574ec46c068beb33a2b356df68 (patch)
tree27e059fe3d05043fa333eebee25f2b0f8af837bb /source
parentb07bdf367c8d3eb1a900ef85cec79c694d24afbe (diff)
- view dolly now quits on pressing escape (if activated from the search menu).
- adding new bones now makes them active.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/armature/editarmature.c5
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c34
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h1
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c1
4 files changed, 40 insertions, 1 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index d5dce320a6b..b31bcc710f4 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -2356,6 +2356,7 @@ EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name)
void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
{
Object *obedit= scene->obedit; // XXX get from context
+ bArmature *arm= obedit->data;
float obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3];
EditBone *bone;
@@ -2374,7 +2375,9 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
ED_armature_deselect_all(obedit, 0);
/* Create a bone */
- bone= ED_armature_edit_bone_add(obedit->data, "Bone");
+ bone= ED_armature_edit_bone_add(arm, "Bone");
+
+ arm->act_edbone= bone;
copy_v3_v3(bone->head, curs);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index ae020b91cdf..fd9658a9b88 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1039,6 +1039,7 @@ void VIEW3D_OT_move(wmOperatorType *ot)
/* ************************ viewzoom ******************************** */
+/* viewdolly_modal_keymap has an exact copy of this, apply fixes to both */
/* called in transform_ops.c, on each regeneration of keymaps */
void viewzoom_modal_keymap(wmKeyConfig *keyconf)
{
@@ -1297,6 +1298,39 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
+/* this is an exact copy of viewzoom_modal_keymap */
+/* called in transform_ops.c, on each regeneration of keymaps */
+void viewdolly_modal_keymap(wmKeyConfig *keyconf)
+{
+ static EnumPropertyItem modal_items[] = {
+ {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
+
+ {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
+ {VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
+
+ {0, NULL, 0, NULL, NULL}};
+
+ wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Dolly Modal");
+
+ /* this function is called for each spacetype, only needs to add map once */
+ if(keymap) return;
+
+ keymap= WM_modalkeymap_add(keyconf, "View3D Dolly Modal", modal_items);
+
+ /* items for modal map */
+ WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
+ WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, VIEW_MODAL_CONFIRM);
+
+ /* disabled mode switching for now, can re-implement better, later on
+ WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
+ WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
+ WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
+ */
+
+ /* assign map to operators */
+ WM_modalkeymap_assign(keymap, "VIEW3D_OT_dolly");
+}
+
/* viewdolly_invoke() copied this function, changes here may apply there */
static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index f4d198f7515..dd2e657c7e8 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -165,6 +165,7 @@ void fly_modal_keymap(struct wmKeyConfig *keyconf);
void viewrotate_modal_keymap(struct wmKeyConfig *keyconf);
void viewmove_modal_keymap(struct wmKeyConfig *keyconf);
void viewzoom_modal_keymap(struct wmKeyConfig *keyconf);
+void viewdolly_modal_keymap(struct wmKeyConfig *keyconf);
/* view3d_buttons.c */
void VIEW3D_OT_properties(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 4942030c516..05ef79a9f29 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -305,5 +305,6 @@ void view3d_keymap(wmKeyConfig *keyconf)
viewrotate_modal_keymap(keyconf);
viewmove_modal_keymap(keyconf);
viewzoom_modal_keymap(keyconf);
+ viewdolly_modal_keymap(keyconf);
}