forked from bartvdbraak/blender
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
This commit is contained in:
parent
f34bf8a0cd
commit
0de4c3c0eb
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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");
|
||||
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user