Revision: 17309
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17309
Author:   theeth
Date:     2008-11-03 18:54:12 +0100 (Mon, 03 Nov 2008)

Log Message:
-----------
Sketch Retargetting: Rolling bone perpendicular to stroke's normal is now 
optional.

Normal pointer added to reeb nodes (the last bone in a chain needs it and can't 
get it from the embedding).

Modified Paths:
--------------
    branches/etch-a-ton/source/blender/include/reeb.h
    branches/etch-a-ton/source/blender/makesdna/DNA_scene_types.h
    branches/etch-a-ton/source/blender/src/drawview.c
    branches/etch-a-ton/source/blender/src/editarmature_retarget.c
    branches/etch-a-ton/source/blender/src/editarmature_sketch.c

Modified: branches/etch-a-ton/source/blender/include/reeb.h
===================================================================
--- branches/etch-a-ton/source/blender/include/reeb.h   2008-11-03 13:33:11 UTC 
(rev 17308)
+++ branches/etch-a-ton/source/blender/include/reeb.h   2008-11-03 17:54:12 UTC 
(rev 17309)
@@ -80,6 +80,8 @@
        int symmetry_flag;
        float symmetry_axis[3];
        /*********************************/
+       
+       float *no;
 
        int index;
        float weight;

Modified: branches/etch-a-ton/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/etch-a-ton/source/blender/makesdna/DNA_scene_types.h       
2008-11-03 13:33:11 UTC (rev 17308)
+++ branches/etch-a-ton/source/blender/makesdna/DNA_scene_types.h       
2008-11-03 17:54:12 UTC (rev 17309)
@@ -446,10 +446,11 @@
        char bone_sketching;
        char bone_sketching_convert;
        char skgen_subdivision_number;
+       char skgen_retarget_options;
        
        /* Alt+RMB option */
        char edge_mode;
-       char pad3[4];
+       char pad3[3];
 } ToolSettings;
 
 /* Used by all brushes to store their properties, which can be directly set
@@ -883,6 +884,10 @@
 #define        SK_CONVERT_CUT_CORRELATION              3
 #define        SK_CONVERT_RETARGET                             4
 
+/* toolsettings->skgen_retarget_options */
+#define        SK_RETARGET_ROLL                                1
+
+
 #ifdef __cplusplus
 }
 #endif

Modified: branches/etch-a-ton/source/blender/src/drawview.c
===================================================================
--- branches/etch-a-ton/source/blender/src/drawview.c   2008-11-03 13:33:11 UTC 
(rev 17308)
+++ branches/etch-a-ton/source/blender/src/drawview.c   2008-11-03 17:54:12 UTC 
(rev 17309)
@@ -2321,18 +2321,19 @@
                uiBlockBeginAlign(block);
 
                uiDefButC(block, ROW, B_REDR, "Length", 10, yco, 60, 19, 
&G.scene->toolsettings->bone_sketching_convert, 0, SK_CONVERT_CUT_LENGTH, 0, 0, 
                               "Subdivide arcs in bones of equal length");
-               uiDefButF(block, NUM, B_REDR,                                   
"L:",           70, yco, 90, 19, 
&G.scene->toolsettings->skgen_length_limit,0.1,50.0, 10, 0,            "Maximum 
length of the bones when subdividing");
+               uiDefButF(block, NUM, B_REDR,                                   
"L:",           70, yco, 90, 19, 
&G.scene->toolsettings->skgen_length_limit,0.1,50.0, 10, 0,            "Maximum 
length of the subdivided bones");
                yco -= 20;
 
                uiDefButC(block, ROW, B_REDR, "Correlation",    10, yco, 60, 
19, &G.scene->toolsettings->bone_sketching_convert, 0, 
SK_CONVERT_CUT_CORRELATION, 0, 0,                                   "Subdivide 
arcs based on correlation");
-               uiDefButF(block, NUM, B_REDR,                                   
         "T:",                  70, yco, 90, 19, 
&G.scene->toolsettings->skgen_correlation_limit,0.0, 1.0, 0.01, 0,     "Specify 
the threshold correlation for subdivision");
+               uiDefButF(block, NUM, B_REDR,                                   
         "T:",                  70, yco, 90, 19, 
&G.scene->toolsettings->skgen_correlation_limit,0.0, 1.0, 0.01, 0,     
"Correlation threshold for subdivision");
                yco -= 20;
        
                uiDefButC(block, ROW, B_REDR, "Fixed",          10, yco, 60, 
19, &G.scene->toolsettings->bone_sketching_convert, 0, SK_CONVERT_CUT_FIXED, 0, 
0,                                 "Subdivide arcs based on a fixed number of 
bones");
-               uiDefButC(block, NUM, B_REDR,                                   
"N:",           70, yco, 90, 19, 
&G.scene->toolsettings->skgen_subdivision_number,1, 100, 1, 5, "Specify the 
bones to subdivide into");
+               uiDefButC(block, NUM, B_REDR,                                   
"N:",           70, yco, 90, 19, 
&G.scene->toolsettings->skgen_subdivision_number,1, 100, 1, 5, "Number of 
subdivided bones");
                yco -= 20;
 
-               uiDefButC(block, ROW, B_REDR, "Retarget",               10, 
yco,150, 19, &G.scene->toolsettings->bone_sketching_convert, 0, 
SK_CONVERT_RETARGET, 0, 0,                                  "Subdivide arcs 
based on a fixed number of bones");
+               uiDefButC(block, ROW, B_REDR, "Retarget",               10, 
yco,80, 19, &G.scene->toolsettings->bone_sketching_convert, 0, 
SK_CONVERT_RETARGET, 0, 0,                                   "Retarget selected 
bones to stroke");
+               uiDefButBitC(block, TOG, SK_RETARGET_ROLL, B_DIFF,      "Roll", 
        90, yco, 70,19, &G.scene->toolsettings->skgen_retarget_options, 0, 0, 
0, 0,                             "Roll bones perpendicular to view");
                /* button here to select what to do (copy or not), template, 
...*/
                yco -= 20;
 

Modified: branches/etch-a-ton/source/blender/src/editarmature_retarget.c
===================================================================
--- branches/etch-a-ton/source/blender/src/editarmature_retarget.c      
2008-11-03 13:33:11 UTC (rev 17308)
+++ branches/etch-a-ton/source/blender/src/editarmature_retarget.c      
2008-11-03 17:54:12 UTC (rev 17309)
@@ -2264,6 +2264,7 @@
                else
                {
                        vec1 = node_end->p;
+                       no = node_end->no;
                }
                
                if (edge->bone)
@@ -2349,7 +2350,7 @@
                if (bucket == NULL)
                {
                        vec1 = node_end->p;
-                       no = NULL;
+                       no = node_end->no;
                }
 
                /* no need to move virtual edges (space between unconnected 
bones) */           
@@ -2398,11 +2399,11 @@
 
                if (testFlipArc(iarc, inode_start))
                {
-                       repositionBone(rigg, edge, earc->tail->p, 
earc->head->p, NULL);
+                       repositionBone(rigg, edge, earc->tail->p, 
earc->head->p, earc->head->no);
                }
                else
                {
-                       repositionBone(rigg, edge, earc->head->p, 
earc->tail->p, NULL);
+                       repositionBone(rigg, edge, earc->head->p, 
earc->tail->p, earc->tail->no);
                }
        }
        else

Modified: branches/etch-a-ton/source/blender/src/editarmature_sketch.c
===================================================================
--- branches/etch-a-ton/source/blender/src/editarmature_sketch.c        
2008-11-03 13:33:11 UTC (rev 17308)
+++ branches/etch-a-ton/source/blender/src/editarmature_sketch.c        
2008-11-03 17:54:12 UTC (rev 17309)
@@ -362,6 +362,11 @@
        node = MEM_callocN(sizeof(ReebNode), "reeb node");
        VECCOPY(node->p, pt->p);
        
+       if (G.scene->toolsettings->skgen_retarget_options & SK_RETARGET_ROLL)
+       {
+               node->no = pt->no;
+       }
+       
        return node;
 }
 
@@ -380,7 +385,10 @@
        for (i = 0; i < arc->bcount; i++)
        {
                VECCOPY(arc->buckets[i].p, stk->points[i + 1].p);
-               arc->buckets[i].no = stk->points[i + 1].no;
+               if (G.scene->toolsettings->skgen_retarget_options & 
SK_RETARGET_ROLL)
+               {
+                       arc->buckets[i].no = stk->points[i + 1].no;
+               }
        }
        
        return arc;


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

Reply via email to