diff options
author | Ton Roosendaal <ton@blender.org> | 2005-09-03 15:20:16 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-09-03 15:20:16 +0400 |
commit | c238d21c1863a294c06ab357bf89d7f821f4afb1 (patch) | |
tree | 3524448bfdab54a67b2118b92e1702f996786ca8 /source/blender/src/transform_manipulator.c | |
parent | fd7d224d4cc64af4c1c2a458556ce0838aa9f79e (diff) |
Bugfix #2977
Tweaked selection code for Manipulators in 'combo' mode, it gives
preference now to the scale/translate widgets over the rotate arcs. This
enables use of these widgets in ortho top/side views.
Diffstat (limited to 'source/blender/src/transform_manipulator.c')
-rw-r--r-- | source/blender/src/transform_manipulator.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/source/blender/src/transform_manipulator.c b/source/blender/src/transform_manipulator.c index daedcc370ff..c998d7435b1 100644 --- a/source/blender/src/transform_manipulator.c +++ b/source/blender/src/transform_manipulator.c @@ -1457,22 +1457,38 @@ static int manipulator_selectbuf(ScrArea *sa, float hotspot) if(hits==1) return buffer[3]; else if(hits>1) { - GLuint mindep, minval; + GLuint val, dep, mindep=0, mindeprot=0, minval=0, minvalrot=0; int a; /* we compare the hits in buffer, but value centers highest */ - mindep= buffer[1]; - minval= buffer[3]; + /* we also store the rotation hits separate (because of arcs) and return hits on other widgets if there are */ - for(a=1; a<hits; a++) { - if(minval==MAN_TRANS_C || minval==MAN_SCALE_C) break; + for(a=0; a<hits; a++) { + dep= buffer[4*a + 1]; + val= buffer[4*a + 3]; - if(buffer[4*a + 3]==MAN_TRANS_C || buffer[4*a + 3]==MAN_SCALE_C || buffer[4*a + 1] < mindep) { - mindep= buffer[4*a + 1]; - minval= buffer[4*a + 3]; + if(val==MAN_TRANS_C) return MAN_TRANS_C; + else if(val==MAN_SCALE_C) return MAN_SCALE_C; + else { + if(val & MAN_ROT_C) { + if(minvalrot==0 || dep<mindeprot) { + mindeprot= dep; + minvalrot= val; + } + } + else { + if(minval==0 || dep<mindep) { + mindep= dep; + minval= val; + } + } } } - return minval; + + if(minval) + return minval; + else + return minvalrot; } return 0; } |