Revision: 18371 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18371 Author: theeth Date: 2009-01-06 19:10:13 +0100 (Tue, 06 Jan 2009)
Log Message: ----------- In the panel, next to the number of joints, display the name of the current bone while sketching joints. Displays "Bone offset" when the next bone is not connected. Displays "Done" when all joints have been draw (note: you can draw more joints then needed, the retargetting algo will use the most useful ones). Convert gesture is back. This time, it's a 3 straight line that cross itself once gesture (like drawing a triangle and recrossing the first line). Modified Paths: -------------- branches/etch-a-ton/source/blender/include/BIF_retarget.h branches/etch-a-ton/source/blender/include/BIF_sketch.h branches/etch-a-ton/source/blender/include/reeb.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/BIF_retarget.h =================================================================== --- branches/etch-a-ton/source/blender/include/BIF_retarget.h 2009-01-06 17:38:44 UTC (rev 18370) +++ branches/etch-a-ton/source/blender/include/BIF_retarget.h 2009-01-06 18:10:13 UTC (rev 18371) @@ -148,6 +148,7 @@ void BIF_retargetArc(ReebArc *earc, RigGraph *template_rigg); RigGraph *RIG_graphFromArmature(struct Object *ob, struct bArmature *arm); int RIG_nbJoints(RigGraph *rg); +char *RIG_nameBone(RigGraph *rg, int arc_index, int bone_index); void RIG_freeRigGraph(BGraph *rg); #endif /* BIF_RETARGET_H */ Modified: branches/etch-a-ton/source/blender/include/BIF_sketch.h =================================================================== --- branches/etch-a-ton/source/blender/include/BIF_sketch.h 2009-01-06 17:38:44 UTC (rev 18370) +++ branches/etch-a-ton/source/blender/include/BIF_sketch.h 2009-01-06 18:10:13 UTC (rev 18371) @@ -37,6 +37,7 @@ int BIF_currentTemplate(); void BIF_freeTemplates(); void BIF_setTemplate(int); -int BIF_nbJointsTemplate(); +int BIF_nbJointsTemplate(); +char * BIF_nameBoneTemplate(); #endif /* BIF_SKETCH_H */ Modified: branches/etch-a-ton/source/blender/include/reeb.h =================================================================== --- branches/etch-a-ton/source/blender/include/reeb.h 2009-01-06 17:38:44 UTC (rev 18370) +++ branches/etch-a-ton/source/blender/include/reeb.h 2009-01-06 18:10:13 UTC (rev 18371) @@ -28,7 +28,7 @@ #ifndef REEB_H_ #define REEB_H_ -//#define WITH_BF_REEB +#define WITH_BF_REEB #include "DNA_listBase.h" Modified: branches/etch-a-ton/source/blender/src/drawview.c =================================================================== --- branches/etch-a-ton/source/blender/src/drawview.c 2009-01-06 17:38:44 UTC (rev 18370) +++ branches/etch-a-ton/source/blender/src/drawview.c 2009-01-06 18:10:13 UTC (rev 18371) @@ -2291,9 +2291,10 @@ static void view3d_panel_bonesketch_spaces(short cntrl) { static int template_index; - static char joint_label[32]; + static char joint_label[128]; uiBlock *block; uiBut *but; + char *bone_name; int yco = 130, height = 140; int nb_joints; @@ -2379,8 +2380,10 @@ nb_joints = G.totvertsel; } - BLI_snprintf(joint_label, 32, "%i joints", nb_joints); + bone_name = BIF_nameBoneTemplate(); + BLI_snprintf(joint_label, 32, "%i joints: %s", nb_joints, bone_name); + uiDefBut(block, LABEL, 1, joint_label, 10, yco, 200, 20, NULL, 0.0, 0.0, 0, 0, ""); yco -= 20; Modified: branches/etch-a-ton/source/blender/src/editarmature_retarget.c =================================================================== --- branches/etch-a-ton/source/blender/src/editarmature_retarget.c 2009-01-06 17:38:44 UTC (rev 18370) +++ branches/etch-a-ton/source/blender/src/editarmature_retarget.c 2009-01-06 18:10:13 UTC (rev 18371) @@ -2903,6 +2903,36 @@ editbones_to_armature(rigg->editbones, rigg->ob); } +char *RIG_nameBone(RigGraph *rg, int arc_index, int bone_index) +{ + RigArc *arc = BLI_findlink(&rg->arcs, arc_index); + RigEdge *iedge; + + if (arc == NULL) + { + return "None"; + } + + if (bone_index == BLI_countlist(&arc->edges)) + { + return "Last joint"; + } + + iedge = BLI_findlink(&arc->edges, bone_index); + + if (iedge == NULL) + { + return "Done"; + } + + if (iedge->bone == NULL) + { + return "Bone offset"; + } + + return iedge->bone->name; +} + int RIG_nbJoints(RigGraph *rg) { RigArc *arc; Modified: branches/etch-a-ton/source/blender/src/editarmature_sketch.c =================================================================== --- branches/etch-a-ton/source/blender/src/editarmature_sketch.c 2009-01-06 17:38:44 UTC (rev 18370) +++ branches/etch-a-ton/source/blender/src/editarmature_sketch.c 2009-01-06 18:10:13 UTC (rev 18371) @@ -189,6 +189,8 @@ void sk_applyMergeGesture(SK_Gesture *gest, SK_Sketch *sketch); int sk_detectReverseGesture(SK_Gesture *gest, SK_Sketch *sketch); void sk_applyReverseGesture(SK_Gesture *gest, SK_Sketch *sketch); +int sk_detectConvertGesture(SK_Gesture *gest, SK_Sketch *sketch); +void sk_applyConvertGesture(SK_Gesture *gest, SK_Sketch *sketch); /******************** GESTURE ACTIONS ******************************/ @@ -201,6 +203,7 @@ {"Delete", sk_detectDeleteGesture, sk_applyDeleteGesture}, {"Merge", sk_detectMergeGesture, sk_applyMergeGesture}, {"Reverse", sk_detectReverseGesture, sk_applyReverseGesture}, + {"Convert", sk_detectConvertGesture, sk_applyConvertGesture}, {"", NULL, NULL} }; @@ -340,6 +343,27 @@ } } +char * BIF_nameBoneTemplate() +{ + SK_Sketch *stk = GLOBAL_sketch; + RigGraph *rg; + int index = 0; + + if (stk && stk->active_stroke != NULL) + { + index = stk->active_stroke->nb_points; + } + + rg = sk_makeTemplateGraph(G.scene->toolsettings->skgen_template); + + if (rg == NULL) + { + return ""; + } + + return RIG_nameBone(rg, 0, index); +} + void BIF_freeTemplates() { if (TEMPLATES_MENU != NULL) @@ -2450,6 +2474,20 @@ } } +int sk_detectConvertGesture(SK_Gesture *gest, SK_Sketch *sketch) +{ + if (gest->nb_segments == 3 && gest->nb_self_intersections == 1) + { + return 1; + } + return 0; +} + +void sk_applyConvertGesture(SK_Gesture *gest, SK_Sketch *sketch) +{ + sk_convert(sketch); +} + static void sk_initGesture(SK_Gesture *gest, SK_Sketch *sketch) { gest->intersections.first = gest->intersections.last = NULL; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs