Grease Pencil:

* Added 'Convert To...' button for easy access to conversion tool. The hotkey has been mentioned in the tooltip. This replaces the 'Del Active Frame' button in 3d view only.

Armature Apply Pose:
* Added menu entry (beside Relax Pose)
* Bone-parented objects now get their parent inverse matrices correctly recalculated
* Changes for 'scale' code in previous commit wasn't correct... reverting
* IPO/anim flush protection is now set on bones to prevent them from being sprawled everywhere after applying
This commit is contained in:
Joshua Leung 2008-08-29 12:24:07 +00:00
parent ff06fcfc33
commit b77e130dd6
3 changed files with 42 additions and 5 deletions

@ -145,6 +145,13 @@ void gp_ui_delframe_cb (void *gpd, void *gpl)
allqueue(REDRAWACTION, 0);
}
/* convert the active layer to geometry */
void gp_ui_convertlayer_cb (void *gpd, void *gpl)
{
gpencil_layer_setactive(gpd, gpl);
gpencil_convert_menu();
}
/* ------- Drawing Code ------- */
/* draw the controls for a given layer */
@ -166,7 +173,7 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short
/* rounded header */
if (active) uiBlockSetCol(block, TH_BUT_ACTION);
rb_col= (active)?-20:20;
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-8, *yco-2, width, 24, NULL, 5.0, 0.0, 15 , rb_col-20, "");
uiDefBut(block, ROUNDBOX, B_REDR, "", *xco-8, *yco-2, width, 24, NULL, 5.0, 0.0, 15 , rb_col-20, "");
if (active) uiBlockSetCol(block, TH_AUTO);
/* lock toggle */
@ -249,8 +256,14 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short
/* options */
uiBlockBeginAlign(block);
if (curarea->spacetype == SPACE_VIEW3D) {
but= uiDefBut(block, BUT, B_REDR, "Convert to...", *xco+160, *yco-75, 140, 20, NULL, 0, 0, 0, 0, "Converts this layer's strokes to geometry (Hotkey = Alt-Shift-C)");
uiButSetFunc(but, gp_ui_convertlayer_cb, gpd, gpl);
}
else {
but= uiDefBut(block, BUT, B_REDR, "Del Active Frame", *xco+160, *yco-75, 140, 20, NULL, 0, 0, 0, 0, "Erases the the active frame for this layer (Hotkey = Alt-XKEY/DEL)");
uiButSetFunc(but, gp_ui_delframe_cb, gpd, gpl);
}
but= uiDefBut(block, BUT, B_REDR, "Del Last Stroke", *xco+160, *yco-95, 140, 20, NULL, 0, 0, 0, 0, "Erases the last stroke from the active frame (Hotkey = Alt-XKEY/DEL)");
uiButSetFunc(but, gp_ui_delstroke_cb, gpd, gpl);

@ -440,9 +440,23 @@ void docenter_armature (Object *ob, int centermode)
}
/* helper for apply_armature_pose2bones - fixes parenting of objects that are bone-parented to armature */
static void applyarmature_fix_boneparents (Object *ob)
static void applyarmature_fix_boneparents (Object *armob)
{
Object *ob;
/* go through all objects in database */
for (ob= G.main->object.first; ob; ob= ob->id.next) {
/* if parent is bone in this armature, apply corrections */
if ((ob->parent == armob) && (ob->partype == PARBONE)) {
/* apply current transform from parent (not yet destroyed),
* then calculate new parent inverse matrix
*/
apply_obmat(ob);
what_does_parent(ob);
Mat4Invert(ob->parentinv, workob.obmat);
}
}
}
/* set the current pose as the restpose */
@ -463,6 +477,9 @@ void apply_armature_pose2bones(void)
}
arm= get_armature(ob);
/* helpful warnings... */
// TODO: add warnings to be careful about actions, applying deforms first, etc.
/* Get editbones of active armature to alter */
if (G.edbo.first) BLI_freelistN(&G.edbo);
make_boneList(&G.edbo, &arm->bonebase, NULL);
@ -504,7 +521,10 @@ void apply_armature_pose2bones(void)
/* clear transform values for pchan */
pchan->loc[0]= pchan->loc[1]= pchan->loc[2]= 0;
pchan->quat[1]= pchan->quat[2]= pchan->quat[3]= 0;
pchan->quat[0]= pchan->size[1]= 1;
pchan->quat[0]= pchan->size[0]= pchan->size[1]= pchan->size[2]= 1;
/* set anim lock */
curbone->flag |= BONE_UNKEYED;
}
/* convert editbones back to bones */

@ -4370,6 +4370,9 @@ static void do_view3d_pose_armaturemenu(void *arg, int event)
case 18:
pose_autoside_names(event-16);
break;
case 19: /* assign pose as restpose */
apply_armature_pose2bones();
break;
}
allqueue(REDRAWVIEW3D, 0);
@ -4395,6 +4398,7 @@ static uiBlock *view3d_pose_armaturemenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Relax Pose|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Pose as Restpose|Ctrl A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");