Revision: 16300
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16300
Author:   aligorith
Date:     2008-08-29 14:24:07 +0200 (Fri, 29 Aug 2008)

Log Message:
-----------
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

Modified Paths:
--------------
    trunk/blender/source/blender/src/drawgpencil.c
    trunk/blender/source/blender/src/editarmature.c
    trunk/blender/source/blender/src/header_view3d.c

Modified: trunk/blender/source/blender/src/drawgpencil.c
===================================================================
--- trunk/blender/source/blender/src/drawgpencil.c      2008-08-29 11:15:24 UTC 
(rev 16299)
+++ trunk/blender/source/blender/src/drawgpencil.c      2008-08-29 12:24:07 UTC 
(rev 16300)
@@ -145,6 +145,13 @@
        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 @@
                /* 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 @@
                        
                        /* options */
                        uiBlockBeginAlign(block);
-                               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);
+                               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);

Modified: trunk/blender/source/blender/src/editarmature.c
===================================================================
--- trunk/blender/source/blender/src/editarmature.c     2008-08-29 11:15:24 UTC 
(rev 16299)
+++ trunk/blender/source/blender/src/editarmature.c     2008-08-29 12:24:07 UTC 
(rev 16300)
@@ -440,9 +440,23 @@
 }
 
 /* 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 @@
        }
        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 @@
                /* 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 */

Modified: trunk/blender/source/blender/src/header_view3d.c
===================================================================
--- trunk/blender/source/blender/src/header_view3d.c    2008-08-29 11:15:24 UTC 
(rev 16299)
+++ trunk/blender/source/blender/src/header_view3d.c    2008-08-29 12:24:07 UTC 
(rev 16300)
@@ -4370,6 +4370,9 @@
        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 @@
        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, "");
 


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to