3D Window "Transform properties" was using bad globals for buttons, this
caused things not work with multiple 3d windows open, and (in editmode)
set one panel to "Local" and the other to "Global".

Also:
- added undo push for moving bone to a layer
- protected Ikey for posemode to not show a menu without selection
This commit is contained in:
2006-11-27 15:23:21 +00:00
parent 9971fdb5c1
commit cdced41fb9
6 changed files with 105 additions and 87 deletions

View File

@@ -3661,6 +3661,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
v3d->afterdraw.first= v3d->afterdraw.last= NULL; v3d->afterdraw.first= v3d->afterdraw.last= NULL;
v3d->clipbb= newdataadr(fd, v3d->clipbb); v3d->clipbb= newdataadr(fd, v3d->clipbb);
v3d->retopo_view_data= NULL; v3d->retopo_view_data= NULL;
v3d->properties_storage= NULL;
} }
else if (sl->spacetype==SPACE_OOPS) { else if (sl->spacetype==SPACE_OOPS) {
SpaceOops *soops= (SpaceOops*) sl; SpaceOops *soops= (SpaceOops*) sl;

View File

@@ -136,10 +136,12 @@ typedef struct View3D {
short flag, flag2; short flag, flag2;
short gridsubdiv; // Number of subdivisions in the grid between each highlighted grid line short gridsubdiv; /* Number of subdivisions in the grid between each highlighted grid line */
short pad2[2]; short pad2[2];
void *properties_storage; /* Nkey panel stores stuff here, not in file */
} View3D; } View3D;
/* View3D->flag (short) */ /* View3D->flag (short) */

View File

@@ -1524,24 +1524,25 @@ static void load_bgpic_image(char *name)
} }
/* this one assumes there is only one global active object in blender... (for object panel) */ /* temporal struct for storing transform properties */
static float ob_eul[4]; // used for quat too.... typedef struct {
static float ob_scale[3]; // need temp space due to linked values float ob_eul[4]; // used for quat too....
static float ob_dims[3]; float ob_scale[3]; // need temp space due to linked values
static short link_scale = 0; float ob_dims[3];
short link_scale;
/* this one assumes there is only one editmode in blender... (for object panel) */ float ve_median[5];
static float ve_median[5]; int curdef;
float *defweightp;
} TransformProperties;
/* is used for both read and write... */ /* is used for both read and write... */
static void v3d_editvertex_buts(uiBlock *block, Object *ob, float lim) static void v3d_editvertex_buts(uiBlock *block, Object *ob, float lim)
{ {
static int curdef=0;
static float *defweightp= NULL;
EditMesh *em = G.editMesh; EditMesh *em = G.editMesh;
EditVert *eve, *evedef=NULL; EditVert *eve, *evedef=NULL;
EditEdge *eed; EditEdge *eed;
MDeformVert *dvert=NULL; MDeformVert *dvert=NULL;
TransformProperties *tfp= G.vd->properties_storage;
float median[5]; float median[5];
int tot, totw, totweight, totedge; int tot, totw, totweight, totedge;
char defstr[320]; char defstr[320];
@@ -1584,15 +1585,15 @@ static void v3d_editvertex_buts(uiBlock *block, Object *ob, float lim)
if(max<320) strcat(defstr, str); if(max<320) strcat(defstr, str);
} }
else printf("oh no!\n"); else printf("oh no!\n");
if(curdef==dvert->dw[i].def_nr) { if(tfp->curdef==dvert->dw[i].def_nr) {
init= 0; init= 0;
defweightp= &dvert->dw[i].weight; tfp->defweightp= &dvert->dw[i].weight;
} }
} }
if(init) { // needs new initialized if(init) { // needs new initialized
curdef= dvert->dw[0].def_nr; tfp->curdef= dvert->dw[0].def_nr;
defweightp= &dvert->dw[0].weight; tfp->defweightp= &dvert->dw[0].weight;
} }
} }
} }
@@ -1681,44 +1682,44 @@ static void v3d_editvertex_buts(uiBlock *block, Object *ob, float lim)
uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Global", 160, 150, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays global values"); uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Global", 160, 150, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays global values");
uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Local", 230, 150, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays local values"); uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Local", 230, 150, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays local values");
memcpy(ve_median, median, sizeof(ve_median)); memcpy(tfp->ve_median, median, sizeof(tfp->ve_median));
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
if(tot==1) { if(tot==1) {
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex X:", 10, 110, 290, 19, &(ve_median[0]), -lim, lim, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex X:", 10, 110, 290, 19, &(tfp->ve_median[0]), -lim, lim, 10, 3, "");
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex Y:", 10, 90, 290, 19, &(ve_median[1]), -lim, lim, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex Y:", 10, 90, 290, 19, &(tfp->ve_median[1]), -lim, lim, 10, 3, "");
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex Z:", 10, 70, 290, 19, &(ve_median[2]), -lim, lim, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex Z:", 10, 70, 290, 19, &(tfp->ve_median[2]), -lim, lim, 10, 3, "");
if(totw==1) if(totw==1)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex W:", 10, 50, 290, 19, &(ve_median[3]), 0.01, 100.0, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex W:", 10, 50, 290, 19, &(tfp->ve_median[3]), 0.01, 100.0, 10, 3, "");
uiBlockEndAlign(block); uiBlockEndAlign(block);
if(defstr[0]) { if(defstr[0]) {
uiDefBut(block, LABEL, 1, "Vertex Deform Groups", 10, 40, 290, 20, NULL, 0.0, 0.0, 0, 0, ""); uiDefBut(block, LABEL, 1, "Vertex Deform Groups", 10, 40, 290, 20, NULL, 0.0, 0.0, 0, 0, "");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_NOP, "Weight:", 10, 20, 150, 19, defweightp, 0.0f, 1.0f, 10, 3, "Weight value"); uiDefButF(block, NUM, B_NOP, "Weight:", 10, 20, 150, 19, tfp->defweightp, 0.0f, 1.0f, 10, 3, "Weight value");
uiDefButI(block, MENU, REDRAWVIEW3D, defstr, 160, 20, 140, 19, &curdef, 0.0, 0.0, 0, 0, "Current Vertex Group"); uiDefButI(block, MENU, REDRAWVIEW3D, defstr, 160, 20, 140, 19, &tfp->curdef, 0.0, 0.0, 0, 0, "Current Vertex Group");
uiBlockEndAlign(block); uiBlockEndAlign(block);
} }
else if(totweight) else if(totweight)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 10, 20, 290, 19, &(ve_median[4]), 0.0, 1.0, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 10, 20, 290, 19, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "");
} }
else { else {
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median X:", 10, 110, 290, 19, &(ve_median[0]), -lim, lim, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median X:", 10, 110, 290, 19, &(tfp->ve_median[0]), -lim, lim, 10, 3, "");
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median Y:", 10, 90, 290, 19, &(ve_median[1]), -lim, lim, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median Y:", 10, 90, 290, 19, &(tfp->ve_median[1]), -lim, lim, 10, 3, "");
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median Z:", 10, 70, 290, 19, &(ve_median[2]), -lim, lim, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median Z:", 10, 70, 290, 19, &(tfp->ve_median[2]), -lim, lim, 10, 3, "");
if(totw==tot) if(totw==tot)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median W:", 10, 50, 290, 19, &(ve_median[3]), 0.01, 100.0, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median W:", 10, 50, 290, 19, &(tfp->ve_median[3]), 0.01, 100.0, 10, 3, "");
uiBlockEndAlign(block); uiBlockEndAlign(block);
if(totweight) if(totweight)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 10, 20, 290, 19, &(ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal"); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 10, 20, 290, 19, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal");
} }
if(totedge==1) if(totedge==1)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Crease W:", 10, 30, 290, 19, &(ve_median[3]), 0.0, 1.0, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Crease W:", 10, 30, 290, 19, &(tfp->ve_median[3]), 0.0, 1.0, 10, 3, "");
else if(totedge>1) else if(totedge>1)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median Crease W:", 10, 30, 290, 19, &(ve_median[3]), 0.0, 1.0, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median Crease W:", 10, 30, 290, 19, &(tfp->ve_median[3]), 0.0, 1.0, 10, 3, "");
} }
else { // apply else { // apply
@@ -1726,11 +1727,11 @@ static void v3d_editvertex_buts(uiBlock *block, Object *ob, float lim)
if(G.vd->flag & V3D_GLOBAL_STATS) { if(G.vd->flag & V3D_GLOBAL_STATS) {
Mat4Invert(ob->imat, ob->obmat); Mat4Invert(ob->imat, ob->obmat);
Mat4MulVecfl(ob->imat, median); Mat4MulVecfl(ob->imat, median);
Mat4MulVecfl(ob->imat, ve_median); Mat4MulVecfl(ob->imat, tfp->ve_median);
} }
VecSubf(median, ve_median, median); VecSubf(median, tfp->ve_median, median);
median[3]= ve_median[3]-median[3]; median[3]= tfp->ve_median[3]-median[3];
median[4]= ve_median[4]-median[4]; median[4]= tfp->ve_median[4]-median[4];
if(ob->type==OB_MESH) { if(ob->type==OB_MESH) {
@@ -1745,8 +1746,8 @@ static void v3d_editvertex_buts(uiBlock *block, Object *ob, float lim)
for(eed= em->edges.first; eed; eed= eed->next) { for(eed= em->edges.first; eed; eed= eed->next) {
if(eed->f & SELECT) { if(eed->f & SELECT) {
/* ensure the median can be set to zero or one */ /* ensure the median can be set to zero or one */
if(ve_median[3]==0.0f) eed->crease= 0.0f; if(tfp->ve_median[3]==0.0f) eed->crease= 0.0f;
else if(ve_median[3]==1.0f) eed->crease= 1.0f; else if(tfp->ve_median[3]==1.0f) eed->crease= 1.0f;
else { else {
eed->crease+= median[3]; eed->crease+= median[3];
CLAMP(eed->crease, 0.0, 1.0); CLAMP(eed->crease, 0.0, 1.0);
@@ -1850,6 +1851,7 @@ static void v3d_posearmature_buts(uiBlock *block, Object *ob, float lim)
bArmature *arm; bArmature *arm;
bPoseChannel *pchan; bPoseChannel *pchan;
Bone *bone; Bone *bone;
TransformProperties *tfp= G.vd->properties_storage;
arm = get_armature(OBACT); arm = get_armature(OBACT);
if (!arm || !ob->pose) return; if (!arm || !ob->pose) return;
@@ -1864,10 +1866,10 @@ static void v3d_posearmature_buts(uiBlock *block, Object *ob, float lim)
but= uiDefBut(block, TEX, B_DIFF, "Bone:", 160, 140, 140, 19, bone->name, 1, 31, 0, 0, ""); but= uiDefBut(block, TEX, B_DIFF, "Bone:", 160, 140, 140, 19, bone->name, 1, 31, 0, 0, "");
uiButSetFunc(but, validate_bonebutton_cb, bone, NULL); uiButSetFunc(but, validate_bonebutton_cb, bone, NULL);
QuatToEul(pchan->quat, ob_eul); QuatToEul(pchan->quat, tfp->ob_eul);
ob_eul[0]*= 180.0/M_PI; tfp->ob_eul[0]*= 180.0/M_PI;
ob_eul[1]*= 180.0/M_PI; tfp->ob_eul[1]*= 180.0/M_PI;
ob_eul[2]*= 180.0/M_PI; tfp->ob_eul[2]*= 180.0/M_PI;
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCX, REDRAWVIEW3D, ICON_UNLOCKED, 10,140,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCX, REDRAWVIEW3D, ICON_UNLOCKED, 10,140,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
@@ -1879,11 +1881,11 @@ static void v3d_posearmature_buts(uiBlock *block, Object *ob, float lim)
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTX, REDRAWVIEW3D, ICON_UNLOCKED, 10,70,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTX, REDRAWVIEW3D, ICON_UNLOCKED, 10,70,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
uiDefButF(block, NUM, B_ARMATUREPANEL3, "RotX:", 30, 70, 120, 19, ob_eul, -1000.0, 1000.0, 100, 3, ""); uiDefButF(block, NUM, B_ARMATUREPANEL3, "RotX:", 30, 70, 120, 19, tfp->ob_eul, -1000.0, 1000.0, 100, 3, "");
uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTY, REDRAWVIEW3D, ICON_UNLOCKED, 10,50,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTY, REDRAWVIEW3D, ICON_UNLOCKED, 10,50,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
uiDefButF(block, NUM, B_ARMATUREPANEL3, "RotY:", 30, 50, 120, 19, ob_eul+1, -1000.0, 1000.0, 100, 3, ""); uiDefButF(block, NUM, B_ARMATUREPANEL3, "RotY:", 30, 50, 120, 19, tfp->ob_eul+1, -1000.0, 1000.0, 100, 3, "");
uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTZ, REDRAWVIEW3D, ICON_UNLOCKED, 10,30,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTZ, REDRAWVIEW3D, ICON_UNLOCKED, 10,30,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
uiDefButF(block, NUM, B_ARMATUREPANEL3, "RotZ:", 30, 30, 120, 19, ob_eul+2, -1000.0, 1000.0, 100, 3, ""); uiDefButF(block, NUM, B_ARMATUREPANEL3, "RotZ:", 30, 30, 120, 19, tfp->ob_eul+2, -1000.0, 1000.0, 100, 3, "");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEX, REDRAWVIEW3D, ICON_UNLOCKED, 160,70,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEX, REDRAWVIEW3D, ICON_UNLOCKED, 160,70,20,19, &(pchan->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
@@ -1900,6 +1902,7 @@ static void v3d_editarmature_buts(uiBlock *block, Object *ob, float lim)
bArmature *arm= G.obedit->data; bArmature *arm= G.obedit->data;
EditBone *ebone; EditBone *ebone;
uiBut *but; uiBut *but;
TransformProperties *tfp= G.vd->properties_storage;
ebone= G.edbo.first; ebone= G.edbo.first;
@@ -1923,8 +1926,8 @@ static void v3d_editarmature_buts(uiBlock *block, Object *ob, float lim)
uiDefButF(block, NUM, B_ARMATUREPANEL1, "TipY:", 160, 50, 140, 19, ebone->tail+1, -lim, lim, 10, 3, ""); uiDefButF(block, NUM, B_ARMATUREPANEL1, "TipY:", 160, 50, 140, 19, ebone->tail+1, -lim, lim, 10, 3, "");
uiDefButF(block, NUM, B_ARMATUREPANEL1, "TipZ:", 160, 30, 140, 19, ebone->tail+2, -lim, lim, 10, 3, ""); uiDefButF(block, NUM, B_ARMATUREPANEL1, "TipZ:", 160, 30, 140, 19, ebone->tail+2, -lim, lim, 10, 3, "");
uiBlockEndAlign(block); uiBlockEndAlign(block);
ob_eul[0]= 180.0*ebone->roll/M_PI; tfp->ob_eul[0]= 180.0*ebone->roll/M_PI;
uiDefButF(block, NUM, B_ARMATUREPANEL1, "Roll:", 10, 100, 140, 19, ob_eul, -lim, lim, 1000, 3, ""); uiDefButF(block, NUM, B_ARMATUREPANEL1, "Roll:", 10, 100, 140, 19, tfp->ob_eul, -lim, lim, 1000, 3, "");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
@@ -1971,6 +1974,7 @@ void do_viewbuts(unsigned short event)
BoundBox *bb; BoundBox *bb;
View3D *vd; View3D *vd;
Object *ob= OBACT; Object *ob= OBACT;
TransformProperties *tfp= G.vd->properties_storage;
char *name; char *name;
vd= G.vd; vd= G.vd;
@@ -2035,9 +2039,9 @@ void do_viewbuts(unsigned short event)
case B_OBJECTPANELROT: case B_OBJECTPANELROT:
if(ob) { if(ob) {
ob->rot[0]= M_PI*ob_eul[0]/180.0; ob->rot[0]= M_PI*tfp->ob_eul[0]/180.0;
ob->rot[1]= M_PI*ob_eul[1]/180.0; ob->rot[1]= M_PI*tfp->ob_eul[1]/180.0;
ob->rot[2]= M_PI*ob_eul[2]/180.0; ob->rot[2]= M_PI*tfp->ob_eul[2]/180.0;
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB); DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
allqueue(REDRAWVIEW3D, 1); allqueue(REDRAWVIEW3D, 1);
} }
@@ -2050,28 +2054,28 @@ void do_viewbuts(unsigned short event)
/* figure out which axis changed */ /* figure out which axis changed */
axis = 0; axis = 0;
max = fabs(ob_scale[0] - ob->size[0]); max = fabs(tfp->ob_scale[0] - ob->size[0]);
tmp = fabs(ob_scale[1] - ob->size[1]); tmp = fabs(tfp->ob_scale[1] - ob->size[1]);
if (tmp > max) { if (tmp > max) {
axis = 1; axis = 1;
max = tmp; max = tmp;
} }
tmp = fabs(ob_scale[2] - ob->size[2]); tmp = fabs(tfp->ob_scale[2] - ob->size[2]);
if (tmp > max) { if (tmp > max) {
axis = 2; axis = 2;
max = tmp; max = tmp;
} }
if (ob->size[axis] != ob_scale[axis]) { if (ob->size[axis] != tfp->ob_scale[axis]) {
if (link_scale) { if (tfp->link_scale) {
if (fabs(ob->size[axis]) > FLT_EPSILON) { if (fabs(ob->size[axis]) > FLT_EPSILON) {
ratio = ob_scale[axis] / ob->size[axis]; ratio = tfp->ob_scale[axis] / ob->size[axis];
ob->size[0] *= ratio; ob->size[0] *= ratio;
ob->size[1] *= ratio; ob->size[1] *= ratio;
ob->size[2] *= ratio; ob->size[2] *= ratio;
} }
} }
ob->size[axis] = ob_scale[axis]; ob->size[axis] = tfp->ob_scale[axis];
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB); DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
allqueue(REDRAWVIEW3D, 1); allqueue(REDRAWVIEW3D, 1);
@@ -2097,10 +2101,10 @@ void do_viewbuts(unsigned short event)
/* for each axis changed */ /* for each axis changed */
for (axis = 0; axis<3; axis++) { for (axis = 0; axis<3; axis++) {
if (fabs(old_dims[axis] - ob_dims[axis]) > 0.0001) { if (fabs(old_dims[axis] - tfp->ob_dims[axis]) > 0.0001) {
if (old_dims[axis] > 0.0) { if (old_dims[axis] > 0.0) {
ratio = ob_dims[axis] / old_dims[axis]; ratio = tfp->ob_dims[axis] / old_dims[axis];
if (link_scale) { if (tfp->link_scale) {
ob->size[0] *= ratio; ob->size[0] *= ratio;
ob->size[1] *= ratio; ob->size[1] *= ratio;
ob->size[2] *= ratio; ob->size[2] *= ratio;
@@ -2112,14 +2116,14 @@ void do_viewbuts(unsigned short event)
} }
else { else {
if (len[axis] > 0) { if (len[axis] > 0) {
ob->size[axis] = ob_dims[axis] / len[axis]; ob->size[axis] = tfp->ob_dims[axis] / len[axis];
} }
} }
} }
} }
/* prevent multiple B_OBJECTPANELDIMS events to keep scaling, cycling with TAB on buttons can cause that */ /* prevent multiple B_OBJECTPANELDIMS events to keep scaling, cycling with TAB on buttons can cause that */
VECCOPY(ob_dims, old_dims); VECCOPY(tfp->ob_dims, old_dims);
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB); DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
allqueue(REDRAWVIEW3D, 1); allqueue(REDRAWVIEW3D, 1);
@@ -2156,7 +2160,7 @@ void do_viewbuts(unsigned short event)
break; break;
} }
if (ebone) { if (ebone) {
ebone->roll= M_PI*ob_eul[0]/180.0; ebone->roll= M_PI*tfp->ob_eul[0]/180.0;
// Update our parent // Update our parent
if (ebone->parent && ebone->flag & BONE_CONNECTED){ if (ebone->parent && ebone->flag & BONE_CONNECTED){
VECCOPY (ebone->parent->tail, ebone->head); VECCOPY (ebone->parent->tail, ebone->head);
@@ -2211,9 +2215,9 @@ void do_viewbuts(unsigned short event)
if (!pchan) return; if (!pchan) return;
/* make a copy to eul[3], to allow TAB on buttons to work */ /* make a copy to eul[3], to allow TAB on buttons to work */
eul[0]= M_PI*ob_eul[0]/180.0; eul[0]= M_PI*tfp->ob_eul[0]/180.0;
eul[1]= M_PI*ob_eul[1]/180.0; eul[1]= M_PI*tfp->ob_eul[1]/180.0;
eul[2]= M_PI*ob_eul[2]/180.0; eul[2]= M_PI*tfp->ob_eul[2]/180.0;
EulToQuat(eul, pchan->quat); EulToQuat(eul, pchan->quat);
} }
/* no break, pass on */ /* no break, pass on */
@@ -2233,18 +2237,21 @@ static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT
uiBlock *block; uiBlock *block;
uiBut *bt; uiBut *bt;
Object *ob= OBACT; Object *ob= OBACT;
TransformProperties *tfp;
float lim; float lim;
static char hexcol[128]; static char hexcol[128];
if(ob==NULL) return; if(ob==NULL) return;
/* make sure we got storage */
if(G.vd->properties_storage==NULL)
G.vd->properties_storage= MEM_callocN(sizeof(TransformProperties), "TransformProperties");
tfp= G.vd->properties_storage;
block= uiNewBlock(&curarea->uiblocks, "view3d_panel_object", UI_EMBOSS, UI_HELV, curarea->win); block= uiNewBlock(&curarea->uiblocks, "view3d_panel_object", UI_EMBOSS, UI_HELV, curarea->win);
uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl); uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
uiSetPanelHandler(VIEW3D_HANDLER_OBJECT); // for close and esc uiSetPanelHandler(VIEW3D_HANDLER_OBJECT); // for close and esc
/* (ton) can't use the rename trick for paint... panel names and settings are stored in the files and
used to find previous locations when re-open. This causes flipping */
if((G.f & G_SCULPTMODE) && !G.obedit) { if((G.f & G_SCULPTMODE) && !G.obedit) {
if(!uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 425, 234)) return; if(!uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 425, 234)) return;
} else { } else {
@@ -2312,32 +2319,32 @@ static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT
uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCZ, REDRAWVIEW3D, ICON_UNLOCKED, 10,110,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCZ, REDRAWVIEW3D, ICON_UNLOCKED, 10,110,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
uiDefButF(block, NUM, B_OBJECTPANEL, "LocZ:", 30, 110, 120, 19, &(ob->loc[2]), -lim, lim, 100, 3, ""); uiDefButF(block, NUM, B_OBJECTPANEL, "LocZ:", 30, 110, 120, 19, &(ob->loc[2]), -lim, lim, 100, 3, "");
ob_eul[0]= 180.0*ob->rot[0]/M_PI; tfp->ob_eul[0]= 180.0*ob->rot[0]/M_PI;
ob_eul[1]= 180.0*ob->rot[1]/M_PI; tfp->ob_eul[1]= 180.0*ob->rot[1]/M_PI;
ob_eul[2]= 180.0*ob->rot[2]/M_PI; tfp->ob_eul[2]= 180.0*ob->rot[2]/M_PI;
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTX, REDRAWVIEW3D, ICON_UNLOCKED, 160,150,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTX, REDRAWVIEW3D, ICON_UNLOCKED, 160,150,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
uiDefButF(block, NUM, B_OBJECTPANELROT, "RotX:", 180, 150, 120, 19, &(ob_eul[0]), -lim, lim, 1000, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELROT, "RotX:", 180, 150, 120, 19, &(tfp->ob_eul[0]), -lim, lim, 1000, 3, "");
uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTY, REDRAWVIEW3D, ICON_UNLOCKED, 160,130,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTY, REDRAWVIEW3D, ICON_UNLOCKED, 160,130,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
uiDefButF(block, NUM, B_OBJECTPANELROT, "RotY:", 180, 130, 120, 19, &(ob_eul[1]), -lim, lim, 1000, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELROT, "RotY:", 180, 130, 120, 19, &(tfp->ob_eul[1]), -lim, lim, 1000, 3, "");
uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTZ, REDRAWVIEW3D, ICON_UNLOCKED, 160,110,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTZ, REDRAWVIEW3D, ICON_UNLOCKED, 160,110,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
uiDefButF(block, NUM, B_OBJECTPANELROT, "RotZ:", 180, 110, 120, 19, &(ob_eul[2]), -lim, lim, 1000, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELROT, "RotZ:", 180, 110, 120, 19, &(tfp->ob_eul[2]), -lim, lim, 1000, 3, "");
ob_scale[0]= ob->size[0]; tfp->ob_scale[0]= ob->size[0];
ob_scale[1]= ob->size[1]; tfp->ob_scale[1]= ob->size[1];
ob_scale[2]= ob->size[2]; tfp->ob_scale[2]= ob->size[2];
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEX, REDRAWVIEW3D, ICON_UNLOCKED, 10,80,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEX, REDRAWVIEW3D, ICON_UNLOCKED, 10,80,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
uiDefButF(block, NUM, B_OBJECTPANELSCALE, "ScaleX:", 30, 80, 120, 19, &(ob_scale[0]), -lim, lim, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELSCALE, "ScaleX:", 30, 80, 120, 19, &(tfp->ob_scale[0]), -lim, lim, 10, 3, "");
uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEY, REDRAWVIEW3D, ICON_UNLOCKED, 10,60,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEY, REDRAWVIEW3D, ICON_UNLOCKED, 10,60,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
uiDefButF(block, NUM, B_OBJECTPANELSCALE, "ScaleY:", 30, 60, 120, 19, &(ob_scale[1]), -lim, lim, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELSCALE, "ScaleY:", 30, 60, 120, 19, &(tfp->ob_scale[1]), -lim, lim, 10, 3, "");
uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEZ, REDRAWVIEW3D, ICON_UNLOCKED, 10,40,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed"); uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEZ, REDRAWVIEW3D, ICON_UNLOCKED, 10,40,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
uiDefButF(block, NUM, B_OBJECTPANELSCALE, "ScaleZ:", 30, 40, 120, 19, &(ob_scale[2]), -lim, lim, 10, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELSCALE, "ScaleZ:", 30, 40, 120, 19, &(tfp->ob_scale[2]), -lim, lim, 10, 3, "");
uiBlockEndAlign(block); uiBlockEndAlign(block);
uiDefButS(block, TOG, REDRAWVIEW3D, "Link Scale", 10, 10, 140, 19, &(link_scale), 0, 1, 0, 0, "Scale values vary proportionally in all directions"); uiDefButS(block, TOG, REDRAWVIEW3D, "Link Scale", 10, 10, 140, 19, &(tfp->link_scale), 0, 1, 0, 0, "Scale values vary proportionally in all directions");
bb= object_get_boundbox(ob); bb= object_get_boundbox(ob);
if (bb) { if (bb) {
@@ -2345,14 +2352,14 @@ static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT
Mat4ToSize(ob->obmat, scale); Mat4ToSize(ob->obmat, scale);
ob_dims[0] = fabs(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]); tfp->ob_dims[0] = fabs(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
ob_dims[1] = fabs(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]); tfp->ob_dims[1] = fabs(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
ob_dims[2] = fabs(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]); tfp->ob_dims[2] = fabs(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimX:", 160, 80, 140, 19, &(ob_dims[0]), 0.0, lim, 10, 3, "Manipulate bounding box size"); uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimX:", 160, 80, 140, 19, &(tfp->ob_dims[0]), 0.0, lim, 10, 3, "Manipulate bounding box size");
uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimY:", 160, 60, 140, 19, &(ob_dims[1]), 0.0, lim, 10, 3, "Manipulate bounding box size"); uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimY:", 160, 60, 140, 19, &(tfp->ob_dims[1]), 0.0, lim, 10, 3, "Manipulate bounding box size");
uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimZ:", 160, 40, 140, 19, &(ob_dims[2]), 0.0, lim, 10, 3, "Manipulate bounding box size"); uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimZ:", 160, 40, 140, 19, &(tfp->ob_dims[2]), 0.0, lim, 10, 3, "Manipulate bounding box size");
uiBlockEndAlign(block); uiBlockEndAlign(block);
} }

View File

@@ -2673,6 +2673,13 @@ void common_insertkey(void)
ob= OBACT; ob= OBACT;
if (ob && (ob->flag & OB_POSEMODE)) { if (ob && (ob->flag & OB_POSEMODE)) {
bPoseChannel *pchan;
set_pose_keys(ob); // sets pchan->flag to POSE_KEY if bone selected
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next)
if (pchan->flag & POSE_KEY)
break;
if(pchan==NULL) return;
strcpy(menustr, "Insert Key%t|Loc%x0|Rot%x1|Scale%x2|LocRot%x3|LocRotScale%x4|Avail%x9|Needed%x15|VisualLoc%x11|VisualRot%x12|VisualLocRot%x13"); strcpy(menustr, "Insert Key%t|Loc%x0|Rot%x1|Scale%x2|LocRot%x3|LocRotScale%x4|Avail%x9|Needed%x15|VisualLoc%x11|VisualRot%x12|VisualLocRot%x13");
} }
else { else {
@@ -2708,7 +2715,6 @@ void common_insertkey(void)
return; return;
} }
set_pose_keys(ob); // sets pchan->flag to POSE_KEY if bone selected
id= &ob->id; id= &ob->id;
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) { for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
if (pchan->flag & POSE_KEY){ if (pchan->flag & POSE_KEY){

View File

@@ -947,6 +947,7 @@ void pose_movetolayer(void)
} }
} }
BIF_undo_push("Move Bone layer");
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0); allqueue(REDRAWACTION, 0);
allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWBUTSEDIT, 0);

View File

@@ -5030,6 +5030,7 @@ void freespacelist(ScrArea *sa)
vd->depths= NULL; vd->depths= NULL;
} }
retopo_free_view_data(vd); retopo_free_view_data(vd);
if(vd->properties_storage) MEM_freeN(vd->properties_storage);
if(G.vd==vd) G.vd= NULL; if(G.vd==vd) G.vd= NULL;
if(vd->ri) { if(vd->ri) {
BIF_view3d_previewrender_free(vd); BIF_view3d_previewrender_free(vd);