diff options
author | Ton Roosendaal <ton@blender.org> | 2011-02-06 20:36:42 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-02-06 20:36:42 +0300 |
commit | 216f9af08e88398b7e2f805d241734ec80879180 (patch) | |
tree | f06ce6bfabdc17f46a91d5713af58123e090b12a /source/blender/editors/screen | |
parent | 0ea9271f43e7e8ef914d33244d658ad7b5720f1f (diff) |
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.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 32 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 5 |
3 files changed, 19 insertions, 20 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 5ea5fe06c46..4784f19012e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.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) { - float xmin = x1; - float xmax = x2-2; - float ymin = y1-1; - float ymax = y2-3; - - float dx= 0.3f*(xmax-xmin); - float dy= 0.3f*(ymax-ymin); + int dx= floor(0.3f*(x2-x1)); + int dy= floor(0.3f*(y2-y1)); glColor4ub(255, 255, 255, 180); - fdrawline(xmin, ymax, xmax, ymin); + fdrawline(x1, y2, x2, y1); glColor4ub(255, 255, 255, 130); - fdrawline(xmin, ymax-dy, xmax-dx, ymin); + fdrawline(x1, y2-dy, x2-dx, y1); 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); - fdrawline(xmin, ymax+1, xmax+1, ymin); + fdrawline(x1, y2+1, x2+1, y1); 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); - 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) { AZone *az; @@ -465,8 +459,8 @@ static void area_azone_initialize(ScrArea *sa) az->type= AZONE_AREA; az->x1= sa->totrct.xmin; az->y1= sa->totrct.ymin; - az->x2= sa->totrct.xmin + AZONESPOT-1; - az->y2= sa->totrct.ymin + AZONESPOT-1; + az->x2= sa->totrct.xmin + AZONESPOT; + az->y2= sa->totrct.ymin + AZONESPOT; BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2); az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone"); @@ -474,13 +468,13 @@ static void area_azone_initialize(ScrArea *sa) az->type= AZONE_AREA; az->x1= sa->totrct.xmax+1; az->y1= sa->totrct.ymax+1; - az->x2= sa->totrct.xmax-AZONESPOT+1; - az->y2= sa->totrct.ymax-AZONESPOT+1; + az->x2= sa->totrct.xmax-AZONESPOT; + az->y2= sa->totrct.ymax-AZONESPOT; BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2); } #define AZONEPAD_EDGE 4 -#define AZONEPAD_ICON 8 +#define AZONEPAD_ICON 9 static void region_azone_edge(AZone *az, ARegion *ar) { switch(az->edge) { diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index 87b397382a3..ee448e70779 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -32,6 +32,8 @@ struct wmWindow; struct Scene; +#define AZONESPOT 12 + /* area.c */ void area_copy_data (ScrArea *sa1, ScrArea *sa2, int swap_space); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index b6c92982560..9267f4d4e80 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -474,7 +474,10 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y) for(az= sa->actionzones.first; az; az= az->next) { if(BLI_in_rcti(&az->rect, x, y)) { 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; } else if(az->type == AZONE_REGION) { |