Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r--source/blender/editors/transform/transform.c99
1 files changed, 45 insertions, 54 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index d2354a4a7ad..4a61978cc80 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -90,15 +90,12 @@
#include "BLI_linklist.h"
#include "BLI_smallhash.h"
#include "BLI_array.h"
-#include "PIL_time.h"
#include "UI_interface_icons.h"
#include "UI_resources.h"
#include "transform.h"
-#include <stdio.h> // XXX: duplicated???
-
static void drawTransformApply(const struct bContext *C, ARegion *ar, void *arg);
static int doEdgeSlide(TransInfo *t, float perc);
@@ -230,7 +227,7 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
{
if (t->spacetype == SPACE_VIEW3D) {
if (t->ar->regiontype == RGN_TYPE_WINDOW) {
- if (ED_view3d_project_int_global(t->ar, vec, adr, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_SUCCESS) {
+ if (ED_view3d_project_int_global(t->ar, vec, adr, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) {
adr[0] = (int)2140000000.0f; /* this is what was done in 2.64, perhaps we can be smarter? */
adr[1] = (int)2140000000.0f;
}
@@ -355,7 +352,7 @@ void projectFloatView(TransInfo *t, const float vec[3], float adr[2])
case SPACE_VIEW3D:
{
if (t->ar->regiontype == RGN_TYPE_WINDOW) {
- if (ED_view3d_project_float_global(t->ar, vec, adr, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_SUCCESS) {
+ if (ED_view3d_project_float_global(t->ar, vec, adr, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) {
/* XXX, 2.64 and prior did this, weak! */
adr[0] = t->ar->winx / 2.0f;
adr[1] = t->ar->winy / 2.0f;
@@ -1273,7 +1270,6 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw |= t->handleEvent(t, event);
if (handled || t->redraw) {
- t->last_update = PIL_check_seconds_timer();
return 0;
}
else {
@@ -1562,49 +1558,31 @@ static void drawTransformView(const struct bContext *C, ARegion *UNUSED(ar), voi
}
/* just draw a little warning message in the top-right corner of the viewport to warn that autokeying is enabled */
-static void drawAutoKeyWarning(TransInfo *t, ARegion *ar)
+static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
{
- int show_warning;
-
- /* red border around the viewport */
- UI_ThemeColor(TH_REDALERT);
+ const char printable[] = "Auto Keying On";
+ float printable_size[2];
+ int xco, yco;
+
+ BLF_width_and_height_default(printable, &printable_size[0], &printable_size[1]);
- glBegin(GL_LINE_LOOP);
- glVertex2f(1, 1);
- glVertex2f(1, ar->winy-1);
- glVertex2f(ar->winx-1, ar->winy-1);
- glVertex2f(ar->winx-1, 1);
- glEnd();
+ xco = ar->winx - (int)printable_size[0] - 10;
+ yco = ar->winy - (int)printable_size[1] - 10;
- /* Entire warning should "blink" to catch periphery attention without being overly distracting
- * much like how a traditional recording sign in the corner of a camcorder works
- *
- * - Blink frequency here is 0.5 secs (i.e. a compromise between epilepsy-inducing flicker + too slow to notice).
- * We multiply by two to speed up the odd/even time-in-seconds = on/off toggle.
- * - Always start with warning shown so that animators are more likely to notice when starting to transform
+ /* warning text (to clarify meaning of overlays)
+ * - original color was red to match the icon, but that clashes badly with a less nasty border
*/
- show_warning = (int)(t->last_update * 2.0) & 1;
+ UI_ThemeColorShade(TH_TEXT_HI, -50);
+ BLF_draw_default_ascii(xco, ar->winy - 17, 0.0f, printable, sizeof(printable));
- if ((show_warning) || (t->state == TRANS_STARTING)) {
- const char printable[] = "Auto Keying On";
- int xco, yco;
-
- xco = ar->winx - BLF_width_default(printable) - 10;
- yco = ar->winy - BLF_height_default(printable) - 10;
-
- /* red warning text */
- UI_ThemeColor(TH_REDALERT);
- BLF_draw_default_ascii(xco, ar->winy - 17, 0.0f, printable, sizeof(printable));
-
- /* autokey recording icon... */
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- xco -= (ICON_DEFAULT_WIDTH + 2);
- UI_icon_draw(xco, yco, ICON_REC);
-
- glDisable(GL_BLEND);
- }
+ /* autokey recording icon... */
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+
+ xco -= (ICON_DEFAULT_WIDTH + 2);
+ UI_icon_draw(xco, yco, ICON_REC);
+
+ glDisable(GL_BLEND);
}
static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, void *arg)
@@ -1613,10 +1591,18 @@ static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, vo
Scene *scene = t->scene;
Object *ob = OBACT;
- /* draw autokeyframing hint in the corner */
- if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) {
- drawAutoKeyWarning(t, ar);
- }
+ /* draw autokeyframing hint in the corner
+ * - only draw if enabled (advanced users may be distracted/annoyed),
+ * for objects that will be autokeyframed (no point ohterwise),
+ * AND only for the active region (as showing all is too overwhelming)
+ */
+ if ((U.autokey_flag & AUTOKEY_FLAG_NOWARNING) == 0) {
+ if (ar == t->ar) {
+ if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) {
+ drawAutoKeyWarning(t, ar);
+ }
+ }
+ }
}
void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
@@ -4037,12 +4023,15 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2]))
outputNumInput(&(t->num), c);
- sprintf(str, "Tilt: %s %s", &c[0], t->proptext);
+ sprintf(str, "Tilt: %s° %s", &c[0], t->proptext);
final = DEG2RADF(final);
+
+ /* XXX For some reason, this seems needed for this op, else RNA prop is not updated... :/ */
+ t->values[0] = final;
}
else {
- sprintf(str, "Tilt: %.2f %s", RAD2DEGF(final), t->proptext);
+ sprintf(str, "Tilt: %.2f° %s", RAD2DEGF(final), t->proptext);
}
for (i = 0; i < t->total; i++, td++) {
@@ -4853,7 +4842,7 @@ static void calcNonProportionalEdgeSlide(TransInfo *t, SlideData *sld, const flo
sv->edge_len = len_v3v3(dw_p, up_p);
mul_v3_m4v3(v_proj, t->obedit->obmat, sv->v->co);
- if (ED_view3d_project_float_global(t->ar, v_proj, v_proj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_SUCCESS) {
+ if (ED_view3d_project_float_global(t->ar, v_proj, v_proj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
dist = len_squared_v2v2(mval, v_proj);
if (dist < min_dist) {
min_dist = dist;
@@ -4871,10 +4860,9 @@ static int createSlideVerts(TransInfo *t)
{
BMEditMesh *em = BMEdit_FromObject(t->obedit);
BMesh *bm = em->bm;
- BMIter iter, iter2;
+ BMIter iter;
BMEdge *e, *e1;
BMVert *v, *v2, *first;
- BMLoop *l, *l1, *l2;
TransDataSlideVert *sv_array;
BMBVHTree *btree = BMBVH_NewBVH(em, BMBVH_RESPECT_HIDDEN, NULL, NULL);
SmallHash table;
@@ -4914,6 +4902,7 @@ static int createSlideVerts(TransInfo *t)
/*ensure valid selection*/
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+ BMIter iter2;
numsel = 0;
BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) {
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
@@ -4966,6 +4955,8 @@ static int createSlideVerts(TransInfo *t)
j = 0;
while (1) {
+ BMLoop *l, *l1, *l2;
+
v = NULL;
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG))
@@ -5099,7 +5090,7 @@ static int createSlideVerts(TransInfo *t)
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
BMIter iter2;
BMEdge *e2;
- float vec1[3], mval[2] = {t->mval[0], t->mval[1]}, d;
+ float vec1[3], d;
/* search cross edges for visible edge to the mouse cursor,
* then use the shared vertex to calculate screen vector*/