diff options
author | Ton Roosendaal <ton@blender.org> | 2009-05-24 17:29:29 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-05-24 17:29:29 +0400 |
commit | ab407f6ac748225386c5f09685490d6df67916f8 (patch) | |
tree | f66ec462386dbfcc847f690551866bf2a3630c14 /source/blender/blenlib | |
parent | ef01c5bf0abda3893b3a7f075a3ab20f164d5081 (diff) |
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_arithb.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/arithb.c | 16 | ||||
-rw-r--r-- | source/blender/blenlib/intern/rct.c | 41 |
3 files changed, 50 insertions, 9 deletions
diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h index 30bb4d11450..787579250ed 100644 --- a/source/blender/blenlib/BLI_arithb.h +++ b/source/blender/blenlib/BLI_arithb.h @@ -402,7 +402,7 @@ int AabbIntersectAabb(float min1[3], float max1[3], float min2[3], float max2[3] void VecfCubicInterpol(float *x1, float *v1, float *x2, float *v2, float t, float *x, float *v); void PointInQuad2DUV(float v0[2], float v1[2], float v2[2], float v3[2], float pt[2], float *uv); void PointInFace2DUV(int isquad, float v0[2], float v1[2], float v2[2], float v3[2], float pt[2], float *uv); -int IsPointInTri2D(float v0[2], float v1[2], float v2[2], float pt[2]); +int IsPointInTri2D(float v1[2], float v2[2], float v3[2], float pt[2]); int IsPointInTri2DInts(int x1, int y1, int x2, int y2, int a, int b); int point_in_tri_prism(float p[3], float v1[3], float v2[3], float v3[3]); diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index 2368f0cd2ba..f111e94a141 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -4515,6 +4515,21 @@ void PointInFace2DUV(int isquad, float v0[2], float v1[2], float v2[2], float v3 } } +int IsPointInTri2D(float v1[2], float v2[2], float v3[2], float pt[2]) +{ + float inp1, inp2, inp3; + + inp1= (v2[0]-v1[0])*(v1[1]-pt[1]) + (v1[1]-v2[1])*(v1[0]-pt[0]); + inp2= (v3[0]-v2[0])*(v2[1]-pt[1]) + (v2[1]-v3[1])*(v2[0]-pt[0]); + inp3= (v1[0]-v3[0])*(v3[1]-pt[1]) + (v3[1]-v1[1])*(v3[0]-pt[0]); + + if(inp1<=0.0f && inp2<=0.0f && inp3<=0.0f) return 1; + if(inp1>=0.0f && inp2>=0.0f && inp3>=0.0f) return 1; + + return 0; +} + +#if 0 int IsPointInTri2D(float v0[2], float v1[2], float v2[2], float pt[2]) { /* not for quads, use for our abuse of LineIntersectsTriangleUV */ @@ -4542,6 +4557,7 @@ int IsPointInTri2D(float v0[2], float v1[2], float v2[2], float pt[2]) /* Doing this in 3D is not nice */ return LineIntersectsTriangle(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, uv); } +#endif /* diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index 48ba18515de..915a93e8e0b 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -88,17 +88,42 @@ void BLI_union_rcti(rcti *rct1, rcti *rct2) void BLI_init_rctf(rctf *rect, float xmin, float xmax, float ymin, float ymax) { - rect->xmin= xmin; - rect->xmax= xmax; - rect->ymin= ymin; - rect->ymax= ymax; + if(xmin <= xmax) { + rect->xmin= xmin; + rect->xmax= xmax; + } + else { + rect->xmax= xmin; + rect->xmin= xmax; + } + if(ymin <= ymax) { + rect->ymin= ymin; + rect->ymax= ymax; + } + else { + rect->ymax= ymin; + rect->ymin= ymax; + } } + void BLI_init_rcti(rcti *rect, int xmin, int xmax, int ymin, int ymax) { - rect->xmin= xmin; - rect->xmax= xmax; - rect->ymin= ymin; - rect->ymax= ymax; + if(xmin <= xmax) { + rect->xmin= xmin; + rect->xmax= xmax; + } + else { + rect->xmax= xmin; + rect->xmin= xmax; + } + if(ymin <= ymax) { + rect->ymin= ymin; + rect->ymax= ymax; + } + else { + rect->ymax= ymin; + rect->ymin= ymax; + } } void BLI_translate_rcti(rcti *rect, int x, int y) |