4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
30 * - here initialize and free and handling SPACE data
40 #include "MEM_guardedalloc.h"
41 #include "MEM_CacheLimiterC-Api.h"
44 #include "BIF_language.h"
47 #include "IMB_imbuf_types.h"
48 #include "IMB_imbuf.h"
50 #include "BLI_blenlib.h"
51 #include "BLI_arithb.h"
52 #include "BLI_gsqueue.h"
53 #include "BLI_linklist.h"
55 #include "DNA_action_types.h"
56 #include "DNA_armature_types.h"
57 #include "DNA_curve_types.h"
58 #include "DNA_group_types.h" /* used for select_same_group */
59 #include "DNA_gpencil_types.h"
60 #include "DNA_image_types.h"
61 #include "DNA_ipo_types.h"
62 #include "DNA_mesh_types.h"
63 #include "DNA_meshdata_types.h"
64 #include "DNA_modifier_types.h" /* used for select grouped hooks */
65 #include "DNA_object_types.h"
66 #include "DNA_particle_types.h"
67 #include "DNA_property_types.h"
68 #include "DNA_scene_types.h"
69 #include "DNA_screen_types.h"
70 #include "DNA_sequence_types.h"
71 #include "DNA_sound_types.h"
72 #include "DNA_space_types.h"
73 #include "DNA_userdef_types.h"
74 #include "DNA_view2d_types.h"
75 #include "DNA_view3d_types.h"
77 #include "BKE_blender.h"
78 #include "BKE_colortools.h"
79 #include "BKE_curve.h"
80 #include "BKE_depsgraph.h"
81 #include "BKE_DerivedMesh.h"
82 #include "BKE_displist.h"
83 #include "BKE_global.h"
84 #include "BKE_group.h"
88 #include "BKE_multires.h"
90 #include "BKE_pointcache.h"
91 #include "BKE_property.h"
92 #include "BKE_scene.h"
93 #include "BKE_sculpt.h"
94 #include "BKE_texture.h"
95 #include "BKE_utildefines.h"
96 #include "BKE_image.h" /* for IMA_TYPE_COMPOSITE and IMA_TYPE_R_RESULT */
97 #include "BKE_particle.h"
98 #include "BIF_spacetypes.h" /* first, nasty dependency with typedef */
100 #include "BIF_butspace.h"
101 #include "BIF_drawimage.h"
102 #include "BIF_drawseq.h"
103 #include "BIF_drawtext.h"
104 #include "BIF_drawscript.h"
105 #include "BIF_editarmature.h"
106 #include "BIF_editparticle.h"
107 #include "BIF_editconstraint.h"
108 #include "BIF_editdeform.h"
109 #include "BIF_editfont.h"
110 #include "BIF_editgroup.h"
111 #include "BIF_editkey.h"
112 #include "BIF_editlattice.h"
113 #include "BIF_editmesh.h"
114 #include "BIF_editmode_undo.h"
115 #include "BIF_editnla.h"
116 #include "BIF_editoops.h"
117 #include "BIF_editseq.h"
118 #include "BIF_editsima.h"
119 #include "BIF_editsound.h"
120 #include "BIF_editview.h"
121 #include "BIF_filelist.h"
123 #include "BIF_imasel.h"
124 #include "BIF_interface.h"
125 #include "BIF_interface_icons.h"
126 #include "BIF_keyframing.h"
127 #include "BIF_meshtools.h"
128 #include "BIF_mywindow.h"
129 #include "BIF_oops.h"
130 #include "BIF_poselib.h"
131 #include "BIF_poseobject.h"
132 #include "BIF_outliner.h"
133 #include "BIF_radialcontrol.h"
134 #include "BIF_resources.h"
135 #include "BIF_retopo.h"
136 #include "BIF_screen.h"
137 #include "BIF_space.h"
138 #include "BIF_toets.h"
139 #include "BIF_toolbox.h"
140 #include "BIF_usiblender.h"
141 #include "BIF_previewrender.h"
143 #include "BSE_edit.h"
144 #include "BSE_view.h"
145 #include "BSE_editipo.h"
146 #include "BSE_drawipo.h"
147 #include "BSE_drawview.h"
148 #include "BSE_drawnla.h"
149 #include "BSE_filesel.h"
150 #include "BSE_headerbuttons.h"
151 #include "BSE_editnla_types.h"
152 #include "BSE_time.h"
153 #include "BSE_trans_types.h"
155 #include "BDR_vpaint.h"
156 #include "BDR_editmball.h"
157 #include "BDR_editobject.h"
158 #include "BDR_editcurve.h"
159 #include "BDR_editface.h"
160 #include "BDR_drawmesh.h"
161 #include "BDR_drawobject.h"
162 #include "BDR_imagepaint.h"
163 #include "BDR_sculptmode.h"
164 #include "BDR_unwrapper.h"
165 #include "BDR_gpencil.h"
167 #include "BLO_readfile.h" /* for BLO_blendhandle_close */
169 #include "PIL_time.h"
171 #ifndef DISABLE_PYTHON
172 #include "BPY_extern.h"
175 #include "butspace.h"
176 #include "mydevice.h"
179 #include "multires.h"
181 #include "BIF_transform.h"
183 #include "BKE_depsgraph.h"
185 #include "BSE_trans_types.h"
187 #include "SYS_System.h" /* for the user def menu ... should move elsewhere. */
189 #include "GPU_extensions.h"
190 #include "GPU_draw.h"
192 #include "BLO_sys_types.h" // for intptr_t support
194 /* maybe we need this defined somewhere else */
195 extern void StartKetsjiShell(ScrArea *area, char* startscenename, struct Main* maggie, struct SpaceIpo* sipo,int always_use_expand_framing);
196 extern void StartKetsjiShellSimulation(ScrArea *area, char* startscenename, struct Main* maggie, struct SpaceIpo* sipo,int always_use_expand_framing);/*rcruiz*/
199 * When the mipmap setting changes, we want to redraw the view right
200 * away to reflect this setting.
202 //static void space_mipmap_button_function(int event);
204 static void free_soundspace(SpaceSound *ssound);
206 /* *************************************** */
208 /* don't know yet how the handlers will evolve, for simplicity
209 i choose for an array with eventcodes, this saves in a file!
211 void add_blockhandler(ScrArea *sa, short eventcode, short val)
213 SpaceLink *sl= sa->spacedata.first;
216 /* find empty spot */
217 for(a=0; a<SPACE_MAXHANDLER; a+=2) {
218 if( sl->blockhandler[a]==eventcode ) {
219 sl->blockhandler[a+1]= val;
222 else if( sl->blockhandler[a]==0) {
223 sl->blockhandler[a]= eventcode;
224 sl->blockhandler[a+1]= val;
228 if(a==SPACE_MAXHANDLER) {
229 error("Only %i floating panels allowed", SPACE_MAXHANDLER/2);
234 void rem_blockhandler(ScrArea *sa, short eventcode)
236 SpaceLink *sl= sa->spacedata.first;
239 for(a=0; a<SPACE_MAXHANDLER; a+=2) {
240 if( sl->blockhandler[a]==eventcode) {
241 sl->blockhandler[a]= 0;
243 /* specific free calls */
244 if(eventcode==IMAGE_HANDLER_PREVIEW)
245 image_preview_event(0);
251 void toggle_blockhandler(ScrArea *sa, short eventcode, short val)
253 SpaceLink *sl= sa->spacedata.first;
256 /* find if it exists */
257 for(a=0; a<SPACE_MAXHANDLER; a+=2) {
258 if( sl->blockhandler[a]==eventcode ) {
259 sl->blockhandler[a]= 0;
261 /* specific free calls */
262 if(eventcode==VIEW3D_HANDLER_PREVIEW)
263 BIF_view3d_previewrender_free(sa->spacedata.first);
264 else if(eventcode==IMAGE_HANDLER_PREVIEW)
265 image_preview_event(0);
271 add_blockhandler(sa, eventcode, val);
273 /* specific add new calls */
274 if(eventcode==IMAGE_HANDLER_PREVIEW)
275 image_preview_event(1);
281 /* ************* SPACE: VIEW3D ************* */
283 /* extern void drawview3dspace(ScrArea *sa, void *spacedata); BSE_drawview.h */
286 void copy_view3d_lock(short val)
291 /* from G.scene copy to the other views */
292 sc= G.main->screen.first;
295 if(sc->scene==G.scene) {
296 ScrArea *sa= sc->areabase.first;
298 SpaceLink *sl= sa->spacedata.first;
300 if(sl->spacetype==SPACE_OOPS && val==REDRAW) {
301 if(sa->win) scrarea_queue_winredraw(sa);
303 else if(sl->spacetype==SPACE_VIEW3D) {
304 View3D *vd= (View3D*) sl;
305 if(vd->scenelock && vd->localview==0) {
306 vd->lay= G.scene->lay;
307 vd->camera= G.scene->camera;
309 if(vd->camera==0 && vd->persp==V3D_CAMOB) vd->persp= V3D_PERSP;
311 if( (vd->lay & vd->layact) == 0) {
314 if(vd->lay & (1<<bit)) {
322 if(val==REDRAW && vd==sa->spacedata.first) {
323 if(sa->win) scrarea_queue_redraw(sa);
336 void handle_view3d_around()
340 if ((U.uiflag & USER_LOCKAROUND)==0) return;
342 /* copies from G.vd->around to other view3ds */
344 sc= G.main->screen.first;
347 if(sc->scene==G.scene) {
348 ScrArea *sa= sc->areabase.first;
350 SpaceLink *sl= sa->spacedata.first;
352 if(sl->spacetype==SPACE_VIEW3D) {
353 View3D *vd= (View3D*) sl;
355 vd->around= G.vd->around;
356 if (G.vd->flag & V3D_ALIGN)
357 vd->flag |= V3D_ALIGN;
359 vd->flag &= ~V3D_ALIGN;
360 scrarea_queue_headredraw(sa);
372 void handle_view3d_lock()
374 if (G.vd != NULL && curarea != NULL ) {
375 if(G.vd->localview==0 && G.vd->scenelock && curarea->spacetype==SPACE_VIEW3D) {
378 G.scene->lay= G.vd->lay;
379 G.scene->camera= G.vd->camera;
381 copy_view3d_lock(REDRAW);
386 void space_set_commmandline_options(void) {
387 SYS_SystemHandle syshandle;
390 if ( (syshandle = SYS_GetSystem()) ) {
391 /* User defined settings */
392 a= (U.gameflags & USER_DISABLE_SOUND);
393 /* if user already disabled audio at the command-line, don't re-enable it */
396 SYS_WriteCommandLineInt(syshandle, "noaudio", a);
399 a= (U.gameflags & USER_DISABLE_MIPMAP);
401 SYS_WriteCommandLineInt(syshandle, "nomipmap", a);
403 /* File specific settings: */
404 /* Only test the first one. These two are switched
406 a= (G.fileflags & G_FILE_SHOW_FRAMERATE);
407 SYS_WriteCommandLineInt(syshandle, "show_framerate", a);
408 SYS_WriteCommandLineInt(syshandle, "show_profile", a);
410 /* When in wireframe mode, always draw debug props. */
412 a = ( (G.fileflags & G_FILE_SHOW_DEBUG_PROPS)
413 || (G.vd->drawtype == OB_WIRE)
414 || (G.vd->drawtype == OB_SOLID) );
415 SYS_WriteCommandLineInt(syshandle, "show_properties", a);
418 a= (G.fileflags & G_FILE_SHOW_PHYSICS);
419 SYS_WriteCommandLineInt(syshandle, "show_physics", a);
421 a= (G.fileflags & G_FILE_ENABLE_ALL_FRAMES);
422 SYS_WriteCommandLineInt(syshandle, "fixedtime", a);
424 a= (G.fileflags & G_FILE_GAME_TO_IPO);
425 SYS_WriteCommandLineInt(syshandle, "game2ipo", a);
427 a=(G.fileflags & G_FILE_GAME_MAT);
428 SYS_WriteCommandLineInt(syshandle, "blender_material", a);
429 a=(G.fileflags & G_FILE_GAME_MAT_GLSL);
430 SYS_WriteCommandLineInt(syshandle, "blender_glsl_material", a);
431 a=(G.fileflags & G_FILE_DISPLAY_LISTS);
432 SYS_WriteCommandLineInt(syshandle, "displaylists", a);
440 * These two routines imported from the gameengine,
441 * I suspect a lot of the resetting stuff is cruft
442 * and can be removed, but it should be checked.
444 static void SaveState(void)
446 glPushAttrib(GL_ALL_ATTRIB_BITS);
450 if(G.f & G_TEXTUREPAINT)
451 GPU_paint_set_mipmap(1);
456 static void RestoreState(void)
458 if(G.f & G_TEXTUREPAINT)
459 GPU_paint_set_mipmap(0);
461 curarea->win_swap = 0;
462 curarea->head_swap=0;
463 allqueue(REDRAWVIEW3D, 1);
464 allqueue(REDRAWBUTSALL, 0);
471 static LinkNode *save_and_reset_all_scene_cfra(void)
473 LinkNode *storelist= NULL;
476 for (sc= G.main->scene.first; sc; sc= sc->id.next) {
477 BLI_linklist_prepend(&storelist, (void*) (intptr_t) sc->r.cfra);
479 /* why is this reset to 1 ?*/
485 BLI_linklist_reverse(&storelist);
490 static void restore_all_scene_cfra(LinkNode *storelist) {
491 LinkNode *sc_store= storelist;
494 for (sc= G.main->scene.first; sc; sc= sc->id.next) {
495 int stored_cfra= (intptr_t) sc_store->link;
497 sc->r.cfra= stored_cfra;
500 sc_store= sc_store->next;
503 BLI_linklist_free(storelist, NULL);
507 void start_game(void)
511 Scene *sc, *startscene = G.scene;
512 LinkNode *scene_cfra_store;
514 /* XXX, silly code - the game engine can
515 * access any scene through logic, so we try
516 * to make sure each scene has a valid camera,
517 * just in case the game engine tries to use it.
519 * Better would be to make a better routine
520 * in the game engine for finding the camera.
522 * Note: yes, this is all very badly hacked! (ton)
524 for (sc= G.main->scene.first; sc; sc= sc->id.next) {
528 for (base= sc->base.first; base; base= base->next)
529 if (base->object->type==OB_CAMERA)
532 sc->camera= base?base->object:NULL;
536 /* these two lines make sure front and backbuffer are equal. for swapbuffers */
538 screen_swapbuffers();
540 /* can start from header */
541 mywinset(curarea->win);
543 scene_cfra_store= save_and_reset_all_scene_cfra();
546 /* game engine will do its own sounds. */
547 sound_stop_all_sounds();
550 /* Before jumping into Ketsji, we configure some settings. */
551 space_set_commmandline_options();
554 StartKetsjiShell(curarea, startscene->id.name+2, G.main,G.sipo, 1);
557 /* Restart BPY - unload the game engine modules. */
559 /* Commented out: testing before Blender 2.46 if it's ok to keep
560 * these modules around, they give access to relevant info for
561 * exporters to other engines...
563 BPY_start_python(0, NULL);
564 BPY_post_start_python();
567 restore_all_scene_cfra(scene_cfra_store);
568 set_scene_bg(startscene);
569 scene_update_for_newframe(G.scene, G.scene->lay);
571 if (G.flags & G_FILE_AUTOPLAY)
574 /* groups could have changed ipo */
575 allqueue(REDRAWNLA, 0);
576 allqueue(REDRAWACTION, 0);
577 allspace(REMAKEIPO, 0);
578 allqueue(REDRAWIPO, 0);
581 notice("Game engine is disabled in this release!");
585 void start_RBSimulation(void)
589 Scene *sc, *startscene = G.scene;
590 LinkNode *scene_cfra_store;
592 /* XXX, silly code - the game engine can
593 * access any scene through logic, so we try
594 * to make sure each scene has a valid camera,
595 * just in case the game engine tries to use it.
597 * Better would be to make a better routine
598 * in the game engine for finding the camera.
600 * Note: yes, this is all very badly hacked! (ton)
602 for (sc= G.main->scene.first; sc; sc= sc->id.next) {
606 for (base= sc->base.first; base; base= base->next)
607 if (base->object->type==OB_CAMERA)
610 sc->camera= base?base->object:NULL;
614 /* these two lines make sure front and backbuffer are equal. for swapbuffers */
616 screen_swapbuffers();
618 /* can start from header */
619 mywinset(curarea->win);
621 scene_cfra_store= save_and_reset_all_scene_cfra();
624 /* game engine will do its own sounds. */
625 sound_stop_all_sounds();
628 /* Before jumping into Ketsji, we configure some settings. */
629 space_set_commmandline_options();
632 StartKetsjiShellSimulation(curarea, startscene->id.name+2, G.main,G.sipo, 1);
635 /* Restart BPY - unload the game engine modules. */
637 /* Commented out: testing before Blender 2.46 if it's ok to keep
638 * these modules around, they give access to relevant info for
639 * exporters to other engines...
641 BPY_start_python(0, NULL);
642 BPY_post_start_python();
645 restore_all_scene_cfra(scene_cfra_store);
646 set_scene_bg(startscene);
647 scene_update_for_newframe(G.scene, G.scene->lay);
649 if (G.flags & G_FILE_AUTOPLAY)
652 /* groups could have changed ipo */
653 allqueue(REDRAWNLA, 0);
654 allqueue(REDRAWACTION, 0);
655 allspace(REMAKEIPO, 0);
656 allqueue(REDRAWIPO, 0);
659 notice("YOU NEED GAME ENGIEN TO RUN THE SIMULATION!");
663 static void changeview3dspace(ScrArea *sa, void *spacedata)
665 setwinmatrixview3d(sa->winx, sa->winy, NULL); /* 0= no pick rect */
668 /* Callable from editmode and faceselect mode from the
669 * moment, would be nice (and is easy) to generalize
672 static void align_view_to_selected(View3D *v3d)
674 int nr= pupmenu("Align View (Ctrl flips)%t|To Selected (top)%x3|To Selected (front)%x2|To Selected (side)%x1");
678 /* opposite axis in case ctrl is pressed */
679 if(G.qual==LR_CTRLKEY) axis= -axis;
681 if ((G.obedit) && (G.obedit->type == OB_MESH)) {
682 editmesh_align_view_to_selected(v3d, axis);
683 addqueue(v3d->area->win, REDRAW, 1);
684 } else if (FACESEL_PAINT_TEST) {
685 Object *obact= OBACT;
686 if (obact && obact->type==OB_MESH) {
687 Mesh *me= obact->data;
688 faceselect_align_view_to_selected(v3d, me, axis);
689 addqueue(v3d->area->win, REDRAW, 1);
696 static short select_children(Object *ob, int recursive)
701 for (base= FIRSTBASE; base; base= base->next) {
702 if (ob == base->object->parent) {
703 if (BASE_SELECTABLE(base) && !(base->flag & SELECT)) {
704 base->flag |= SELECT;
705 base->object->flag |= SELECT;
710 changed |= select_children(base->object, 1);
716 static short select_parent(void) /* Makes parent active and de-selected OBACT */
719 Base *base, *startbase, *basact=NULL, *oldbasact;
721 if (!(OBACT->parent)) return 0; /* we know OBACT is valid */
722 BASACT->flag &= (~SELECT);
723 BASACT->object->flag &= (~SELECT);
724 startbase= FIRSTBASE;
725 if(BASACT && BASACT->next) startbase= BASACT->next;
728 if(base->object==BASACT->object->parent) { basact=base; break; }
730 if(base==NULL) base= FIRSTBASE;
731 if(base==startbase) break;
733 /* can be NULL if parent in other scene */
734 if(basact && BASE_SELECTABLE(basact)) {
737 basact->flag |= SELECT;
739 basact->object->flag= basact->flag;
741 set_active_base(basact);
748 #define GROUP_MENU_MAX 24
749 static short select_same_group(Object *ob) /* Select objects in the same group as the active */
753 Group *group, *ob_groups[GROUP_MENU_MAX];
754 char str[10 + (24*GROUP_MENU_MAX)];
756 int group_count=0, menu, i;
758 for ( group=G.main->group.first;
759 group && group_count < GROUP_MENU_MAX;
762 if (object_in_group (ob, group)) {
763 ob_groups[group_count] = group;
771 else if (group_count == 1) {
772 group = ob_groups[0];
773 for (base= FIRSTBASE; base; base= base->next) {
774 if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && object_in_group(base->object, group)) {
775 base->flag |= SELECT;
776 base->object->flag |= SELECT;
783 /* build the menu. */
784 p += sprintf(str, "Groups%%t");
785 for (i=0; i<group_count; i++) {
786 group = ob_groups[i];
787 p += sprintf (p, "|%s%%x%i", group->id.name+2, i);
790 menu = pupmenu (str);
794 group = ob_groups[menu];
795 for (base= FIRSTBASE; base; base= base->next) {
796 if (!(base->flag & SELECT) && object_in_group(base->object, group)) {
797 base->flag |= SELECT;
798 base->object->flag |= SELECT;
805 static short select_object_hooks(Object *ob)
810 HookModifierData *hmd;
812 for (md = ob->modifiers.first; md; md=md->next) {
813 if (md->type==eModifierType_Hook) {
814 hmd= (HookModifierData*) md;
815 if (hmd->object && !(hmd->object->flag & SELECT)) {
816 base= object_in_scene(hmd->object, G.scene);
817 if (base && BASE_SELECTABLE(base)) {
818 base->flag |= SELECT;
819 base->object->flag |= SELECT;
828 /* Select objects woth the same parent as the active (siblings),
829 * parent can be NULL also */
830 static short select_same_parent(Object *ob)
835 for (base= FIRSTBASE; base; base= base->next) {
836 if (BASE_SELECTABLE(base) && (base->object->parent==ob->parent) && !(base->flag & SELECT)) {
837 base->flag |= SELECT;
838 base->object->flag |= SELECT;
845 static short select_same_type(Object *ob)
850 for (base= FIRSTBASE; base; base= base->next) {
851 if (BASE_SELECTABLE(base) && (base->object->type == ob->type) && !(base->flag & SELECT)) {
852 base->flag |= SELECT;
853 base->object->flag |= SELECT;
860 static short select_same_layer(Object *ob)
863 Base *base = FIRSTBASE;
866 if (BASE_SELECTABLE(base) && (base->lay & ob->lay) && !(base->flag & SELECT)) {
867 base->flag |= SELECT;
868 base->object->flag |= SELECT;
876 static short select_same_index_object(Object *ob)
879 Base *base = FIRSTBASE;
882 if (BASE_SELECTABLE(base) && (base->object->index == ob->index) && !(base->flag & SELECT)) {
883 base->flag |= SELECT;
884 base->object->flag |= SELECT;
892 static short select_same_color(Object *ob)
895 Base *base = FIRSTBASE;
898 if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && (FloatCompare(base->object->col, ob->col, 0.005f))) {
899 base->flag |= SELECT;
900 base->object->flag |= SELECT;
908 static short objects_share_gameprop(Object *a, Object *b)
911 /*make a copy of all its properties*/
913 for( prop= a->prop.first; prop; prop = prop->next ) {
914 if ( get_ob_property(b, prop->name) )
920 static short select_same_gameprops(Object *ob)
923 Base *base = FIRSTBASE;
926 if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && (objects_share_gameprop(base->object, ob))) {
927 base->flag |= SELECT;
928 base->object->flag |= SELECT;
936 void select_object_grouped(short nr)
941 if (ob==NULL) return;
943 if(nr==1) changed = select_children(ob, 1);
944 else if(nr==2) changed = select_children(ob, 0);
945 else if(nr==3) changed = select_parent();
946 else if(nr==4) changed = select_same_parent(ob);
947 else if(nr==5) changed = select_same_type(ob);
948 else if(nr==6) changed = select_same_layer(ob);
949 else if(nr==7) changed = select_same_group(ob);
950 else if(nr==8) changed = select_object_hooks(ob);
951 else if(nr==9) changed = select_same_index_object(ob);
952 else if(nr==10) changed = select_same_color(ob);
953 else if(nr==11) changed = select_same_gameprops(ob);
957 allqueue(REDRAWVIEW3D, 0);
958 allqueue(REDRAWBUTSOBJECT, 0);
959 allspace(REMAKEIPO, 0);
960 allqueue(REDRAWIPO, 0);
961 BIF_undo_push("Select Grouped");
965 static void select_object_grouped_menu(void)
970 /* make menu string */
972 str= MEM_mallocN(512, "groupmenu");
973 strcpy(str, "Select Grouped%t|Children%x1|"
974 "Immediate Children%x2|Parent%x3|"
975 "Siblings (Shared Parent)%x4|"
976 "Objects of Same Type%x5|"
977 "Objects on Shared Layers%x6|"
978 "Objects in Same Group%x7|"
980 "Object PassIndex%x9|"
982 "Game Properties%x11");
989 select_object_grouped(nr);
996 error("This data does not support joining in editmode");
1000 error("Can't join unless there is an active object");
1004 if(ob->type == OB_MESH) {
1005 if(okee("Join selected meshes")==0) return;
1007 } else if(ob->type == OB_CURVE) {
1008 if(okee("Join selected curves")==0) return;
1009 join_curve(OB_CURVE);
1010 } else if(ob->type == OB_SURF) {
1011 if(okee("Join selected NURBS")==0) return;
1012 join_curve(OB_SURF);
1013 } else if(ob->type == OB_ARMATURE) {
1014 /* Make sure the user wants to continue*/
1015 if(okee("Join selected armatures")==0) return;
1018 error("This object type doesn't support joining");
1022 static unsigned short convert_for_nonumpad(unsigned short event)
1024 if (event>=ZEROKEY && event<=NINEKEY) {
1025 return event - ZEROKEY + PAD0;
1026 } else if (event==MINUSKEY) {
1028 } else if (event==EQUALKEY) {
1030 } else if (event==BACKSLASHKEY) {
1037 /* *************** */
1039 void BIF_undo_push(char *str)
1042 if (U.undosteps == 0) return;
1044 if(G.obedit->type==OB_MESH)
1045 undo_push_mesh(str);
1046 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
1047 undo_push_curve(str);
1048 else if (G.obedit->type==OB_FONT)
1049 undo_push_font(str);
1050 else if (G.obedit->type==OB_MBALL)
1051 undo_push_mball(str);
1052 else if (G.obedit->type==OB_LATTICE)
1053 undo_push_lattice(str);
1054 else if (G.obedit->type==OB_ARMATURE)
1055 undo_push_armature(str);
1057 else if(G.f & G_PARTICLEEDIT) {
1058 if (U.undosteps == 0) return;
1063 if(U.uiflag & USER_GLOBALUNDO)
1064 BKE_write_undo(str);
1071 if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
1072 undo_editmode_step(1);
1075 if(G.f & G_TEXTUREPAINT)
1076 undo_imagepaint_step(1);
1077 else if(curarea->spacetype==SPACE_IMAGE && (G.sima->flag & SI_DRAWTOOL))
1078 undo_imagepaint_step(1);
1079 else if(G.f & G_PARTICLEEDIT)
1082 /* now also in faceselect mode */
1083 if(U.uiflag & USER_GLOBALUNDO) {
1084 #ifndef DISABLE_PYTHON
1085 BPY_scripts_clear_pyobjects();
1088 sound_initialize_sounds();
1097 if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
1098 undo_editmode_step(-1);
1101 if(G.f & G_TEXTUREPAINT)
1102 undo_imagepaint_step(-1);
1103 else if(curarea->spacetype==SPACE_IMAGE && (G.sima->flag & SI_DRAWTOOL))
1104 undo_imagepaint_step(-1);
1105 else if(G.f & G_PARTICLEEDIT)
1108 /* includes faceselect now */
1109 if(U.uiflag & USER_GLOBALUNDO) {
1111 sound_initialize_sounds();
1117 void BIF_undo_menu(void)
1120 if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
1121 undo_editmode_menu();
1122 allqueue(REDRAWALL, 0);
1125 if(G.f & G_PARTICLEEDIT)
1127 else if(U.uiflag & USER_GLOBALUNDO) {
1128 char *menu= BKE_undo_menu_string();
1130 short event= pupmenu_col(menu, 20);
1133 BKE_undo_number(event);
1134 sound_initialize_sounds();
1141 /* *************** */
1143 void handle_view_middlemouse() {
1144 /* use '&' here, because of alt+leftmouse which emulates middlemouse */
1145 if(U.flag & USER_VIEWMOVE) {
1146 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1148 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1150 else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
1154 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1156 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1158 else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
1163 void handle_view_wheelup()
1165 /* Regular: Zoom in */
1166 /* Shift: Scroll up */
1167 /* Ctrl: Scroll right */
1168 /* Alt-Shift: Rotate up */
1169 /* Alt-Ctrl: Rotate right */
1171 if( G.qual & LR_SHIFTKEY ) {
1172 if( G.qual & LR_ALTKEY ) {
1173 G.qual &= ~LR_SHIFTKEY;
1175 G.qual |= LR_SHIFTKEY;
1179 } else if( G.qual & LR_CTRLKEY ) {
1180 if( G.qual & LR_ALTKEY ) {
1181 G.qual &= ~LR_CTRLKEY;
1183 G.qual |= LR_CTRLKEY;
1187 } else if(U.uiflag & USER_WHEELZOOMDIR)
1188 persptoetsen(PADMINUS);
1190 persptoetsen(PADPLUSKEY);
1193 void handle_view_wheeldown()
1195 /* Regular: Zoom out */
1196 /* Shift: Scroll down */
1197 /* Ctrl: Scroll left */
1198 /* Alt-Shift: Rotate down */
1199 /* Alt-Ctrl: Rotate left */
1201 if( G.qual & LR_SHIFTKEY ) {
1202 if( G.qual & LR_ALTKEY ) {
1203 G.qual &= ~LR_SHIFTKEY;
1205 G.qual |= LR_SHIFTKEY;
1209 } else if( G.qual & LR_CTRLKEY ) {
1210 if( G.qual & LR_ALTKEY ) {
1211 G.qual &= ~LR_CTRLKEY;
1213 G.qual |= LR_CTRLKEY;
1217 } else if(U.uiflag & USER_WHEELZOOMDIR)
1218 persptoetsen(PADPLUSKEY);
1220 persptoetsen(PADMINUS);
1223 int mouse_in_header(ScrArea *sa)
1226 getmouseco_sc(mouse);
1227 return mouse[0] >= sa->headrct.xmin &&
1228 mouse[0] <= sa->headrct.xmax &&
1229 mouse[1] >= sa->headrct.ymin &&
1230 mouse[1] <= sa->headrct.ymax;
1233 static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
1235 View3D *v3d= sa->spacedata.first;
1236 Object *ob= OBACT; /* do not change! */
1238 int doredraw= 0, pupval;
1239 unsigned short event= evt->event;
1240 short val= evt->val;
1241 char ascii= evt->ascii;
1243 if(curarea->win==0) return; /* when it comes from sa->headqread() */
1247 if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
1249 if(event==UI_BUT_EVENT) do_butspace(val); /* temporal, view3d deserves own queue? */
1251 /* - we consider manipulator a button, defaulting to leftmouse
1252 * - grease-pencil also defaults to leftmouse
1254 if(event==LEFTMOUSE) {
1255 #ifndef DISABLE_PYTHON
1256 /* run any view3d event handler script links */
1257 if (sa->scriptlink.totscript) {
1258 if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT))
1259 return; /* return if event was processed (swallowed) by handler(s) */
1262 if(gpencil_do_paint(sa, L_MOUSE)) return;
1263 if(BIF_do_manipulator(sa)) return;
1265 else if(event==RIGHTMOUSE) {
1266 if(gpencil_do_paint(sa, R_MOUSE)) return;
1269 /* swap mouse buttons based on user preference */
1270 if (U.flag & USER_LMOUSESELECT) {
1271 /* only swap mouse button for selection, in modes where it is relevant.
1272 * painting/sculpting stays on LEFTMOUSE */
1273 if ( !((G.f & G_SCULPTMODE) || (G.f & G_WEIGHTPAINT) || (G.f & G_GREASEPENCIL) ||
1274 (G.f & G_VERTEXPAINT) || (G.f & G_TEXTUREPAINT) || (G.f & G_PARTICLEEDIT)) ||
1277 if (event==LEFTMOUSE) event = RIGHTMOUSE;
1278 else if (event==RIGHTMOUSE) event = LEFTMOUSE;
1282 if(!mouse_in_header(sa)) {
1283 if(!G.obedit && (G.f & G_SCULPTMODE)) {
1284 SculptSession *ss= sculpt_session();
1285 if(ss && ss->radialcontrol) {
1286 radialcontrol_do_events(ss->radialcontrol, event);
1289 else if(event!=LEFTMOUSE && event!=MIDDLEMOUSE && (event==MOUSEY || event==MOUSEX)) {
1290 if(!bwin_qtest(sa->win))
1291 allqueue(REDRAWVIEW3D, 0);
1294 else if(!G.obedit && OBACT && G.f&G_PARTICLEEDIT){
1295 ParticleSystem *psys=PE_get_current(OBACT);
1296 ParticleEditSettings *pset=PE_settings();
1297 if(*PE_radialcontrol()) {
1298 radialcontrol_do_events(*PE_radialcontrol(), event);
1301 if(psys && psys->edit){
1302 if(pset->brushtype>=0 &&
1303 event!=LEFTMOUSE && event!=RIGHTMOUSE && event!=MIDDLEMOUSE &&
1304 (event==MOUSEY || event==MOUSEX) && bwin_qtest(sa->win)==0) {
1305 allqueue(REDRAWVIEW3D, 0);
1310 /* Handle retopo painting */
1311 if(retopo_mesh_paint_check()) {
1312 if(!retopo_paint(event))
1317 #ifndef DISABLE_PYTHON
1318 /* run any view3d event handler script links */
1319 if (event && sa->scriptlink.totscript)
1320 if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT))
1321 return; /* return if event was processed (swallowed) by handler(s) */
1325 if((G.obedit) && G.obedit->type==OB_FONT) {
1332 /* use '&' here, because of alt+leftmouse which emulates middlemouse */
1333 if(U.flag & USER_VIEWMOVE) {
1334 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1336 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1338 else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
1342 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1344 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1352 /* Regular: Zoom in */
1353 /* Shift: Scroll up */
1354 /* Ctrl: Scroll right */
1355 /* Alt-Shift: Rotate up */
1356 /* Alt-Ctrl: Rotate right */
1358 if( G.qual & LR_SHIFTKEY ) {
1359 if( G.qual & LR_ALTKEY ) {
1360 G.qual &= ~LR_SHIFTKEY;
1362 G.qual |= LR_SHIFTKEY;
1366 } else if( G.qual & LR_CTRLKEY ) {
1367 if( G.qual & LR_ALTKEY ) {
1368 G.qual &= ~LR_CTRLKEY;
1370 G.qual |= LR_CTRLKEY;
1374 } else if(U.uiflag & USER_WHEELZOOMDIR)
1375 persptoetsen(PADMINUS);
1377 persptoetsen(PADPLUSKEY);
1382 case WHEELDOWNMOUSE:
1383 /* Regular: Zoom out */
1384 /* Shift: Scroll down */
1385 /* Ctrl: Scroll left */
1386 /* Alt-Shift: Rotate down */
1387 /* Alt-Ctrl: Rotate left */
1389 if( G.qual & LR_SHIFTKEY ) {
1390 if( G.qual & LR_ALTKEY ) {
1391 G.qual &= ~LR_SHIFTKEY;
1393 G.qual |= LR_SHIFTKEY;
1397 } else if( G.qual & LR_CTRLKEY ) {
1398 if( G.qual & LR_ALTKEY ) {
1399 G.qual &= ~LR_CTRLKEY;
1401 G.qual |= LR_CTRLKEY;
1405 } else if(U.uiflag & USER_WHEELZOOMDIR)
1406 persptoetsen(PADPLUSKEY);
1408 persptoetsen(PADMINUS);
1414 if(G.qual==LR_ALTKEY) {
1419 do_textedit(event, val, ascii);
1423 if(G.qual==LR_ALTKEY) {
1428 do_textedit(event, val, ascii);
1431 case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
1432 case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
1434 persptoetsen(event);
1439 do_textedit(event, val, ascii);
1443 else if(!G.obedit && (G.f & G_SCULPTMODE)) {
1444 SculptData *sd= sculpt_data();
1445 SculptSession *ss= sculpt_session();
1446 BrushData *br= sculptmode_brush();
1447 Mesh *me= get_mesh(OBACT);
1448 char update_prop= 0;
1450 if(U.flag & USER_NONUMPAD) {
1451 event= convert_for_nonumpad(event);
1456 if(G.qual==LR_SHIFTKEY+LR_CTRLKEY)
1458 else if(!(ss && ss->radialcontrol))
1463 handle_view_middlemouse();
1466 handle_view_wheelup();
1469 case WHEELDOWNMOUSE:
1470 handle_view_wheeldown();
1474 if(G.qual==LR_SHIFTKEY+LR_CTRLKEY)
1478 if(G.qual==LR_SHIFTKEY) {
1480 curs= give_cursor();
1481 curs[0]=curs[1]=curs[2]= 0.0;
1482 allqueue(REDRAWVIEW3D, 0);
1484 else if(G.qual==0) {
1485 if (G.vd->persp==V3D_CAMOB)
1486 /* center the camera offset */
1487 G.vd->camdx= G.vd->camdy= 0.0;
1489 /*non camera center*/
1491 curs= give_cursor();
1492 new_ofs[0]= -curs[0];
1493 new_ofs[1]= -curs[1];
1494 new_ofs[2]= -curs[2];
1495 smooth_view(G.vd, new_ofs, NULL, NULL, NULL);
1500 case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
1501 case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
1505 persptoetsen(event);
1509 if(G.qual==LR_ALTKEY)
1510 view3d_edit_clipping(v3d);
1511 else if(G.qual==LR_SHIFTKEY) {
1512 if(G.vd->persp==V3D_CAMOB)
1513 set_render_border();
1515 view3d_border_zoom();
1520 if(G.vd->localview) {
1522 endlocalview(curarea);
1528 allqueue(REDRAWVIEW3D, 1);
1531 /* Brush properties */
1533 if(G.qual==LR_SHIFTKEY)
1534 br->flag ^= SCULPT_BRUSH_ANCHORED;
1536 br->flag ^= SCULPT_BRUSH_AIRBRUSH;
1537 update_prop= 1; break;
1540 sculpt_radialcontrol_start(G.qual == 0 ? RADIALCONTROL_SIZE :
1541 G.qual == LR_SHIFTKEY ? RADIALCONTROL_STRENGTH :
1542 G.qual == LR_CTRLKEY ? RADIALCONTROL_ROTATION :
1543 RADIALCONTROL_NONE);
1547 br->dir= br->dir==1 ? 2 : 1;
1548 update_prop= 1; break;
1551 sd->brush_type= DRAW_BRUSH;
1552 update_prop= 1; break;
1554 if(G.qual==LR_SHIFTKEY)
1555 sd->flags ^= SCULPT_INPUT_SMOOTH;
1557 sd->brush_type= SMOOTH_BRUSH;
1562 sd->brush_type= PINCH_BRUSH;
1563 update_prop= 1; break;
1565 sd->brush_type= INFLATE_BRUSH;
1566 update_prop= 1; break;
1568 sd->brush_type= GRAB_BRUSH;
1569 update_prop= 1; break;
1571 sd->brush_type= LAYER_BRUSH;
1572 update_prop= 1; break;
1574 sd->brush_type= FLATTEN_BRUSH;
1575 update_prop= 1; break;
1579 update_prop= 1; break;
1582 update_prop= 1; break;
1585 update_prop= 1; break;
1589 toggle_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
1590 allqueue(REDRAWVIEW3D, 0);
1596 me->mr->newlvl= ((Mesh*)ob->data)->mr->current+1;
1597 multires_set_level_cb(ob, ob->data);
1602 me->mr->newlvl= ((Mesh*)ob->data)->mr->current-1;
1603 multires_set_level_cb(ob, ob->data);
1606 /* Partial Visibility */
1608 if(G.qual==LR_ALTKEY) {
1610 mesh_pmv_off(ob, get_mesh(ob));
1611 BIF_undo_push("Partial mesh hide");
1612 allqueue(REDRAWVIEW3D,0);
1618 do_layer_buttons(0); break;
1620 do_layer_buttons(1); break;
1622 do_layer_buttons(2); break;
1624 do_layer_buttons(3); break;
1626 do_layer_buttons(4); break;
1628 do_layer_buttons(5); break;
1630 do_layer_buttons(6); break;
1632 do_layer_buttons(7); break;
1634 do_layer_buttons(8); break;
1636 do_layer_buttons(9); break;
1638 do_layer_buttons(10); break;
1640 do_layer_buttons(11); break;
1641 case ACCENTGRAVEKEY:
1642 do_layer_buttons(-1); break;
1645 if (G.vd->ndofmode == 0) {
1647 } else if (G.vd->ndofmode == 1) {
1657 if (G.vd->ndofmode > 2) /* we have currently 3 modes : 0 original, 1 fly, 2 transform */
1661 G.vd->ndoffilter =(G.vd->ndoffilter == 1 ? 0 : 1);
1663 allqueue(REDRAWHEADERS, 0);
1668 /* Redraw buttons window as well as view 3d (for floating panel) */
1670 allqueue(REDRAWVIEW3D, 0);
1671 allqueue(REDRAWBUTSEDIT, 0);
1675 if (U.flag & USER_NONUMPAD) {
1676 event= convert_for_nonumpad(event);
1681 /* Afterqueue events */
1686 BIF_view3d_previewrender(sa);
1690 /* Shift-Tabe handling (other cases are in toets) */
1691 if (G.qual == LR_SHIFTKEY)
1693 /* Snap toggle only when supported */
1694 if (BIF_snappingSupported())
1696 G.scene->snap_flag ^= SCE_SNAP;
1697 allqueue(REDRAWHEADERS, 0);
1702 /* LEFTMOUSE and RIGHTMOUSE event codes can be swapped above,
1703 * based on user preference USER_LMOUSESELECT
1706 if ((G.obedit) || !(G.f&(G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT|G_PARTICLEEDIT))) {
1709 else if (G.f & G_WEIGHTPAINT) {
1712 else if (G.f & G_VERTEXPAINT) {
1715 else if (G.f & G_TEXTUREPAINT) {
1716 imagepaint_paint(L_MOUSE, 1);
1718 else if (G.f & G_PARTICLEEDIT) {
1719 if(G.qual & LR_CTRLKEY)
1721 else if(!PE_brush_particles())
1726 handle_view_middlemouse();
1729 if((G.obedit) && (G.qual & LR_CTRLKEY)==0) {
1730 if(G.obedit->type==OB_MESH)
1732 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
1734 else if(G.obedit->type==OB_MBALL)
1736 else if(G.obedit->type==OB_LATTICE)
1738 else if(G.obedit->type==OB_ARMATURE)
1741 else if((G.obedit && G.obedit->type==OB_MESH) && (G.qual == (LR_CTRLKEY|LR_ALTKEY)))
1742 mouse_mesh(); /* loop select for 1 mousebutton dudes */
1743 else if((G.obedit && G.obedit->type==OB_MESH) && (G.qual == (LR_CTRLKEY|LR_ALTKEY|LR_SHIFTKEY)))
1744 mouse_mesh(); /* loop select for 1 mousebutton dudes */
1745 else if(G.qual==LR_CTRLKEY)
1746 mouse_select(); /* also allow in editmode, for vertex parenting */
1747 else if(FACESEL_PAINT_TEST)
1749 else if( G.f & (G_VERTEXPAINT|G_TEXTUREPAINT))
1751 else if( G.f & G_PARTICLEEDIT)
1752 PE_mouse_particles();
1754 mouse_select(); /* does poses too */
1757 handle_view_wheelup();
1760 case WHEELDOWNMOUSE:
1761 handle_view_wheeldown();
1766 if (G.vd->ndofmode == 0) {
1768 } else if (G.vd->ndofmode == 1) {
1778 if (G.vd->ndofmode > 2) /* we have currently 3 modes : 0 original, 1 fly, 2 transform */
1782 G.vd->ndoffilter =(G.vd->ndoffilter == 1 ? 0 : 1);
1784 allqueue(REDRAWHEADERS, 0);
1788 if(G.qual==LR_CTRLKEY) {
1791 else do_layer_buttons(0);
1795 if(G.qual==LR_CTRLKEY) {
1798 else do_layer_buttons(1);
1802 if(G.qual==LR_CTRLKEY) {
1805 else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
1806 if ( (G.obedit) && (G.obedit->type==OB_MESH) )
1807 select_faces_by_numverts(3);
1809 else do_layer_buttons(2);
1813 if(G.qual==LR_CTRLKEY) {
1816 else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
1817 if ( (G.obedit) && (G.obedit->type==OB_MESH) )
1818 select_faces_by_numverts(4);
1820 else do_layer_buttons(3);
1824 if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
1825 if ( (G.obedit) && (G.obedit->type==OB_MESH) )
1826 select_faces_by_numverts(5);
1829 else if(G.qual==LR_CTRLKEY) {}
1830 else do_layer_buttons(4);
1834 if(G.qual==LR_CTRLKEY) {}
1835 else do_layer_buttons(5);
1838 if(G.qual==LR_CTRLKEY) {}
1839 else do_layer_buttons(6);
1842 if(G.qual==LR_CTRLKEY) {}
1843 else do_layer_buttons(7);
1846 if(G.qual==LR_CTRLKEY) {}
1847 else do_layer_buttons(8);
1850 if(G.qual==LR_CTRLKEY) {}
1851 else do_layer_buttons(9);
1854 if(G.qual==LR_CTRLKEY) {}
1855 else do_layer_buttons(10);
1858 if(G.qual==LR_CTRLKEY) {}
1859 else do_layer_buttons(11);
1861 case ACCENTGRAVEKEY:
1862 do_layer_buttons(-1);
1866 if(G.qual == LR_CTRLKEY) {
1867 val= pupmenu("Manipulator%t|Enable/Disable|Translate|Rotate|Scale|Combo");
1869 if(val==1) v3d->twflag ^= V3D_USE_MANIPULATOR;
1871 if(val==2) v3d->twtype= V3D_MANIP_TRANSLATE;
1872 else if(val==3) v3d->twtype= V3D_MANIP_ROTATE;
1873 else if(val==4) v3d->twtype= V3D_MANIP_SCALE;
1874 else if(val==5) v3d->twtype= V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE|V3D_MANIP_SCALE;
1875 v3d->twflag |= V3D_USE_MANIPULATOR;
1880 else if(G.qual == LR_ALTKEY) {
1881 BIF_selectOrientation();
1888 if(G.qual == (LR_CTRLKEY|LR_ALTKEY)) {
1891 else if(G.obedit->type==OB_ARMATURE)
1892 align_selected_bones();
1894 else if(G.qual & LR_CTRLKEY) { /* also with shift! */
1897 else if((G.qual==LR_SHIFTKEY)) {
1902 if(G.obedit->type==OB_MESH)
1904 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
1906 else if(G.obedit->type==OB_MBALL)
1907 deselectall_mball();
1908 else if(G.obedit->type==OB_LATTICE)
1910 else if(G.obedit->type==OB_ARMATURE)
1911 deselectall_armature(1, 1); /* 1 == toggle */
1913 else if (ob && (ob->flag & OB_POSEMODE)){
1914 deselectall_posearmature(ob, 1, 1);
1917 if(FACESEL_PAINT_TEST) deselectall_tface();
1918 else if(G.f & G_PARTICLEEDIT) PE_deselectall();
1920 /* by design, the center of the active object
1921 * (which need not necessarily by selected) will
1922 * still be drawn as if it were selected.
1930 if(G.qual==LR_ALTKEY)
1931 view3d_edit_clipping(v3d);
1932 else if(G.qual==LR_SHIFTKEY)
1934 if(G.vd->persp==V3D_CAMOB)
1935 set_render_border();
1937 view3d_border_zoom();
1939 else if(G.qual==LR_CTRLKEY) {
1940 extern void pointcache_bake(PTCacheID *pid, int startframe);
1941 extern void pointcache_free(PTCacheID *pid, int cacheonly);
1942 extern void fluidsimBake(Object *ob);
1943 extern void fluidsimFreeBake(Object *ob);
1946 pupval= pupmenu("Physics Baking%t|Bake selected %x1|Free bake selected %x2|Free cache selected %x3");
1950 pointcache_bake(NULL, 0);
1951 /* also bake first domain of selected objects... */
1954 else if(pupval == 2) {
1955 pointcache_free(NULL, 0);
1956 fluidsimFreeBake(NULL);
1958 else if(pupval == 3)
1959 pointcache_free(NULL, 1);
1962 else if(G.qual== (LR_ALTKEY|LR_CTRLKEY))
1963 objects_bake_render_menu();
1968 if(G.qual==LR_CTRLKEY) {
1969 if(ob && (ob->flag & OB_POSEMODE))
1970 pose_copy_menu(); /* poseobject.c */
1974 else if(G.qual==(LR_ALTKEY|LR_SHIFTKEY))
1975 gpencil_convert_menu(); /* gpencil.c */
1976 else if(G.qual==LR_ALTKEY) {
1977 if(ob && (ob->flag & OB_POSEMODE))
1978 pose_clear_constraints(); /* poseobject.c */
1980 convertmenu(); /* editobject.c */
1982 else if(G.qual==(LR_ALTKEY|LR_CTRLKEY))
1983 add_constraint(0); /* editconstraint.c, generic for objects and posemode */
1984 else if(G.qual==(LR_CTRLKEY|LR_SHIFTKEY)) {
1985 BIF_manageTransformOrientation(0, 1);
1986 allqueue(REDRAWVIEW3D, 0);
1988 else if((G.qual==LR_SHIFTKEY)) {
1990 curs= give_cursor();
1991 curs[0]=curs[1]=curs[2]= 0.0;
1992 allqueue(REDRAWVIEW3D, 0);
1994 else if((G.obedit) && ELEM(G.obedit->type, OB_CURVE, OB_SURF) ) {
1996 DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
1997 allqueue(REDRAWVIEW3D, 0);
1999 else if((G.qual==0)){
2000 if (G.vd->persp==V3D_CAMOB)
2001 /* center the camera offset */
2002 G.vd->camdx= G.vd->camdy= 0.0;
2004 /*non camera center*/
2006 curs= give_cursor();
2007 new_ofs[0]= -curs[0];
2008 new_ofs[1]= -curs[1];
2009 new_ofs[2]= -curs[2];
2010 smooth_view(G.vd, new_ofs, NULL, NULL, NULL);
2012 scrarea_queue_winredraw(curarea);
2016 if((G.qual==LR_SHIFTKEY)) {
2017 duplicate_context_selected();
2019 else if(G.qual==LR_ALTKEY) {
2020 if(ob && (ob->flag & OB_POSEMODE))
2021 error ("Duplicate not possible in posemode.");
2022 else if((G.obedit==NULL))
2025 else if(G.qual==LR_CTRLKEY) {
2026 imagestodisplist(); // removed
2028 else if((G.qual==0)){
2029 pupval= pupmenu("Draw mode%t|BoundBox %x1|Wire %x2|OpenGL Solid %x3|Shaded Solid %x4|Textured Solid %x5");
2031 G.vd->drawtype= pupval;
2040 if(G.obedit->type==OB_MESH)
2042 else if(G.obedit->type==OB_CURVE)
2044 else if(G.obedit->type==OB_SURF)
2046 else if(G.obedit->type==OB_ARMATURE)
2047 extrude_armature(0);
2050 else if (G.qual==LR_CTRLKEY) {
2051 if(G.obedit && G.obedit->type==OB_MESH)
2053 else if (FACESEL_PAINT_TEST)
2054 seam_mark_clear_tface(0);
2056 else if (G.qual==LR_SHIFTKEY) {
2057 if (G.obedit && G.obedit->type==OB_MESH &&
2058 !multires_level1_test()) {
2059 initTransform(TFM_CREASE, CTX_EDGE);
2062 else if (G.obedit && G.obedit->type==OB_ARMATURE) {
2063 extrude_armature(1);
2066 else if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY)) {
2067 if (G.obedit && G.obedit->type==OB_MESH &&
2068 !multires_level1_test()) {
2069 if (G.scene->selectmode & SCE_SELECT_VERTEX) {
2070 initTransform(TFM_BWEIGHT, CTX_NONE);
2073 initTransform(TFM_BWEIGHT, CTX_EDGE);
2081 if(G.obedit->type==OB_MESH) {
2082 if(G.qual == LR_CTRLKEY)
2084 else if((G.qual==LR_SHIFTKEY))
2086 else if(G.qual==LR_ALTKEY)
2088 else if(G.qual==(LR_CTRLKEY|LR_SHIFTKEY))
2093 (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
2094 select_linked_flat_faces();
2098 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
2101 else if(G.obedit->type == OB_ARMATURE) {
2102 fill_bones_armature();
2105 else if(G.qual==LR_CTRLKEY)
2107 else if((G.qual==LR_SHIFTKEY)) {
2108 if(ob && (ob->flag & OB_POSEMODE))
2109 pose_activate_flipped_bone();
2110 else if(G.f & G_WEIGHTPAINT)
2111 pose_activate_flipped_bone();
2112 else if(G.f & G_PARTICLEEDIT)
2113 PE_radialcontrol_start(RADIALCONTROL_STRENGTH);
2117 else if((G.qual==LR_ALTKEY)) {
2118 if(ob && (ob->flag & OB_POSEMODE))
2119 if(okee("Flip quaternion rotations"))
2123 if (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT)){
2124 G.f ^= G_FACESELECT;
2125 allqueue(REDRAWVIEW3D, 1);
2126 allqueue(REDRAWBUTSEDIT, 1);
2128 else if(G.f & G_PARTICLEEDIT) {
2129 PE_radialcontrol_start(RADIALCONTROL_SIZE);
2131 pupmenu("Note%t|UV/Face Select was removed. Editmode now allows UV editing, Add a UV layer or Unwrap (UKey)");
2137 if((G.qual == LR_CTRLKEY)) {
2139 if(ELEM(G.obedit->type, OB_MESH, OB_LATTICE))
2140 vgroup_assign_with_menu();
2142 else if(ob && (ob->flag & OB_POSEMODE))
2143 pgroup_operation_with_menu();
2145 group_operation_with_menu();
2147 else if((G.qual == (LR_CTRLKEY|LR_SHIFTKEY))) {
2149 if(ELEM(G.obedit->type, OB_MESH, OB_LATTICE))
2150 vgroup_operation_with_menu();
2153 else if((G.qual==LR_SHIFTKEY)) {
2155 if(G.obedit->type==OB_MESH)
2156 select_mesh_group_menu();
2158 else if(ob && (ob->flag & OB_POSEMODE))
2159 pose_select_grouped_menu();
2161 select_object_grouped_menu();
2163 else if((G.obedit==0) && G.qual==LR_ALTKEY) {
2164 if(okee("Clear location")) {
2168 else if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
2169 v3d->twtype= V3D_MANIP_TRANSLATE;
2172 else if((G.qual==0)) {
2173 initTransform(TFM_TRANSLATION, CTX_NONE);
2179 if(G.obedit->type==OB_MESH) {
2180 if(G.qual==LR_CTRLKEY)
2182 else if(G.qual==LR_ALTKEY)
2184 else if((G.qual==LR_SHIFTKEY))
2186 else if((G.qual==0))
2189 else if(G.obedit->type== OB_SURF) {
2190 if(G.qual==LR_CTRLKEY)
2192 else if(G.qual==LR_ALTKEY)
2194 else if((G.qual==LR_SHIFTKEY))
2196 else if((G.qual==0))
2199 else if(G.obedit->type==OB_CURVE) {
2200 if(G.qual==LR_CTRLKEY)
2202 else if(G.qual==LR_ALTKEY)
2204 /* should be G.qual==LR_SHIFTKEY, but that is taken fro handles already */
2205 else if((G.qual==(LR_ALTKEY|LR_SHIFTKEY)))
2207 /* should be G.qual==0, but that is taken for handles already */
2208 else if((G.qual==(LR_ALTKEY|LR_CTRLKEY)))
2211 if(G.qual==LR_CTRLKEY) /* conflict */
2212 autocalchandlesNurb_all(1); /* flag=1, selected */
2213 else if((G.qual==LR_SHIFTKEY))
2215 else if((G.qual==0))
2218 DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
2219 BIF_undo_push("Handle change");
2220 allqueue(REDRAWVIEW3D, 0);
2223 else if(G.obedit->type==OB_LATTICE) {
2224 if(G.qual==LR_CTRLKEY) add_hook_menu();
2226 else if(G.obedit->type==OB_MBALL) {
2227 if(G.qual==LR_ALTKEY)
2229 else if((G.qual==LR_SHIFTKEY))
2231 else if((G.qual==0))
2234 else if(G.obedit->type==OB_ARMATURE) {
2236 hide_selected_armature_bones();
2237 else if (G.qual==LR_SHIFTKEY)
2238 hide_unselected_armature_bones();
2239 else if (G.qual==LR_ALTKEY)
2240 show_all_armature_bones();
2243 else if(FACESEL_PAINT_TEST)
2245 else if(G.f & G_PARTICLEEDIT) {
2246 if(G.qual == LR_ALTKEY)
2248 else if(G.qual == LR_SHIFTKEY)
2250 else if(G.qual == 0)
2253 else if(ob && (ob->flag & OB_POSEMODE)) {
2255 hide_selected_pose_bones();
2256 else if (G.qual==LR_SHIFTKEY)
2257 hide_unselected_pose_bones();
2258 else if (G.qual==LR_ALTKEY)
2259 show_all_pose_bones();
2261 /* Object mode only, other modes are accounted for above */
2262 else if ((G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
2263 if(G.qual==LR_CTRLKEY)hookmenu();
2264 else if(G.qual==LR_ALTKEY) show_objects();
2265 else if(G.qual==LR_SHIFTKEY) hide_objects(0);
2266 else hide_objects(1);
2270 if(G.qual==LR_CTRLKEY) {
2271 if((ob) && (ob->flag & OB_POSEMODE) && (ob->type==OB_ARMATURE))
2272 deselectall_posearmature(ob, 3, 1);
2273 else if(ob && G.obedit) {
2274 if(G.obedit->type == OB_ARMATURE)
2275 deselectall_armature(3, 1);
2282 else if(G.qual==(LR_CTRLKEY|LR_ALTKEY)) {
2283 if(ob && (ob->flag & OB_POSEMODE) && ob->type==OB_ARMATURE)
2286 else if(G.qual==LR_SHIFTKEY) {
2287 if(ob && (ob->flag & OB_POSEMODE) && ob->type==OB_ARMATURE)
2293 if(G.qual==LR_CTRLKEY) {
2297 else if ((G.obedit) && ELEM(G.obedit->type, OB_CURVE, OB_SURF)) {
2300 error("Can't join unless there is an active object");
2305 if(G.obedit->type==OB_MESH) {
2313 if (G.obedit->type==OB_MESH) {
2314 if (G.qual==LR_SHIFTKEY)
2315 KnifeSubdivide(KNIFE_PROMPT);
2319 else if(G.obedit->type==OB_SURF)
2323 if((G.qual==LR_SHIFTKEY)) {
2324 if(FACESEL_PAINT_TEST)
2325 if (G.f & G_WEIGHTPAINT)
2326 clear_wpaint_selectedfaces();
2328 clear_vpaint_selectedfaces();
2329 else if(G.f & G_VERTEXPAINT)
2332 select_select_keys();
2341 if(G.obedit->type==OB_MESH) {
2342 if (G.qual & LR_CTRLKEY) {
2343 if ((G.scene->selectmode & SCE_SELECT_FACE) == 0) {
2344 selectconnected_mesh_all(); /* normal select linked */
2346 selectconnected_delimit_mesh_all(); /* select linked with edge crease delimiting */
2349 if ((G.scene->selectmode & SCE_SELECT_FACE) == 0) {
2350 selectconnected_mesh();
2352 selectconnected_delimit_mesh();
2356 if(G.obedit->type==OB_ARMATURE)
2357 selectconnected_armature();
2358 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
2359 selectconnected_nurb();
2361 else if(ob && (ob->flag & OB_POSEMODE)) {
2362 if (G.qual == LR_CTRLKEY)
2363 poselib_preview_poses(ob, 0);
2364 else if (G.qual == LR_SHIFTKEY)
2365 poselib_add_current_pose(ob, 0);
2366 else if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY))
2367 poselib_rename_pose(ob);
2368 else if (G.qual == LR_ALTKEY)
2369 poselib_remove_pose(ob, NULL);
2371 selectconnected_posearmature();
2374 if(FACESEL_PAINT_TEST) {
2376 select_linked_tfaces(0);
2377 else if((G.qual==LR_SHIFTKEY))
2378 select_linked_tfaces(1);
2379 else if(G.qual==LR_CTRLKEY)
2380 select_linked_tfaces(2);
2382 else if(G.f & G_PARTICLEEDIT) {
2389 else if((G.qual==LR_SHIFTKEY))
2391 else if(G.qual==LR_CTRLKEY)
2398 if (ELEM(G.qual, 0, LR_SHIFTKEY) && (G.obedit->type==OB_ARMATURE)) {
2401 else if (G.qual==LR_ALTKEY) {
2402 if (G.obedit->type == OB_MESH) {
2404 DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
2406 else if (G.obedit->type == OB_ARMATURE) {
2410 else if ((G.qual==0) || (G.qual==LR_CTRLKEY)) {
2413 else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
2414 if(G.obedit->type==OB_MESH) select_non_manifold();
2417 else if(G.qual & LR_CTRLKEY) {
2420 else if(G.qual==0 || G.qual==LR_SHIFTKEY) {
2421 if(ob && (ob->flag & OB_POSEMODE))
2429 toggle_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
2430 allqueue(REDRAWVIEW3D, 0);
2433 switch (G.obedit->type){
2435 if(G.qual==LR_CTRLKEY) {
2436 pupval= pupmenu("Recalculate Bone Roll Angles%t|Clear Roll (Z-Axis Up) %x1|Align Z-Axis to 3D-Cursor %x2");
2438 auto_align_armature(pupval - 1);
2439 allqueue(REDRAWVIEW3D, 0);
2444 if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
2445 if(okee("Recalculate normals inside")) {
2447 allqueue(REDRAWVIEW3D, 0);
2448 BIF_undo_push("Recalculate normals inside");
2451 else if(G.qual==LR_CTRLKEY){
2452 if(okee("Recalculate normals outside")) {
2454 allqueue(REDRAWVIEW3D, 0);
2455 BIF_undo_push("Recalculate normals outside");
2464 if (G.obedit || G.f&G_PARTICLEEDIT) {
2465 if (G.qual==LR_SHIFTKEY) {
2466 G.scene->prop_mode = (G.scene->prop_mode+1)%7;
2467 allqueue(REDRAWHEADERS, 0);
2469 else if((G.qual==LR_ALTKEY)) {
2470 if(G.scene->proportional==2) G.scene->proportional= 1;
2471 else G.scene->proportional= 2;
2472 allqueue(REDRAWHEADERS, 0);
2474 else if((G.qual==0)) {
2475 G.scene->proportional= !G.scene->proportional;
2476 allqueue(REDRAWHEADERS, 0);
2479 else if((G.qual==LR_SHIFTKEY || G.qual==(LR_ALTKEY|LR_SHIFTKEY))) {
2480 flip_subdivison(-1);
2482 else if(G.qual==LR_ALTKEY) {
2483 if(okee("Clear origin")) {
2491 if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
2492 if(G.obedit->type==OB_ARMATURE)
2498 else if(G.qual==LR_ALTKEY && G.obedit->type==OB_ARMATURE)
2499 clear_bone_parent();
2500 else if((G.qual==0) && (G.obedit->type==OB_ARMATURE))
2501 armature_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
2502 else if((G.qual==(LR_CTRLKEY|LR_ALTKEY)) && (G.obedit->type==OB_ARMATURE))
2503 separate_armature();
2504 else if((G.qual==0) && G.obedit->type==OB_MESH)
2506 else if ((G.qual==0) && ELEM(G.obedit->type, OB_CURVE, OB_SURF))
2508 else if (G.qual==LR_SHIFTKEY) {
2509 initTransform(TFM_PUSHPULL, CTX_NONE);
2513 else if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY))
2515 else if(G.qual==LR_SHIFTKEY) {
2516 toggle_blockhandler(curarea, VIEW3D_HANDLER_PREVIEW, 0);
2519 else if(G.qual==(LR_ALTKEY|LR_SHIFTKEY)) {
2520 initTransform(TFM_PUSHPULL, CTX_NONE);
2523 else if(G.qual==LR_ALTKEY)
2525 else if(G.qual==(LR_ALTKEY|LR_CTRLKEY))
2527 else if(G.qual==(LR_ALTKEY|LR_CTRLKEY|LR_SHIFTKEY)) {
2528 start_RBSimulation();
2530 else if((G.qual==0) && (OBACT) && (OBACT->type==OB_ARMATURE) && (OBACT->flag & OB_POSEMODE))
2531 pose_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
2532 else if((G.qual==0)) {
2537 if((G.obedit==0) && G.qual==LR_ALTKEY) {
2538 if(okee("Clear rotation")) {
2542 else if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
2543 v3d->twtype= V3D_MANIP_ROTATE;
2546 else if (G.obedit) {
2547 if((G.qual==LR_SHIFTKEY)) {
2548 if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
2551 else if(G.qual==LR_CTRLKEY) {
2552 if (G.obedit->type==OB_MESH) {
2554 BIF_undo_push("Cut Edgeloop");
2556 else if (G.obedit->type==OB_ARMATURE) {
2557 initTransform(TFM_BONE_ROLL, CTX_NONE);
2561 else if((G.qual==0)) {
2562 initTransform(TFM_ROTATION, CTX_NONE);
2566 else if((G.qual==0)) {
2567 initTransform(TFM_ROTATION, CTX_NONE);
2572 if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
2573 v3d->twtype= V3D_MANIP_SCALE;
2578 if(G.qual==LR_ALTKEY) {
2579 if(G.obedit->type==OB_ARMATURE) {
2580 initTransform(TFM_BONESIZE, CTX_NONE);
2582 else if (G.obedit->type==OB_CURVE) {
2583 initTransform(TFM_CURVE_SHRINKFATTEN, CTX_NONE);
2585 initTransform(TFM_SHRINKFATTEN, CTX_NONE);
2589 else if(G.qual==LR_CTRLKEY) {
2590 initTransform(TFM_SHEAR, CTX_NONE);
2593 else if(G.qual==LR_SHIFTKEY)
2595 else if(G.qual==0) {
2596 if(G.obedit->type==OB_ARMATURE) {
2597 bArmature *arm= G.obedit->data;
2598 if(arm->drawtype==ARM_ENVELOPE)
2599 initTransform(TFM_BONE_ENVELOPE, CTX_NONE);
2601 initTransform(TFM_RESIZE, CTX_NONE);
2604 initTransform(TFM_RESIZE, CTX_NONE);
2607 else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)){
2608 initTransform(TFM_TOSPHERE, CTX_NONE);
2611 if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
2612 if(G.obedit->type==OB_MESH) select_sharp_edges();
2615 else if(G.qual==LR_ALTKEY) {
2616 if(G.f & G_WEIGHTPAINT)
2618 if(ob && (ob->flag & OB_POSEMODE)) {
2619 bArmature *arm= ob->data;
2620 if( arm->drawtype==ARM_ENVELOPE) {
2621 initTransform(TFM_BONESIZE, CTX_NONE);
2627 if(okee("Clear scale")) {
2631 else if(G.qual==LR_SHIFTKEY) {
2634 else if((G.qual==0)) {
2635 initTransform(TFM_RESIZE, CTX_NONE);
2638 else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
2639 initTransform(TFM_TOSPHERE, CTX_NONE);
2642 else if(G.qual==(LR_CTRLKEY|LR_ALTKEY|LR_SHIFTKEY)) {
2643 initTransform(TFM_SHEAR, CTX_NONE);
2648 if(G.qual == LR_SHIFTKEY) { /* toggle texture in solid draw mode */
2649 G.vd->flag2 ^= V3D_SOLID_TEX;
2650 allqueue(REDRAWVIEW3D, 0);
2651 } else if(G.obedit){
2652 if((G.qual & LR_CTRLKEY) && G.obedit->type==OB_MESH) {
2653 convert_to_triface(G.qual & LR_SHIFTKEY);
2654 allqueue(REDRAWVIEW3D, 0);
2655 if (EM_texFaceCheck())
2656 allqueue(REDRAWIMAGE, 0);