Revision: 15487
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15487
Author:   theeth
Date:     2008-07-08 18:22:18 +0200 (Tue, 08 Jul 2008)

Log Message:
-----------
Start multi resolution search on first arc and smarter search (match first two 
levels only).

Now need a way to go back to lower levels at shared nodes.

Modified Paths:
--------------
    branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c
    branches/harmonic-skeleton/source/blender/src/autoarmature.c
    branches/harmonic-skeleton/source/blender/src/buttons_editing.c
    branches/harmonic-skeleton/source/blender/src/reeb.c

Modified: branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c
===================================================================
--- branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c    
2008-07-08 12:18:43 UTC (rev 15486)
+++ branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c    
2008-07-08 16:22:18 UTC (rev 15487)
@@ -328,7 +328,7 @@
        if (include_root)
        {
                BNode *newNode = BLI_otherNode(rootArc, node);
-               depth = BLI_subtreeShape(newNode, rootArc, 0);
+               return BLI_subtreeShape(newNode, rootArc, 0);
        }
        else
        {
@@ -353,9 +353,9 @@
                                }
                        }
                }
+               
+               return 10 * depth + 1;
        }
-       
-       return 10 * depth + 1;
 }
 
 /********************************* SYMMETRY DETECTION 
**************************************************/

Modified: branches/harmonic-skeleton/source/blender/src/autoarmature.c
===================================================================
--- branches/harmonic-skeleton/source/blender/src/autoarmature.c        
2008-07-08 12:18:43 UTC (rev 15486)
+++ branches/harmonic-skeleton/source/blender/src/autoarmature.c        
2008-07-08 16:22:18 UTC (rev 15487)
@@ -1238,6 +1238,26 @@
        }
 }
 
+static void matchMultiResolutionArc(RigNode *start_node, RigArc *next_iarc, 
ReebArc *next_earc)
+{
+       ReebNode *enode = next_earc->head;
+       int ishape, eshape;
+       int MAGIC_NUMBER = 100; /* FIXME */
+
+       ishape = BLI_subtreeShape((BNode*)start_node, (BArc*)next_iarc, 1) % 
MAGIC_NUMBER;
+       eshape = BLI_subtreeShape((BNode*)enode, (BArc*)next_earc, 1) % 
MAGIC_NUMBER;
+       
+       while (ishape > eshape && next_earc->link)
+       {
+               next_earc = next_earc->link;
+               enode = next_earc->head;
+               eshape = BLI_subtreeShape((BNode*)enode, (BArc*)next_earc, 1) % 
MAGIC_NUMBER;
+       } 
+
+       next_earc->flag = 1; // mark as taken
+       next_iarc->link = next_earc;
+}
+
 static void findCorrespondingArc(RigArc *start_arc, RigNode *start_node, 
RigArc *next_iarc)
 {
        ReebNode *enode = start_node->link;
@@ -1257,25 +1277,12 @@
                        next_earc->symmetry_group == symmetry_group &&
                        next_earc->symmetry_level == symmetry_level)
                {
-                       int ishape, eshape;
-
                        printf("-----------------------\n");
                        printf("CORRESPONDING ARC FOUND\n");
                        RIG_printArcBones(next_iarc);
                        printf("flag %i -- symmetry level %i -- symmetry flag 
%i\n", next_earc->flag, next_earc->symmetry_level, next_earc->symmetry_flag);
                        
-                       ishape = BLI_subtreeShape((BNode*)start_node, 
(BArc*)next_iarc, 1);
-                       eshape = BLI_subtreeShape((BNode*)enode, 
(BArc*)next_earc, 1);
-                       
-                       while (ishape > eshape && next_earc->link)
-                       {
-                               next_earc = next_earc->link;
-                               enode = next_earc->head; //enode->link;
-                               eshape = BLI_subtreeShape((BNode*)enode, 
(BArc*)next_earc, 1);
-                       } 
-
-                       next_earc->flag = 1; // mark as taken
-                       next_iarc->link = next_earc;
+                       matchMultiResolutionArc(start_node, next_iarc, 
next_earc);
                        break;
                }
        }
@@ -1347,12 +1354,12 @@
        
        earc = reebg->arcs.first;
        iarc = (RigArc*)rigg->head->arcs[0];
+       inode = iarc->tail;
        
-       iarc->link = earc;
-       earc->flag = 1;
-       
+       matchMultiResolutionArc(inode, iarc, earc);
+
+       earc = iarc->link; /* find might have changed it */
        enode = earc->head;
-       inode = iarc->tail;
 
        inode->link = enode;
 

Modified: branches/harmonic-skeleton/source/blender/src/buttons_editing.c
===================================================================
--- branches/harmonic-skeleton/source/blender/src/buttons_editing.c     
2008-07-08 12:18:43 UTC (rev 15486)
+++ branches/harmonic-skeleton/source/blender/src/buttons_editing.c     
2008-07-08 16:22:18 UTC (rev 15487)
@@ -5009,6 +5009,19 @@
        allqueue(REDRAWVIEW3D, 0);
 }
 
+static void skgen_graph_block(uiBlock *block)
+{
+       uiBlockBeginAlign(block);
+       uiDefButS(block, NUM, B_DIFF, "Resolution:",                            
                        1025,150,225,19, 
&G.scene->toolsettings->skgen_resolution,10.0,1000.0, 0, 0,            
"Specifies the resolution of the graph's embedding");
+       uiDefButBitS(block, TOG, SKGEN_HARMONIC, B_DIFF,                "H",    
                1250,150, 25,19, &G.scene->toolsettings->skgen_options, 0, 0, 
0, 0,                                     "Apply harmonic smoothing to the 
weighting");
+       uiDefButBitS(block, TOG, SKGEN_FILTER_INTERNAL, B_DIFF, "Filter In",    
1025,130, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,             
                        "Filter internal small arcs from graph");
+       uiDefButF(block, NUM, B_DIFF,                                           
        "",                             1111,130,164,19, 
&G.scene->toolsettings->skgen_threshold_internal,0.0, 10.0, 10, 0,     "Specify 
the threshold ratio for filtering internal arcs");
+       uiDefButBitS(block, TOG, SKGEN_FILTER_EXTERNAL, B_DIFF, "Filter Ex",    
1025,110, 53,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,             
                        "Filter external small arcs from graph");
+       uiDefButBitS(block, TOG, SKGEN_FILTER_SMART,    B_DIFF, "Sm",           
        1078,110, 30,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,     
                                "Smart Filtering");
+       uiDefButF(block, NUM, B_DIFF,                                           
        "",                             1111,110,164,19, 
&G.scene->toolsettings->skgen_threshold_external,0.0, 10.0, 10, 0,     "Specify 
the threshold ratio for filtering external arcs");
+       uiBlockEndAlign(block);
+}
+
 static void editing_panel_mesh_skgen_display(Object *ob, Mesh *me)
 {
        uiBlock *block;
@@ -5022,17 +5035,9 @@
        uiButSetFunc(but, skgen_graphgen, NULL, NULL);
        but = uiDefBut(block, BUT, B_DIFF, "Free",                              
        1150,170,125,19, 0, 0, 0, 0, 0, "Free Graph from Mesh");
        uiButSetFunc(but, skgen_graphfree, NULL, NULL);
-
-       uiBlockBeginAlign(block);
-       uiDefButS(block, NUM, B_DIFF, "Resolution:",                            
                        1025,150,225,19, 
&G.scene->toolsettings->skgen_resolution,10.0,1000.0, 0, 0,            
"Specifies the resolution of the graph's embedding");
-       uiDefButBitS(block, TOG, SKGEN_HARMONIC, B_DIFF,                "H",    
                1250,150, 25,19, &G.scene->toolsettings->skgen_options, 0, 0, 
0, 0,                                     "Apply harmonic smoothing to the 
weighting");
-       uiDefButBitS(block, TOG, SKGEN_FILTER_INTERNAL, B_DIFF, "Filter In",    
1025,130, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,             
                        "Filter internal small arcs from graph");
-       uiDefButF(block, NUM, B_DIFF,                                           
        "",                             1111,130,164,19, 
&G.scene->toolsettings->skgen_threshold_internal,0.0, 5.0, 10, 0,      "Specify 
the threshold ratio for filtering internal arcs");
-       uiDefButBitS(block, TOG, SKGEN_FILTER_EXTERNAL, B_DIFF, "Filter Ex",    
1025,110, 53,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,             
                        "Filter external small arcs from graph");
-       uiDefButBitS(block, TOG, SKGEN_FILTER_SMART,    B_DIFF, "Sm",           
        1078,110, 30,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,     
                                "Smart Filtering");
-       uiDefButF(block, NUM, B_DIFF,                                           
        "",                             1111,110,164,19, 
&G.scene->toolsettings->skgen_threshold_external,0.0, 5.0, 10, 0,      "Specify 
the threshold ratio for filtering external arcs");
-       uiBlockEndAlign(block);
        
+       skgen_graph_block(block);
+
        uiDefButBitS(block, TOG, SKGEN_DISP_LENGTH, REDRAWVIEW3D,       
"Length",                       1025, 60, 83,19, 
&G.scene->toolsettings->skgen_options, 0, 0, 0, 0,             "Show Length");
        uiDefButBitS(block, TOG, SKGEN_DISP_WEIGHT, REDRAWVIEW3D,       
"Weight",                       1108, 60, 83,19, 
&G.scene->toolsettings->skgen_options, 0, 0, 0, 0,             "Show Weight");
        uiDefButBitS(block, TOG, SKGEN_DISP_ORIG, REDRAWVIEW3D,         
"Original",                     1191, 60, 84,19, 
&G.scene->toolsettings->skgen_options, 0, 0, 0, 0,             "Show Original 
Graph");
@@ -5050,15 +5055,7 @@
        
        uiDefBut(block, BUT, B_RETARGET_SKELETON, "Retarget Skeleton",          
        1025,170,250,19, 0, 0, 0, 0, 0, "Retarget Selected Armature to this 
Mesh");
 
-       uiBlockBeginAlign(block);
-       uiDefButS(block, NUM, B_DIFF, "Resolution:",                            
                        1025,150,225,19, 
&G.scene->toolsettings->skgen_resolution,10.0,1000.0, 0, 0,            
"Specifies the resolution of the graph's embedding");
-       uiDefButBitS(block, TOG, SKGEN_HARMONIC, B_DIFF,                "H",    
                1250,150, 25,19, &G.scene->toolsettings->skgen_options, 0, 0, 
0, 0,                                     "Apply harmonic smoothing to the 
weighting");
-       uiDefButBitS(block, TOG, SKGEN_FILTER_INTERNAL, B_DIFF, "Filter In",    
1025,130, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,             
                        "Filter internal small arcs from graph");
-       uiDefButF(block, NUM, B_DIFF,                                           
        "",                             1111,130,164,19, 
&G.scene->toolsettings->skgen_threshold_internal,0.0, 5.0, 10, 0,      "Specify 
the threshold ratio for filtering internal arcs");
-       uiDefButBitS(block, TOG, SKGEN_FILTER_EXTERNAL, B_DIFF, "Filter Ex",    
1025,110, 53,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,             
                        "Filter external small arcs from graph");
-       uiDefButBitS(block, TOG, SKGEN_FILTER_SMART,    B_DIFF, "Sm",           
        1078,110, 30,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,     
                                "Smart Filtering");
-       uiDefButF(block, NUM, B_DIFF,                                           
        "",                             1111,110,164,19, 
&G.scene->toolsettings->skgen_threshold_external,0.0, 5.0, 10, 0,      "Specify 
the threshold ratio for filtering external arcs");
-       uiBlockEndAlign(block);
+       skgen_graph_block(block);
 
        uiDefButF(block, NUM, B_DIFF,                                           
        "Ang:",                 1025, 60, 83,19, 
&G.scene->toolsettings->skgen_retarget_angle_weight, 0, 10, 1, 0,              
"Angle Weight");
        uiDefButF(block, NUM, B_DIFF,                                           
        "Len:",                 1108, 60, 83,19, 
&G.scene->toolsettings->skgen_retarget_length_weight, 0, 10, 1, 0,             
"Length Weight");
@@ -5086,15 +5083,7 @@
        
        uiDefBut(block, BUT, B_GEN_SKELETON, "Generate",                        
1025,170,250,19, 0, 0, 0, 0, 0, "Generate Skeleton from Mesh");
 
-       uiBlockBeginAlign(block);
-       uiDefButS(block, NUM, B_DIFF, "Resolution:",                            
                        1025,150,225,19, 
&G.scene->toolsettings->skgen_resolution,10.0,1000.0, 0, 0,            
"Specifies the resolution of the graph's embedding");
-       uiDefButBitS(block, TOG, SKGEN_HARMONIC, B_DIFF,                "H",    
                1250,150, 25,19, &G.scene->toolsettings->skgen_options, 0, 0, 
0, 0,                                     "Apply harmonic smoothing to the 
weighting");
-       uiDefButBitS(block, TOG, SKGEN_FILTER_INTERNAL, B_DIFF, "Filter In",    
1025,130, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,             
                        "Filter internal small arcs from graph");
-       uiDefButF(block, NUM, B_DIFF,                                           
        "",                             1111,130,164,19, 
&G.scene->toolsettings->skgen_threshold_internal,0.0, 5.0, 10, 0,      "Specify 
the threshold ratio for filtering internal arcs");
-       uiDefButBitS(block, TOG, SKGEN_FILTER_EXTERNAL, B_DIFF, "Filter Ex",    
1025,110, 53,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,             
                        "Filter external small arcs from graph");
-       uiDefButBitS(block, TOG, SKGEN_FILTER_SMART,    B_DIFF, "Sm",           
        1078,110, 30,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0,     
                                "Smart Filtering");
-       uiDefButF(block, NUM, B_DIFF,                                           
        "",                             1111,110,164,19, 
&G.scene->toolsettings->skgen_threshold_external,0.0, 5.0, 10, 0,      "Specify 
the threshold ratio for filtering external arcs");
-       uiBlockEndAlign(block);

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to