Two in one:
- Bugfix #25937 Child-of constraint now behaves like regular parent-child relationship when all options are set. This prevents the errors that can happen when decomposing non-uniform matrices. - Todo item The area corner hotspots for splitting/merging were far too narrow. Now it uses a circular distance to detect whether the hotspot is active. Also cleaned up drawing code for it.
This commit is contained in:
parent
0ea9271f43
commit
216f9af08e
|
@ -834,7 +834,23 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
|
||||||
|
|
||||||
/* only evaluate if there is a target */
|
/* only evaluate if there is a target */
|
||||||
if (VALID_CONS_TARGET(ct)) {
|
if (VALID_CONS_TARGET(ct)) {
|
||||||
float parmat[4][4], invmat[4][4], tempmat[4][4];
|
float parmat[4][4];
|
||||||
|
|
||||||
|
/* simple matrix parenting */
|
||||||
|
if(data->flag == CHILDOF_ALL) {
|
||||||
|
|
||||||
|
/* multiply target (parent matrix) by offset (parent inverse) to get
|
||||||
|
* the effect of the parent that will be exherted on the owner
|
||||||
|
*/
|
||||||
|
mul_m4_m4m4(parmat, data->invmat, ct->matrix);
|
||||||
|
|
||||||
|
/* now multiply the parent matrix by the owner matrix to get the
|
||||||
|
* the effect of this constraint (i.e. owner is 'parented' to parent)
|
||||||
|
*/
|
||||||
|
mul_m4_m4m4(cob->matrix, cob->matrix, parmat);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
float invmat[4][4], tempmat[4][4];
|
||||||
float loc[3], eul[3], size[3];
|
float loc[3], eul[3], size[3];
|
||||||
float loco[3], eulo[3], sizo[3];
|
float loco[3], eulo[3], sizo[3];
|
||||||
|
|
||||||
|
@ -883,6 +899,7 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
|
||||||
if (!(data->flag & CHILDOF_LOCY)) cob->matrix[3][1]= tempmat[3][1];
|
if (!(data->flag & CHILDOF_LOCY)) cob->matrix[3][1]= tempmat[3][1];
|
||||||
if (!(data->flag & CHILDOF_LOCZ)) cob->matrix[3][2]= tempmat[3][2];
|
if (!(data->flag & CHILDOF_LOCZ)) cob->matrix[3][2]= tempmat[3][2];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX note, con->flag should be CONSTRAINT_SPACEONCE for bone-childof, patched in readfile.c */
|
/* XXX note, con->flag should be CONSTRAINT_SPACEONCE for bone-childof, patched in readfile.c */
|
||||||
|
|
|
@ -164,27 +164,22 @@ void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar)
|
||||||
|
|
||||||
static void area_draw_azone(short x1, short y1, short x2, short y2)
|
static void area_draw_azone(short x1, short y1, short x2, short y2)
|
||||||
{
|
{
|
||||||
float xmin = x1;
|
int dx= floor(0.3f*(x2-x1));
|
||||||
float xmax = x2-2;
|
int dy= floor(0.3f*(y2-y1));
|
||||||
float ymin = y1-1;
|
|
||||||
float ymax = y2-3;
|
|
||||||
|
|
||||||
float dx= 0.3f*(xmax-xmin);
|
|
||||||
float dy= 0.3f*(ymax-ymin);
|
|
||||||
|
|
||||||
glColor4ub(255, 255, 255, 180);
|
glColor4ub(255, 255, 255, 180);
|
||||||
fdrawline(xmin, ymax, xmax, ymin);
|
fdrawline(x1, y2, x2, y1);
|
||||||
glColor4ub(255, 255, 255, 130);
|
glColor4ub(255, 255, 255, 130);
|
||||||
fdrawline(xmin, ymax-dy, xmax-dx, ymin);
|
fdrawline(x1, y2-dy, x2-dx, y1);
|
||||||
glColor4ub(255, 255, 255, 80);
|
glColor4ub(255, 255, 255, 80);
|
||||||
fdrawline(xmin, ymax-2*dy, xmax-2*dx, ymin);
|
fdrawline(x1, y2-2*dy, x2-2*dx, y1);
|
||||||
|
|
||||||
glColor4ub(0, 0, 0, 210);
|
glColor4ub(0, 0, 0, 210);
|
||||||
fdrawline(xmin, ymax+1, xmax+1, ymin);
|
fdrawline(x1, y2+1, x2+1, y1);
|
||||||
glColor4ub(0, 0, 0, 180);
|
glColor4ub(0, 0, 0, 180);
|
||||||
fdrawline(xmin, ymax-dy+1, xmax-dx+1, ymin);
|
fdrawline(x1, y2-dy+1, x2-dx+1, y1);
|
||||||
glColor4ub(0, 0, 0, 150);
|
glColor4ub(0, 0, 0, 150);
|
||||||
fdrawline(xmin, ymax-2*dy+1, xmax-2*dx+1, ymin);
|
fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -451,7 +446,6 @@ void ED_area_headerprint(ScrArea *sa, const char *str)
|
||||||
/* ************************************************************ */
|
/* ************************************************************ */
|
||||||
|
|
||||||
|
|
||||||
#define AZONESPOT 12
|
|
||||||
static void area_azone_initialize(ScrArea *sa)
|
static void area_azone_initialize(ScrArea *sa)
|
||||||
{
|
{
|
||||||
AZone *az;
|
AZone *az;
|
||||||
|
@ -465,8 +459,8 @@ static void area_azone_initialize(ScrArea *sa)
|
||||||
az->type= AZONE_AREA;
|
az->type= AZONE_AREA;
|
||||||
az->x1= sa->totrct.xmin;
|
az->x1= sa->totrct.xmin;
|
||||||
az->y1= sa->totrct.ymin;
|
az->y1= sa->totrct.ymin;
|
||||||
az->x2= sa->totrct.xmin + AZONESPOT-1;
|
az->x2= sa->totrct.xmin + AZONESPOT;
|
||||||
az->y2= sa->totrct.ymin + AZONESPOT-1;
|
az->y2= sa->totrct.ymin + AZONESPOT;
|
||||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||||
|
|
||||||
az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
|
az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
|
||||||
|
@ -474,13 +468,13 @@ static void area_azone_initialize(ScrArea *sa)
|
||||||
az->type= AZONE_AREA;
|
az->type= AZONE_AREA;
|
||||||
az->x1= sa->totrct.xmax+1;
|
az->x1= sa->totrct.xmax+1;
|
||||||
az->y1= sa->totrct.ymax+1;
|
az->y1= sa->totrct.ymax+1;
|
||||||
az->x2= sa->totrct.xmax-AZONESPOT+1;
|
az->x2= sa->totrct.xmax-AZONESPOT;
|
||||||
az->y2= sa->totrct.ymax-AZONESPOT+1;
|
az->y2= sa->totrct.ymax-AZONESPOT;
|
||||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define AZONEPAD_EDGE 4
|
#define AZONEPAD_EDGE 4
|
||||||
#define AZONEPAD_ICON 8
|
#define AZONEPAD_ICON 9
|
||||||
static void region_azone_edge(AZone *az, ARegion *ar)
|
static void region_azone_edge(AZone *az, ARegion *ar)
|
||||||
{
|
{
|
||||||
switch(az->edge) {
|
switch(az->edge) {
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
struct wmWindow;
|
struct wmWindow;
|
||||||
struct Scene;
|
struct Scene;
|
||||||
|
|
||||||
|
#define AZONESPOT 12
|
||||||
|
|
||||||
/* area.c */
|
/* area.c */
|
||||||
void area_copy_data (ScrArea *sa1, ScrArea *sa2, int swap_space);
|
void area_copy_data (ScrArea *sa1, ScrArea *sa2, int swap_space);
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,10 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
|
||||||
for(az= sa->actionzones.first; az; az= az->next) {
|
for(az= sa->actionzones.first; az; az= az->next) {
|
||||||
if(BLI_in_rcti(&az->rect, x, y)) {
|
if(BLI_in_rcti(&az->rect, x, y)) {
|
||||||
if(az->type == AZONE_AREA) {
|
if(az->type == AZONE_AREA) {
|
||||||
if(isect_point_tri_v2_int(az->x1, az->y1, az->x2, az->y2, x, y))
|
/* no triangle intersect but a hotspot circle based on corner */
|
||||||
|
int radius= (x-az->x1)*(x-az->x1) + (y-az->y1)*(y-az->y1);
|
||||||
|
|
||||||
|
if(radius <= AZONESPOT*AZONESPOT)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(az->type == AZONE_REGION) {
|
else if(az->type == AZONE_REGION) {
|
||||||
|
|
|
@ -699,7 +699,8 @@ typedef enum eChildOf_Flags {
|
||||||
CHILDOF_ROTZ = (1<<5),
|
CHILDOF_ROTZ = (1<<5),
|
||||||
CHILDOF_SIZEX = (1<<6),
|
CHILDOF_SIZEX = (1<<6),
|
||||||
CHILDOF_SIZEY = (1<<7),
|
CHILDOF_SIZEY = (1<<7),
|
||||||
CHILDOF_SIZEZ = (1<<8)
|
CHILDOF_SIZEZ = (1<<8),
|
||||||
|
CHILDOF_ALL = 511
|
||||||
} eChildOf_Flags;
|
} eChildOf_Flags;
|
||||||
|
|
||||||
/* Pivot Constraint */
|
/* Pivot Constraint */
|
||||||
|
|
Loading…
Reference in New Issue