diff options
author | Ton Roosendaal <ton@blender.org> | 2009-02-25 17:50:40 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-02-25 17:50:40 +0300 |
commit | c3078c94fb48cc1376b170bb3c7ce1f2e14fa2f3 (patch) | |
tree | 0a3764a70ec84e373ae5e40889909bedba373f12 /source/blender/editors/armature/editarmature.c | |
parent | c0a6cb950d683f5ef35031cd250d3e8b79f5609e (diff) |
2.5
SHIFT+A add armature didn't add a bone yet. :)
Diffstat (limited to 'source/blender/editors/armature/editarmature.c')
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 7a17a9dc9a6..d3c59bf340c 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2112,7 +2112,8 @@ static EditBone *add_editbone(Object *obedit, char *name) return bone; } -static void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, short newob) +/* v3d and rv3d are allowed to be NULL */ +void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) { Object *obedit= scene->obedit; // XXX get from context float obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3]; @@ -2124,7 +2125,7 @@ static void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, sh Mat4Invert(obedit->imat, obedit->obmat); Mat4MulVecfl(obedit->imat, curs); - if ( !(newob) || (U.flag & USER_ADD_VIEWALIGNED) ) + if (rv3d && (U.flag & USER_ADD_VIEWALIGNED)) Mat3CpyMat4(obmat, rv3d->viewmat); else Mat3One(obmat); @@ -2139,51 +2140,13 @@ static void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, sh VECCOPY(bone->head, curs); - if ( !(newob) || (U.flag & USER_ADD_VIEWALIGNED) ) + if ( (U.flag & USER_ADD_VIEWALIGNED) ) VecAddf(bone->tail, bone->head, imat[1]); // bone with unit length 1 else VecAddf(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z } -void add_primitiveArmature(Scene *scene, View3D *v3d, int type) -{ - RegionView3D *rv3d= NULL; // XXX get from context - Object *obedit= scene->obedit; // XXX get from context - short newob=0; - - if(scene->id.lib) return; - - G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE); -// setcursor_space(SPACE_VIEW3D, CURSOR_STD); - -// XXX check_editmode(OB_ARMATURE); - - /* If we're not the "obedit", make a new object and enter editmode */ - if (obedit==NULL) { - add_object(scene, OB_ARMATURE); - ED_object_base_init_from_view(NULL, BASACT); // XXX NULL is C - obedit= BASACT->object; - - where_is_object(scene, obedit); - - ED_armature_to_edit(obedit); -// setcursor_space(SPACE_VIEW3D, CURSOR_EDIT); - newob=1; - } - - /* no primitive support yet */ - add_primitive_bone(scene, v3d, rv3d, newob); - - //armature_sync_selection(arm->edbo); // XXX which armature? - - if ((newob) && !(U.flag & USER_ADD_EDITMODE)) { - ED_armature_from_edit(scene, obedit); - ED_armature_edit_free(obedit); - } - - BIF_undo_push("Add primitive"); -} /* previously addvert_armature */ /* the ctrl-click method */ |