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).
This commit is contained in:
@@ -80,6 +80,8 @@ typedef struct ReebNode {
|
||||
int symmetry_flag;
|
||||
float symmetry_axis[3];
|
||||
/*********************************/
|
||||
|
||||
float *no;
|
||||
|
||||
int index;
|
||||
float weight;
|
||||
|
||||
@@ -446,10 +446,11 @@ typedef struct ToolSettings {
|
||||
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 @@ typedef struct Scene {
|
||||
#define SK_CONVERT_CUT_CORRELATION 3
|
||||
#define SK_CONVERT_RETARGET 4
|
||||
|
||||
/* toolsettings->skgen_retarget_options */
|
||||
#define SK_RETARGET_ROLL 1
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2321,18 +2321,19 @@ static void view3d_panel_bonesketch_spaces(short cntrl)
|
||||
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;
|
||||
|
||||
|
||||
@@ -2264,6 +2264,7 @@ static void retargetArctoArcAggresive(RigGraph *rigg, RigArc *iarc, RigNode *ino
|
||||
else
|
||||
{
|
||||
vec1 = node_end->p;
|
||||
no = node_end->no;
|
||||
}
|
||||
|
||||
if (edge->bone)
|
||||
@@ -2349,7 +2350,7 @@ static void retargetArctoArcLength(RigGraph *rigg, RigArc *iarc, RigNode *inode_
|
||||
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 @@ void *exec_retargetArctoArc(void *param)
|
||||
|
||||
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
|
||||
|
||||
@@ -362,6 +362,11 @@ ReebNode *pointToNode(SK_Point *pt)
|
||||
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 @@ ReebArc *strokeToArc(SK_Stroke *stk)
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user