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:
authorTon Roosendaal <ton@blender.org>2006-11-07 18:47:10 +0300
committerTon Roosendaal <ton@blender.org>2006-11-07 18:47:10 +0300
commit0de4c3c0eba8c0759dfd09553a551600b0166ef4 (patch)
tree6ca2a8a6848208cd99a5bf8fec3236fb5a5401bc /source/blender
parentf34bf8a0cd4f3437f03c1894e507e1b8c2125b9d (diff)
Long wanted feature for animators: option to lock a view to always show
a specific object, so you can see long walkcycles or actions well. Option is per 3d window, in "View Properties" panel. It also can optional lock a view to a single bone even! Temporal movie for fun: http://www.blender.org/bf/0001_0060.avi
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h4
-rw-r--r--source/blender/src/drawview.c12
-rw-r--r--source/blender/src/view.c17
4 files changed, 30 insertions, 5 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 675a8f7f81e..f9a01721046 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3069,6 +3069,7 @@ static void lib_link_screen(FileData *fd, Main *main)
View3D *v3d= (View3D*) sl;
v3d->camera= newlibadr(fd, sc->id.lib, v3d->camera);
+ v3d->ob_centre= newlibadr(fd, sc->id.lib, v3d->ob_centre);
if(v3d->bgpic) {
v3d->bgpic->ima= newlibadr_us(fd, sc->id.lib, v3d->bgpic->ima);
@@ -3222,6 +3223,7 @@ void lib_link_screen_restore(Main *newmain, Scene *curscene)
v3d->camera= restore_pointer_by_name(newmain, (ID *)v3d->camera, 1);
if(v3d->camera==NULL)
v3d->camera= sc->scene->camera;
+ v3d->ob_centre= restore_pointer_by_name(newmain, (ID *)v3d->ob_centre, 1);
if(v3d->bgpic) {
v3d->bgpic->ima= restore_pointer_by_name(newmain, (ID *)v3d->bgpic->ima, 1);
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index be3a5099d7b..11af418a59a 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -93,13 +93,15 @@ typedef struct View3D {
short persp;
short view;
- struct Object *camera;
+ struct Object *camera, *ob_centre;
struct BGpic *bgpic;
struct View3D *localvd;
struct RenderInfo *ri;
struct RetopoViewData *retopo_view_data;
struct ViewDepths *depths;
+ char ob_centre_bone[32]; /* optional string for armature bone to define centre */
+
/**
* The drawing mode for the 3d display. Set to OB_WIRE, OB_SOLID,
* OB_SHADED or OB_TEXTURED */
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 4ad709c0dba..84a33bd225f 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -2470,7 +2470,7 @@ static void view3d_panel_properties(short cntrl) // VIEW3D_HANDLER_SETTINGS
if(uiNewPanel(curarea, block, "View Properties", "View3d", 340, 30, 318, 254)==0) return;
/* to force height */
- uiNewPanelHeight(block, 254);
+ uiNewPanelHeight(block, 264);
if(G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT)) {
uiBlockSetFlag(block, UI_BLOCK_FRONTBUFFER); // force old style frontbuffer draw
@@ -2508,10 +2508,16 @@ static void view3d_panel_properties(short cntrl) // VIEW3D_HANDLER_SETTINGS
uiDefBut(block, LABEL, 1, "Display:", 10, 50, 150, 19, NULL, 0.0, 0.0, 0, 0, "");
+ uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, V3D_SELECT_OUTLINE, REDRAWVIEW3D, "Outline Selected", 10, 30, 140, 19, &vd->flag, 0, 0, 0, 0, "Highlight selected objects with an outline, in Solid, Shaded or Textured viewport shading modes");
- uiDefButBitS(block, TOG, V3D_DRAW_CENTERS, REDRAWVIEW3D, "All Object Centers", 160, 30, 150, 19, &vd->flag, 0, 0, 0, 0, "Draw the center points on all objects");
+ uiDefButBitS(block, TOG, V3D_DRAW_CENTERS, REDRAWVIEW3D, "All Object Centers", 10, 10, 140, 19, &vd->flag, 0, 0, 0, 0, "Draw the center points on all objects");
+ uiDefButBitS(block, TOGN, V3D_HIDE_HELPLINES, REDRAWVIEW3D, "Relationship Lines", 10, -10, 140, 19, &vd->flag, 0, 0, 0, 0, "Draw dashed lines indicating Parent, Constraint, or Hook relationships");
+ uiBlockEndAlign(block);
- uiDefButBitS(block, TOGN, V3D_HIDE_HELPLINES, REDRAWVIEW3D, "Relationship Lines", 10, 6, 140, 19, &vd->flag, 0, 0, 0, 0, "Draw dashed lines indicating Parent, Constraint, or Hook relationships");
+ uiDefBut(block, LABEL, 1, "View Locking:", 160, 50, 150, 19, NULL, 0.0, 0.0, 0, 0, "");
+ uiBlockBeginAlign(block);
+ uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "Object:", 160, 30, 140, 19, &vd->ob_centre, "Lock view to centre always on this Object");
+ uiDefBut(block, TEX, REDRAWVIEW3D, "Bone:", 160, 10, 140, 19, vd->ob_centre_bone, 1, 31, 0, 0, "If view locked to Object, use this Bone to lock to view to");
}
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index 0a5b2a3d5f7..5e87923b111 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -61,6 +61,7 @@
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
+#include "BKE_action.h"
#include "BKE_anim.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -987,7 +988,21 @@ void setviewmatrixview3d()
QuatToMat4(G.vd->viewquat, G.vd->viewmat);
if(G.vd->persp==1) G.vd->viewmat[3][2]-= G.vd->dist;
- i_translate(G.vd->ofs[0], G.vd->ofs[1], G.vd->ofs[2], G.vd->viewmat);
+ if(G.vd->ob_centre) {
+ Object *ob= G.vd->ob_centre;
+ float vec[3];
+
+ VECCOPY(vec, ob->obmat[3]);
+ if(ob->type==OB_ARMATURE && G.vd->ob_centre_bone[0]) {
+ bPoseChannel *pchan= get_pose_channel(ob->pose, G.vd->ob_centre_bone);
+ if(pchan) {
+ VECCOPY(vec, pchan->pose_mat[3]);
+ Mat4MulVecfl(ob->obmat, vec);
+ }
+ }
+ i_translate(-vec[0], -vec[1], -vec[2], G.vd->viewmat);
+ }
+ else i_translate(G.vd->ofs[0], G.vd->ofs[1], G.vd->ofs[2], G.vd->viewmat);
}
}