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).
This commit is contained in:
@@ -148,6 +148,7 @@ typedef struct RigControl {
|
||||
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 */
|
||||
|
||||
@@ -37,6 +37,7 @@ char *BIF_listTemplates();
|
||||
int BIF_currentTemplate();
|
||||
void BIF_freeTemplates();
|
||||
void BIF_setTemplate(int);
|
||||
int BIF_nbJointsTemplate();
|
||||
int BIF_nbJointsTemplate();
|
||||
char * BIF_nameBoneTemplate();
|
||||
|
||||
#endif /* BIF_SKETCH_H */
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#ifndef REEB_H_
|
||||
#define REEB_H_
|
||||
|
||||
//#define WITH_BF_REEB
|
||||
#define WITH_BF_REEB
|
||||
|
||||
#include "DNA_listBase.h"
|
||||
|
||||
|
||||
@@ -2291,9 +2291,10 @@ static void assign_template_sketch_armature(void *arg1, void *arg2)
|
||||
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,7 +2380,9 @@ static void view3d_panel_bonesketch_spaces(short cntrl)
|
||||
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;
|
||||
|
||||
@@ -2903,6 +2903,36 @@ static void retargetGraphs(RigGraph *rigg)
|
||||
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;
|
||||
|
||||
@@ -189,6 +189,8 @@ int sk_detectMergeGesture(SK_Gesture *gest, SK_Sketch *sketch);
|
||||
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 @@ SK_GestureAction GESTURE_ACTIONS[] =
|
||||
{"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 @@ int BIF_nbJointsTemplate()
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ void sk_applyReverseGesture(SK_Gesture *gest, SK_Sketch *sketch)
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user