diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-09-18 10:41:29 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-09-18 10:41:29 +0400 |
commit | 0a2b8b13089ef479d4a2d135b567410c8a5e6ab5 (patch) | |
tree | 3377b2bd39b6e7c2e3ce302a3bb01d7b2ddfbe25 /source/blender/src/space.c | |
parent | d86a03113d24904dd4b6227f16431eb6735aa5d7 (diff) |
A user submitted a BVH file that took a long time to import (I didnt end up finishing since it was so slow)
this is mainly because adding pose keyframes recalculates every handle so importing became increasingly slow.
added a 'fast' argument to insertkey that python api's insertPoseKey can make use of since it alredy accepts a 'fast' option.
The ~4450 frame, 31 bone BVH imports in ~108sec now
Seperated editmode switch statement in space.c's event handling,
if editmode is disabled, or the images is a render or composite, UV editing operations are ignored.
In previous releases it has given an annoying warning if selecting or scaling is attempted when out of UV/Face mode.
Diffstat (limited to 'source/blender/src/space.c')
-rw-r--r-- | source/blender/src/space.c | 146 |
1 files changed, 67 insertions, 79 deletions
diff --git a/source/blender/src/space.c b/source/blender/src/space.c index a4287d03c59..13b28e30cc1 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -87,6 +87,7 @@ #include "BKE_node.h" #include "BKE_scene.h" #include "BKE_utildefines.h" +#include "BKE_image.h" /* for IMA_TYPE_COMPOSITE and IMA_TYPE_R_RESULT */ #include "BIF_spacetypes.h" /* first, nasty dependency with typedef */ @@ -4781,29 +4782,16 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; } } - else { - /* Draw tool is inactive */ - switch(event) { + else if (G.obedit) { + /* Draw tool is inactive, editmode is enabled and the image is not a render or composite */ + if (EM_texFaceCheck() && (G.sima->image==0 || (G.sima->image->type != IMA_TYPE_R_RESULT && G.sima->image->type != IMA_TYPE_COMPOSITE))) { + switch(event) { case LEFTMOUSE: - if(G.qual & LR_SHIFTKEY) { - if(G.sima->image && G.sima->image->tpageflag & IMA_TILES) - mouseco_to_curtile(); - else - sima_sample_color(); - } - else if(EM_texFaceCheck()) { - if (!gesture()) { - mouseco_to_cursor_sima(); - } - } else { - sima_sample_color(); - } + if (!gesture()) + mouseco_to_cursor_sima(); break; case RIGHTMOUSE: - if(EM_texFaceCheck()) - mouse_select_sima(); - else if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT)) - sample_vpaint(); + mouse_select_sima(); break; case AKEY: select_swap_tface_uv(); @@ -4814,31 +4802,16 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt) else if((G.qual==0)) borderselect_sima(UV_SELECT_ALL); break; + case CKEY: if (G.sima->flag & SI_SYNC_UVSEL) { /* operate on the editmesh */ if (G.qual==0) { if (G.scene->selectmode != SCE_SELECT_FACE) toggle_uv_select('f'); - - /* we could do this too but better not to */ - /*if ((G.scene->selectmode & SCE_SELECT_FACE)==0) { - G.scene->selectmode= SCE_SELECT_FACE; - EM_selectmode_set(); - BIF_undo_push("Selectmode Set: Face"); - - } else { - G.scene->selectmode= SCE_SELECT_VERTEX; - EM_selectmode_set(); - BIF_undo_push("Selectmode Set: Vertex"); - } - countall(); - allqueue(REDRAWVIEW3D, 1); */ - } else { error("Sync selection to Edit Mesh disables UV select options"); } - } else { /* normal operaton */ if(G.qual==LR_CTRLKEY) @@ -4855,12 +4828,6 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(okee("Unwrap")) unwrap_lscm(0); break; - case GKEY: - if((G.qual==0) && is_uv_tface_editing_allowed()) { - initTransform(TFM_TRANSLATION, CTX_NONE); - Transform(); - } - break; case HKEY: if(G.qual==LR_ALTKEY) reveal_tface_uv(); @@ -4879,39 +4846,19 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt) else if(G.qual==LR_ALTKEY) unlink_selection(); break; - case MKEY: - if((G.qual==0)) - mirrormenu_tface_uv(); - break; - case NKEY: - if(G.qual==LR_CTRLKEY) - replace_names_but(); - break; - case OKEY: - if (G.qual==LR_SHIFTKEY) { - G.scene->prop_mode = (G.scene->prop_mode+1)%7; - allqueue(REDRAWHEADERS, 0); - } - else if((G.qual==0)) { - G.scene->proportional= !G.scene->proportional; - } - break; case PKEY: - /*if(G.f & G_FACESELECT) {*/ - if (EM_texFaceCheck()) { - if(G.qual==LR_CTRLKEY) - pack_charts_tface_uv(); - else if(G.qual==LR_SHIFTKEY) - select_pinned_tface_uv(); - else if(G.qual==LR_ALTKEY) - pin_tface_uv(0); - else - pin_tface_uv(1); - } else { - if(G.qual==LR_SHIFTKEY) { - toggle_blockhandler(sa, IMAGE_HANDLER_PREVIEW, 0); - scrarea_queue_winredraw(sa); - } + if(G.qual==LR_CTRLKEY) + pack_charts_tface_uv(); + else if(G.qual==LR_SHIFTKEY) + select_pinned_tface_uv(); + else if(G.qual==LR_ALTKEY) + pin_tface_uv(0); + else + pin_tface_uv(1); + case GKEY: + if((G.qual==0) && is_uv_tface_editing_allowed()) { + initTransform(TFM_TRANSLATION, CTX_NONE); + Transform(); } break; case RKEY: @@ -4942,11 +4889,10 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt) case WKEY: weld_align_menu_tface_uv(); break; - case PADPERIOD: - if(G.qual==0) - image_viewcenter(); + case MKEY: + if((G.qual==0)) + mirrormenu_tface_uv(); break; - case COMMAKEY: if(G.qual==LR_SHIFTKEY) { G.v2d->around= V3D_CENTROID; @@ -4964,10 +4910,52 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt) } else if(G.qual==0) { G.v2d->around= V3D_CURSOR; } - scrarea_queue_headredraw(curarea); scrarea_queue_winredraw(curarea); break; + case OKEY: + if(G.qual==0) { + G.scene->proportional= !G.scene->proportional; + allqueue(REDRAWHEADERS, 0); + } else if (G.qual==LR_SHIFTKEY) { + G.scene->prop_mode = (G.scene->prop_mode+1)%7; + allqueue(REDRAWHEADERS, 0); + } + + break; + } + } + } else { + /* Draw and editmode are inactive */ + switch(event) { + case LEFTMOUSE: + if(G.qual & LR_SHIFTKEY) { + if(G.sima->image && G.sima->image->tpageflag & IMA_TILES) + mouseco_to_curtile(); + else + sima_sample_color(); + } else { + sima_sample_color(); + } + break; + case RIGHTMOUSE: + if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT)) + sample_vpaint(); + break; + case NKEY: + if(G.qual==LR_CTRLKEY) + replace_names_but(); + break; + case PKEY: + if(G.qual==LR_SHIFTKEY) { + toggle_blockhandler(sa, IMAGE_HANDLER_PREVIEW, 0); + scrarea_queue_winredraw(sa); + } + break; + case PADPERIOD: + if(G.qual==0) + image_viewcenter(); + break; } } |