Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenloader/intern/readfile.c6
-rw-r--r--source/blender/makesdna/DNA_armature_types.h2
-rw-r--r--source/blender/src/buttons_editing.c7
-rw-r--r--source/blender/src/drawarmature.c39
4 files changed, 35 insertions, 19 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index c974187fffc..ede1c3be45c 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5009,6 +5009,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
if(main->versionfile <= 239) {
+ bArmature *arm;
Object *ob;
Scene *sce= main->scene.first;
Camera *cam= main->camera.first;
@@ -5030,6 +5031,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
+ /* updating stepsize for ghost drawing */
+ for(arm= main->armature.first; arm; arm= arm->id.next) {
+ if (arm->ghostsize==0) arm->ghostsize=1;
+ }
+
while(sce) {
/* make 'innervert' the default subdivide type, for backwards compat */
sce->toolsettings->cornertype=1;
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index b31a803718e..77b8ffd2286 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -77,7 +77,7 @@ typedef struct bArmature {
int flag;
int drawtype;
int deformflag;
- short ghostep, pad;
+ short ghostep, ghostsize;
}bArmature;
/* armature->flag */
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 1eeb7e7793f..c42420d47b2 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -2758,9 +2758,10 @@ static void editing_panel_armature_type(Object *ob, bArmature *arm)
uiDefButI(block, ROW, REDRAWVIEW3D, "B-Bone", 155, 100,70,20, &arm->drawtype, 0, ARM_B_BONE, 0, 0, "Draw bones as boxes, showing subdivision and b-splines");
uiDefButI(block, ROW, REDRAWVIEW3D, "Envelope", 225, 100,85,20, &arm->drawtype, 0, ARM_ENVELOPE, 0, 0, "Draw bones as extruded spheres, showing deformation influence volume");
- uiDefButBitI(block, TOG, ARM_DRAWAXES, REDRAWVIEW3D, "Draw Axes", 10, 80,100,20, &arm->flag, 0, 0, 0, 0, "Draw bone axes");
- uiDefButBitI(block, TOG, ARM_DRAWNAMES, REDRAWVIEW3D, "Draw Names", 110,80,100,20, &arm->flag, 0, 0, 0, 0, "Draw bone names");
- uiDefButS(block, NUM, REDRAWVIEW3D, "Ghost: ", 210,80,100,20, &arm->ghostep, 0.0f, 30.0f, 0, 0, "Draw Ghosts around current frame, for current Action");
+ uiDefButBitI(block, TOG, ARM_DRAWAXES, REDRAWVIEW3D, "Draw Axes", 10, 80,80,20, &arm->flag, 0, 0, 0, 0, "Draw bone axes");
+ uiDefButBitI(block, TOG, ARM_DRAWNAMES, REDRAWVIEW3D, "Draw Names", 90,80,80,20, &arm->flag, 0, 0, 0, 0, "Draw bone names");
+ uiDefButS(block, NUM, REDRAWVIEW3D, "Ghost: ", 170,80,80,20, &arm->ghostep, 0.0f, 30.0f, 0, 0, "Draw Ghosts around current frame, for current Action");
+ uiDefButS(block, NUM, REDRAWVIEW3D, "Step: ", 250,80,60,20, &arm->ghostsize, 1.0f, 20.0f, 0, 0, "How many frames between Ghost instances");
uiBlockEndAlign(block);
uiDefBut(block, LABEL, 0, "Deform Options", 10,60,150,20, 0, 0, 0, 0, 0, "");
diff --git a/source/blender/src/drawarmature.c b/source/blender/src/drawarmature.c
index 1a6133c8f70..fc02d18c655 100644
--- a/source/blender/src/drawarmature.c
+++ b/source/blender/src/drawarmature.c
@@ -1721,8 +1721,8 @@ static void draw_ghost_poses(Base *base)
bArmature *arm= ob->data;
bPose *posen, *poseo;
bActionStrip *strip;
- float cur, start, end, stepsize, range, colfac, actframe;
- int cfrao, maptime, flago;
+ float cur, start, end, stepsize, range, colfac, actframe, ctime;
+ int cfrao, maptime, flago, ipoflago;
/* pre conditions, get an action with sufficient frames */
if(ob->action==NULL)
@@ -1732,8 +1732,8 @@ static void draw_ghost_poses(Base *base)
if(start==end)
return;
- stepsize= 1.0f;
- range= (float)(arm->ghostep);
+ stepsize= (float)(arm->ghostsize);
+ range= (float)(arm->ghostep)*stepsize + 0.5f; /* plus half to make the for loop end correct */
/* we only map time for armature when an active strip exists */
for (strip=ob->nlastrips.first; strip; strip=strip->next)
@@ -1749,6 +1749,8 @@ static void draw_ghost_poses(Base *base)
else actframe= CFRA;
flago= arm->flag;
arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES);
+ ipoflago= ob->ipoflag;
+ ob->ipoflag |= OB_DISABLE_PATH;
/* copy the pose */
poseo= ob->pose;
@@ -1759,17 +1761,18 @@ static void draw_ghost_poses(Base *base)
glEnable(GL_BLEND);
if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
- /* draw from lowest blend to darkest */
- for(cur= 0.5f; cur<range; cur+=stepsize) {
+ /* draw from darkest blend to lowest */
+ for(cur= stepsize; cur<range; cur+=stepsize) {
- colfac= cur/range;
+ ctime= cur - fmod((float)cfrao, stepsize); /* ensures consistant stepping */
+ colfac= ctime/range;
BIF_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0f*sqrt(colfac)));
/* only within action range */
- if(actframe+cur >= start && actframe+cur <= end) {
+ if(actframe+ctime >= start && actframe+ctime <= end) {
- if(maptime) CFRA= (int)get_action_frame_inv(ob, actframe+cur);
- else CFRA= (int)(actframe+cur);
+ if(maptime) CFRA= (int)get_action_frame_inv(ob, actframe+ctime);
+ else CFRA= (int)floor(actframe+ctime);
if(CFRA!=cfrao) {
do_all_pose_actions(ob);
@@ -1777,12 +1780,17 @@ static void draw_ghost_poses(Base *base)
draw_pose_channels(base, OB_WIRE);
}
}
+
+ ctime= cur + fmod((float)cfrao, stepsize) - stepsize+1.0f; /* ensures consistant stepping */
+ colfac= ctime/range;
+ BIF_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0f*sqrt(colfac)));
+
/* only within action range */
- if(actframe-cur >= start && actframe-cur <= end) {
-
- if(maptime) CFRA= (int)get_action_frame_inv(ob, actframe-cur);
- else CFRA= (int)(actframe-cur);
+ if(actframe-ctime >= start && actframe-ctime <= end) {
+ if(maptime) CFRA= (int)get_action_frame_inv(ob, actframe-ctime);
+ else CFRA= (int)floor(actframe-ctime);
+
if(CFRA!=cfrao) {
do_all_pose_actions(ob);
where_is_pose(ob);
@@ -1801,8 +1809,9 @@ static void draw_ghost_poses(Base *base)
ob->pose= poseo;
arm->flag= flago;
armature_rebuild_pose(ob, ob->data);
-
ob->flag |= OB_POSEMODE;
+ ob->ipoflag= ipoflago;
+
}
/* called from drawobject.c */