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 #include "BPY_extern.h"
173 #include "butspace.h"
174 #include "mydevice.h"
177 #include "multires.h"
179 #include "BIF_transform.h"
181 #include "BKE_depsgraph.h"
183 #include "BSE_trans_types.h"
185 #include "SYS_System.h" /* for the user def menu ... should move elsewhere. */
187 #include "GPU_extensions.h"
188 #include "GPU_draw.h"
190 #include "BLO_sys_types.h" // for intptr_t support
192 /* maybe we need this defined somewhere else */
193 extern void StartKetsjiShell(ScrArea *area, char* startscenename, struct Main* maggie, struct SpaceIpo* sipo,int always_use_expand_framing);
194 extern void StartKetsjiShellSimulation(ScrArea *area, char* startscenename, struct Main* maggie, struct SpaceIpo* sipo,int always_use_expand_framing);/*rcruiz*/
197 * When the mipmap setting changes, we want to redraw the view right
198 * away to reflect this setting.
200 //static void space_mipmap_button_function(int event);
202 static void free_soundspace(SpaceSound *ssound);
204 /* *************************************** */
206 /* don't know yet how the handlers will evolve, for simplicity
207 i choose for an array with eventcodes, this saves in a file!
209 void add_blockhandler(ScrArea *sa, short eventcode, short val)
211 SpaceLink *sl= sa->spacedata.first;
214 /* find empty spot */
215 for(a=0; a<SPACE_MAXHANDLER; a+=2) {
216 if( sl->blockhandler[a]==eventcode ) {
217 sl->blockhandler[a+1]= val;
220 else if( sl->blockhandler[a]==0) {
221 sl->blockhandler[a]= eventcode;
222 sl->blockhandler[a+1]= val;
226 if(a==SPACE_MAXHANDLER) {
227 error("Only %i floating panels allowed", SPACE_MAXHANDLER/2);
232 void rem_blockhandler(ScrArea *sa, short eventcode)
234 SpaceLink *sl= sa->spacedata.first;
237 for(a=0; a<SPACE_MAXHANDLER; a+=2) {
238 if( sl->blockhandler[a]==eventcode) {
239 sl->blockhandler[a]= 0;
241 /* specific free calls */
242 if(eventcode==IMAGE_HANDLER_PREVIEW)
243 image_preview_event(0);
249 void toggle_blockhandler(ScrArea *sa, short eventcode, short val)
251 SpaceLink *sl= sa->spacedata.first;
254 /* find if it exists */
255 for(a=0; a<SPACE_MAXHANDLER; a+=2) {
256 if( sl->blockhandler[a]==eventcode ) {
257 sl->blockhandler[a]= 0;
259 /* specific free calls */
260 if(eventcode==VIEW3D_HANDLER_PREVIEW)
261 BIF_view3d_previewrender_free(sa->spacedata.first);
262 else if(eventcode==IMAGE_HANDLER_PREVIEW)
263 image_preview_event(0);
269 add_blockhandler(sa, eventcode, val);
271 /* specific add new calls */
272 if(eventcode==IMAGE_HANDLER_PREVIEW)
273 image_preview_event(1);
279 /* ************* SPACE: VIEW3D ************* */
281 /* extern void drawview3dspace(ScrArea *sa, void *spacedata); BSE_drawview.h */
284 void copy_view3d_lock(short val)
289 /* from G.scene copy to the other views */
290 sc= G.main->screen.first;
293 if(sc->scene==G.scene) {
294 ScrArea *sa= sc->areabase.first;
296 SpaceLink *sl= sa->spacedata.first;
298 if(sl->spacetype==SPACE_OOPS && val==REDRAW) {
299 if(sa->win) scrarea_queue_winredraw(sa);
301 else if(sl->spacetype==SPACE_VIEW3D) {
302 View3D *vd= (View3D*) sl;
303 if(vd->scenelock && vd->localview==0) {
304 vd->lay= G.scene->lay;
305 vd->camera= G.scene->camera;
307 if(vd->camera==0 && vd->persp==V3D_CAMOB) vd->persp= V3D_PERSP;
309 if( (vd->lay & vd->layact) == 0) {
312 if(vd->lay & (1<<bit)) {
320 if(val==REDRAW && vd==sa->spacedata.first) {
321 if(sa->win) scrarea_queue_redraw(sa);
334 void handle_view3d_around()
338 if ((U.uiflag & USER_LOCKAROUND)==0) return;
340 /* copies from G.vd->around to other view3ds */
342 sc= G.main->screen.first;
345 if(sc->scene==G.scene) {
346 ScrArea *sa= sc->areabase.first;
348 SpaceLink *sl= sa->spacedata.first;
350 if(sl->spacetype==SPACE_VIEW3D) {
351 View3D *vd= (View3D*) sl;
353 vd->around= G.vd->around;
354 if (G.vd->flag & V3D_ALIGN)
355 vd->flag |= V3D_ALIGN;
357 vd->flag &= ~V3D_ALIGN;
358 scrarea_queue_headredraw(sa);
370 void handle_view3d_lock()
372 if (G.vd != NULL && curarea != NULL ) {
373 if(G.vd->localview==0 && G.vd->scenelock && curarea->spacetype==SPACE_VIEW3D) {
376 G.scene->lay= G.vd->lay;
377 G.scene->camera= G.vd->camera;
379 copy_view3d_lock(REDRAW);
384 void space_set_commmandline_options(void) {
385 SYS_SystemHandle syshandle;
388 if ( (syshandle = SYS_GetSystem()) ) {
389 /* User defined settings */
390 a= (U.gameflags & USER_DISABLE_SOUND);
391 /* if user already disabled audio at the command-line, don't re-enable it */
394 SYS_WriteCommandLineInt(syshandle, "noaudio", a);
397 a= (U.gameflags & USER_DISABLE_MIPMAP);
399 SYS_WriteCommandLineInt(syshandle, "nomipmap", a);
401 /* File specific settings: */
402 /* Only test the first one. These two are switched
404 a= (G.fileflags & G_FILE_SHOW_FRAMERATE);
405 SYS_WriteCommandLineInt(syshandle, "show_framerate", a);
406 SYS_WriteCommandLineInt(syshandle, "show_profile", a);
408 /* When in wireframe mode, always draw debug props. */
410 a = ( (G.fileflags & G_FILE_SHOW_DEBUG_PROPS)
411 || (G.vd->drawtype == OB_WIRE)
412 || (G.vd->drawtype == OB_SOLID) );
413 SYS_WriteCommandLineInt(syshandle, "show_properties", a);
416 a= (G.fileflags & G_FILE_SHOW_PHYSICS);
417 SYS_WriteCommandLineInt(syshandle, "show_physics", a);
419 a= (G.fileflags & G_FILE_ENABLE_ALL_FRAMES);
420 SYS_WriteCommandLineInt(syshandle, "fixedtime", a);
422 a= (G.fileflags & G_FILE_GAME_TO_IPO);
423 SYS_WriteCommandLineInt(syshandle, "game2ipo", a);
425 a=(G.fileflags & G_FILE_GAME_MAT);
426 SYS_WriteCommandLineInt(syshandle, "blender_material", a);
427 a=(G.fileflags & G_FILE_GAME_MAT_GLSL);
428 SYS_WriteCommandLineInt(syshandle, "blender_glsl_material", a);
429 a=(G.fileflags & G_FILE_DISPLAY_LISTS);
430 SYS_WriteCommandLineInt(syshandle, "displaylists", a);
438 * These two routines imported from the gameengine,
439 * I suspect a lot of the resetting stuff is cruft
440 * and can be removed, but it should be checked.
442 static void SaveState(void)
444 glPushAttrib(GL_ALL_ATTRIB_BITS);
448 if(G.f & G_TEXTUREPAINT)
449 GPU_paint_set_mipmap(1);
454 static void RestoreState(void)
456 if(G.f & G_TEXTUREPAINT)
457 GPU_paint_set_mipmap(0);
459 curarea->win_swap = 0;
460 curarea->head_swap=0;
461 allqueue(REDRAWVIEW3D, 1);
462 allqueue(REDRAWBUTSALL, 0);
469 static LinkNode *save_and_reset_all_scene_cfra(void)
471 LinkNode *storelist= NULL;
474 for (sc= G.main->scene.first; sc; sc= sc->id.next) {
475 BLI_linklist_prepend(&storelist, (void*) (intptr_t) sc->r.cfra);
477 /* why is this reset to 1 ?*/
483 BLI_linklist_reverse(&storelist);
488 static void restore_all_scene_cfra(LinkNode *storelist) {
489 LinkNode *sc_store= storelist;
492 for (sc= G.main->scene.first; sc; sc= sc->id.next) {
493 int stored_cfra= (intptr_t) sc_store->link;
495 sc->r.cfra= stored_cfra;
498 sc_store= sc_store->next;
501 BLI_linklist_free(storelist, NULL);
505 void start_game(void)
509 Scene *sc, *startscene = G.scene;
510 LinkNode *scene_cfra_store;
512 /* XXX, silly code - the game engine can
513 * access any scene through logic, so we try
514 * to make sure each scene has a valid camera,
515 * just in case the game engine tries to use it.
517 * Better would be to make a better routine
518 * in the game engine for finding the camera.
520 * Note: yes, this is all very badly hacked! (ton)
522 for (sc= G.main->scene.first; sc; sc= sc->id.next) {
526 for (base= sc->base.first; base; base= base->next)
527 if (base->object->type==OB_CAMERA)
530 sc->camera= base?base->object:NULL;
534 /* these two lines make sure front and backbuffer are equal. for swapbuffers */
536 screen_swapbuffers();
538 /* can start from header */
539 mywinset(curarea->win);
541 scene_cfra_store= save_and_reset_all_scene_cfra();
544 /* game engine will do its own sounds. */
545 sound_stop_all_sounds();
548 /* Before jumping into Ketsji, we configure some settings. */
549 space_set_commmandline_options();
552 StartKetsjiShell(curarea, startscene->id.name+2, G.main,G.sipo, 1);
555 /* Restart BPY - unload the game engine modules. */
557 /* Commented out: testing before Blender 2.46 if it's ok to keep
558 * these modules around, they give access to relevant info for
559 * exporters to other engines...
561 BPY_start_python(0, NULL);
562 BPY_post_start_python();
565 restore_all_scene_cfra(scene_cfra_store);
566 set_scene_bg(startscene);
567 scene_update_for_newframe(G.scene, G.scene->lay);
569 if (G.flags & G_FILE_AUTOPLAY)
572 /* groups could have changed ipo */
573 allqueue(REDRAWNLA, 0);
574 allqueue(REDRAWACTION, 0);
575 allspace(REMAKEIPO, 0);
576 allqueue(REDRAWIPO, 0);
579 notice("Game engine is disabled in this release!");
583 void start_RBSimulation(void)
587 Scene *sc, *startscene = G.scene;
588 LinkNode *scene_cfra_store;
590 /* XXX, silly code - the game engine can
591 * access any scene through logic, so we try
592 * to make sure each scene has a valid camera,
593 * just in case the game engine tries to use it.
595 * Better would be to make a better routine
596 * in the game engine for finding the camera.
598 * Note: yes, this is all very badly hacked! (ton)
600 for (sc= G.main->scene.first; sc; sc= sc->id.next) {
604 for (base= sc->base.first; base; base= base->next)
605 if (base->object->type==OB_CAMERA)
608 sc->camera= base?base->object:NULL;
612 /* these two lines make sure front and backbuffer are equal. for swapbuffers */
614 screen_swapbuffers();
616 /* can start from header */
617 mywinset(curarea->win);
619 scene_cfra_store= save_and_reset_all_scene_cfra();
622 /* game engine will do its own sounds. */
623 sound_stop_all_sounds();
626 /* Before jumping into Ketsji, we configure some settings. */
627 space_set_commmandline_options();
630 StartKetsjiShellSimulation(curarea, startscene->id.name+2, G.main,G.sipo, 1);
633 /* Restart BPY - unload the game engine modules. */
635 /* Commented out: testing before Blender 2.46 if it's ok to keep
636 * these modules around, they give access to relevant info for
637 * exporters to other engines...
639 BPY_start_python(0, NULL);
640 BPY_post_start_python();
643 restore_all_scene_cfra(scene_cfra_store);
644 set_scene_bg(startscene);
645 scene_update_for_newframe(G.scene, G.scene->lay);
647 if (G.flags & G_FILE_AUTOPLAY)
650 /* groups could have changed ipo */
651 allqueue(REDRAWNLA, 0);
652 allqueue(REDRAWACTION, 0);
653 allspace(REMAKEIPO, 0);
654 allqueue(REDRAWIPO, 0);
657 notice("YOU NEED GAME ENGIEN TO RUN THE SIMULATION!");
661 static void changeview3dspace(ScrArea *sa, void *spacedata)
663 setwinmatrixview3d(sa->winx, sa->winy, NULL); /* 0= no pick rect */
666 /* Callable from editmode and faceselect mode from the
667 * moment, would be nice (and is easy) to generalize
670 static void align_view_to_selected(View3D *v3d)
672 int nr= pupmenu("Align View (Ctrl flips)%t|To Selected (top)%x3|To Selected (front)%x2|To Selected (side)%x1");
676 /* opposite axis in case ctrl is pressed */
677 if(G.qual==LR_CTRLKEY) axis= -axis;
679 if ((G.obedit) && (G.obedit->type == OB_MESH)) {
680 editmesh_align_view_to_selected(v3d, axis);
681 addqueue(v3d->area->win, REDRAW, 1);
682 } else if (FACESEL_PAINT_TEST) {
683 Object *obact= OBACT;
684 if (obact && obact->type==OB_MESH) {
685 Mesh *me= obact->data;
686 faceselect_align_view_to_selected(v3d, me, axis);
687 addqueue(v3d->area->win, REDRAW, 1);
694 static short select_children(Object *ob, int recursive)
699 for (base= FIRSTBASE; base; base= base->next) {
700 if (ob == base->object->parent) {
701 if (BASE_SELECTABLE(base) && !(base->flag & SELECT)) {
702 base->flag |= SELECT;
703 base->object->flag |= SELECT;
708 changed |= select_children(base->object, 1);
714 static short select_parent(void) /* Makes parent active and de-selected OBACT */
717 Base *base, *startbase, *basact=NULL, *oldbasact;
719 if (!(OBACT->parent)) return 0; /* we know OBACT is valid */
720 BASACT->flag &= (~SELECT);
721 BASACT->object->flag &= (~SELECT);
722 startbase= FIRSTBASE;
723 if(BASACT && BASACT->next) startbase= BASACT->next;
726 if(base->object==BASACT->object->parent) { basact=base; break; }
728 if(base==NULL) base= FIRSTBASE;
729 if(base==startbase) break;
731 /* can be NULL if parent in other scene */
732 if(basact && BASE_SELECTABLE(basact)) {
735 basact->flag |= SELECT;
737 basact->object->flag= basact->flag;
739 set_active_base(basact);
746 #define GROUP_MENU_MAX 24
747 static short select_same_group(Object *ob) /* Select objects in the same group as the active */
751 Group *group, *ob_groups[GROUP_MENU_MAX];
752 char str[10 + (24*GROUP_MENU_MAX)];
754 int group_count=0, menu, i;
756 for ( group=G.main->group.first;
757 group && group_count < GROUP_MENU_MAX;
760 if (object_in_group (ob, group)) {
761 ob_groups[group_count] = group;
769 else if (group_count == 1) {
770 group = ob_groups[0];
771 for (base= FIRSTBASE; base; base= base->next) {
772 if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && object_in_group(base->object, group)) {
773 base->flag |= SELECT;
774 base->object->flag |= SELECT;
781 /* build the menu. */
782 p += sprintf(str, "Groups%%t");
783 for (i=0; i<group_count; i++) {
784 group = ob_groups[i];
785 p += sprintf (p, "|%s%%x%i", group->id.name+2, i);
788 menu = pupmenu (str);
792 group = ob_groups[menu];
793 for (base= FIRSTBASE; base; base= base->next) {
794 if (!(base->flag & SELECT) && object_in_group(base->object, group)) {
795 base->flag |= SELECT;
796 base->object->flag |= SELECT;
803 static short select_object_hooks(Object *ob)
808 HookModifierData *hmd;
810 for (md = ob->modifiers.first; md; md=md->next) {
811 if (md->type==eModifierType_Hook) {
812 hmd= (HookModifierData*) md;
813 if (hmd->object && !(hmd->object->flag & SELECT)) {
814 base= object_in_scene(hmd->object, G.scene);
815 if (base && BASE_SELECTABLE(base)) {
816 base->flag |= SELECT;
817 base->object->flag |= SELECT;
826 /* Select objects woth the same parent as the active (siblings),
827 * parent can be NULL also */
828 static short select_same_parent(Object *ob)
833 for (base= FIRSTBASE; base; base= base->next) {
834 if (BASE_SELECTABLE(base) && (base->object->parent==ob->parent) && !(base->flag & SELECT)) {
835 base->flag |= SELECT;
836 base->object->flag |= SELECT;
843 static short select_same_type(Object *ob)
848 for (base= FIRSTBASE; base; base= base->next) {
849 if (BASE_SELECTABLE(base) && (base->object->type == ob->type) && !(base->flag & SELECT)) {
850 base->flag |= SELECT;
851 base->object->flag |= SELECT;
858 static short select_same_layer(Object *ob)
861 Base *base = FIRSTBASE;
864 if (BASE_SELECTABLE(base) && (base->lay & ob->lay) && !(base->flag & SELECT)) {
865 base->flag |= SELECT;
866 base->object->flag |= SELECT;
874 static short select_same_index_object(Object *ob)
877 Base *base = FIRSTBASE;
880 if (BASE_SELECTABLE(base) && (base->object->index == ob->index) && !(base->flag & SELECT)) {
881 base->flag |= SELECT;
882 base->object->flag |= SELECT;
890 static short select_same_color(Object *ob)
893 Base *base = FIRSTBASE;
896 if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && (FloatCompare(base->object->col, ob->col, 0.005f))) {
897 base->flag |= SELECT;
898 base->object->flag |= SELECT;
906 static short objects_share_gameprop(Object *a, Object *b)
909 /*make a copy of all its properties*/
911 for( prop= a->prop.first; prop; prop = prop->next ) {
912 if ( get_ob_property(b, prop->name) )
918 static short select_same_gameprops(Object *ob)
921 Base *base = FIRSTBASE;
924 if (BASE_SELECTABLE(base) && !(base->flag & SELECT) && (objects_share_gameprop(base->object, ob))) {
925 base->flag |= SELECT;
926 base->object->flag |= SELECT;
934 void select_object_grouped(short nr)
939 if (ob==NULL) return;
941 if(nr==1) changed = select_children(ob, 1);
942 else if(nr==2) changed = select_children(ob, 0);
943 else if(nr==3) changed = select_parent();
944 else if(nr==4) changed = select_same_parent(ob);
945 else if(nr==5) changed = select_same_type(ob);
946 else if(nr==6) changed = select_same_layer(ob);
947 else if(nr==7) changed = select_same_group(ob);
948 else if(nr==8) changed = select_object_hooks(ob);
949 else if(nr==9) changed = select_same_index_object(ob);
950 else if(nr==10) changed = select_same_color(ob);
951 else if(nr==11) changed = select_same_gameprops(ob);
955 allqueue(REDRAWVIEW3D, 0);
956 allqueue(REDRAWBUTSOBJECT, 0);
957 allspace(REMAKEIPO, 0);
958 allqueue(REDRAWIPO, 0);
959 BIF_undo_push("Select Grouped");
963 static void select_object_grouped_menu(void)
968 /* make menu string */
970 str= MEM_mallocN(512, "groupmenu");
971 strcpy(str, "Select Grouped%t|Children%x1|"
972 "Immediate Children%x2|Parent%x3|"
973 "Siblings (Shared Parent)%x4|"
974 "Objects of Same Type%x5|"
975 "Objects on Shared Layers%x6|"
976 "Objects in Same Group%x7|"
978 "Object PassIndex%x9|"
980 "Game Properties%x11");
987 select_object_grouped(nr);
994 error("This data does not support joining in editmode");
998 error("Can't join unless there is an active object");
1002 if(ob->type == OB_MESH) {
1003 if(okee("Join selected meshes")==0) return;
1005 } else if(ob->type == OB_CURVE) {
1006 if(okee("Join selected curves")==0) return;
1007 join_curve(OB_CURVE);
1008 } else if(ob->type == OB_SURF) {
1009 if(okee("Join selected NURBS")==0) return;
1010 join_curve(OB_SURF);
1011 } else if(ob->type == OB_ARMATURE) {
1012 /* Make sure the user wants to continue*/
1013 if(okee("Join selected armatures")==0) return;
1016 error("This object type doesn't support joining");
1020 static unsigned short convert_for_nonumpad(unsigned short event)
1022 if (event>=ZEROKEY && event<=NINEKEY) {
1023 return event - ZEROKEY + PAD0;
1024 } else if (event==MINUSKEY) {
1026 } else if (event==EQUALKEY) {
1028 } else if (event==BACKSLASHKEY) {
1035 /* *************** */
1037 void BIF_undo_push(char *str)
1040 if (U.undosteps == 0) return;
1042 if(G.obedit->type==OB_MESH)
1043 undo_push_mesh(str);
1044 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
1045 undo_push_curve(str);
1046 else if (G.obedit->type==OB_FONT)
1047 undo_push_font(str);
1048 else if (G.obedit->type==OB_MBALL)
1049 undo_push_mball(str);
1050 else if (G.obedit->type==OB_LATTICE)
1051 undo_push_lattice(str);
1052 else if (G.obedit->type==OB_ARMATURE)
1053 undo_push_armature(str);
1055 else if(G.f & G_PARTICLEEDIT) {
1056 if (U.undosteps == 0) return;
1061 if(U.uiflag & USER_GLOBALUNDO)
1062 BKE_write_undo(str);
1069 if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
1070 undo_editmode_step(1);
1073 if(G.f & G_TEXTUREPAINT)
1074 undo_imagepaint_step(1);
1075 else if(curarea->spacetype==SPACE_IMAGE && (G.sima->flag & SI_DRAWTOOL))
1076 undo_imagepaint_step(1);
1077 else if(G.f & G_PARTICLEEDIT)
1080 /* now also in faceselect mode */
1081 if(U.uiflag & USER_GLOBALUNDO) {
1082 BPY_scripts_clear_pyobjects();
1084 sound_initialize_sounds();
1093 if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
1094 undo_editmode_step(-1);
1097 if(G.f & G_TEXTUREPAINT)
1098 undo_imagepaint_step(-1);
1099 else if(curarea->spacetype==SPACE_IMAGE && (G.sima->flag & SI_DRAWTOOL))
1100 undo_imagepaint_step(-1);
1101 else if(G.f & G_PARTICLEEDIT)
1104 /* includes faceselect now */
1105 if(U.uiflag & USER_GLOBALUNDO) {
1107 sound_initialize_sounds();
1113 void BIF_undo_menu(void)
1116 if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
1117 undo_editmode_menu();
1118 allqueue(REDRAWALL, 0);
1121 if(G.f & G_PARTICLEEDIT)
1123 else if(U.uiflag & USER_GLOBALUNDO) {
1124 char *menu= BKE_undo_menu_string();
1126 short event= pupmenu_col(menu, 20);
1129 BKE_undo_number(event);
1130 sound_initialize_sounds();
1137 /* *************** */
1139 void handle_view_middlemouse() {
1140 /* use '&' here, because of alt+leftmouse which emulates middlemouse */
1141 if(U.flag & USER_VIEWMOVE) {
1142 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1144 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1146 else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
1150 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1152 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1154 else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
1159 void handle_view_wheelup()
1161 /* Regular: Zoom in */
1162 /* Shift: Scroll up */
1163 /* Ctrl: Scroll right */
1164 /* Alt-Shift: Rotate up */
1165 /* Alt-Ctrl: Rotate right */
1167 if( G.qual & LR_SHIFTKEY ) {
1168 if( G.qual & LR_ALTKEY ) {
1169 G.qual &= ~LR_SHIFTKEY;
1171 G.qual |= LR_SHIFTKEY;
1175 } else if( G.qual & LR_CTRLKEY ) {
1176 if( G.qual & LR_ALTKEY ) {
1177 G.qual &= ~LR_CTRLKEY;
1179 G.qual |= LR_CTRLKEY;
1183 } else if(U.uiflag & USER_WHEELZOOMDIR)
1184 persptoetsen(PADMINUS);
1186 persptoetsen(PADPLUSKEY);
1189 void handle_view_wheeldown()
1191 /* Regular: Zoom out */
1192 /* Shift: Scroll down */
1193 /* Ctrl: Scroll left */
1194 /* Alt-Shift: Rotate down */
1195 /* Alt-Ctrl: Rotate left */
1197 if( G.qual & LR_SHIFTKEY ) {
1198 if( G.qual & LR_ALTKEY ) {
1199 G.qual &= ~LR_SHIFTKEY;
1201 G.qual |= LR_SHIFTKEY;
1205 } else if( G.qual & LR_CTRLKEY ) {
1206 if( G.qual & LR_ALTKEY ) {
1207 G.qual &= ~LR_CTRLKEY;
1209 G.qual |= LR_CTRLKEY;
1213 } else if(U.uiflag & USER_WHEELZOOMDIR)
1214 persptoetsen(PADPLUSKEY);
1216 persptoetsen(PADMINUS);
1219 int mouse_in_header(ScrArea *sa)
1222 getmouseco_sc(mouse);
1223 return mouse[0] >= sa->headrct.xmin &&
1224 mouse[0] <= sa->headrct.xmax &&
1225 mouse[1] >= sa->headrct.ymin &&
1226 mouse[1] <= sa->headrct.ymax;
1229 static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
1231 View3D *v3d= sa->spacedata.first;
1232 Object *ob= OBACT; /* do not change! */
1234 int doredraw= 0, pupval;
1235 unsigned short event= evt->event;
1236 short val= evt->val;
1237 char ascii= evt->ascii;
1239 if(curarea->win==0) return; /* when it comes from sa->headqread() */
1243 if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
1245 if(event==UI_BUT_EVENT) do_butspace(val); /* temporal, view3d deserves own queue? */
1247 /* - we consider manipulator a button, defaulting to leftmouse
1248 * - grease-pencil also defaults to leftmouse
1250 if(event==LEFTMOUSE) {
1251 /* run any view3d event handler script links */
1252 if (sa->scriptlink.totscript) {
1253 if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT))
1254 return; /* return if event was processed (swallowed) by handler(s) */
1257 if(gpencil_do_paint(sa, L_MOUSE)) return;
1258 if(BIF_do_manipulator(sa)) return;
1260 else if(event==RIGHTMOUSE) {
1261 if(gpencil_do_paint(sa, R_MOUSE)) return;
1264 /* swap mouse buttons based on user preference */
1265 if (U.flag & USER_LMOUSESELECT) {
1266 /* only swap mouse button for selection, in modes where it is relevant.
1267 * painting/sculpting stays on LEFTMOUSE */
1268 if ( !((G.f & G_SCULPTMODE) || (G.f & G_WEIGHTPAINT) || (G.f & G_GREASEPENCIL) ||
1269 (G.f & G_VERTEXPAINT) || (G.f & G_TEXTUREPAINT) || (G.f & G_PARTICLEEDIT)) ||
1272 if (event==LEFTMOUSE) event = RIGHTMOUSE;
1273 else if (event==RIGHTMOUSE) event = LEFTMOUSE;
1277 if(!mouse_in_header(sa)) {
1278 if(!G.obedit && (G.f & G_SCULPTMODE)) {
1279 SculptSession *ss= sculpt_session();
1280 if(ss && ss->radialcontrol) {
1281 radialcontrol_do_events(ss->radialcontrol, event);
1284 else if(event!=LEFTMOUSE && event!=MIDDLEMOUSE && (event==MOUSEY || event==MOUSEX)) {
1285 if(!bwin_qtest(sa->win))
1286 allqueue(REDRAWVIEW3D, 0);
1289 else if(!G.obedit && OBACT && G.f&G_PARTICLEEDIT){
1290 ParticleSystem *psys=PE_get_current(OBACT);
1291 ParticleEditSettings *pset=PE_settings();
1292 if(*PE_radialcontrol()) {
1293 radialcontrol_do_events(*PE_radialcontrol(), event);
1296 if(psys && psys->edit){
1297 if(pset->brushtype>=0 &&
1298 event!=LEFTMOUSE && event!=RIGHTMOUSE && event!=MIDDLEMOUSE &&
1299 (event==MOUSEY || event==MOUSEX) && bwin_qtest(sa->win)==0) {
1300 allqueue(REDRAWVIEW3D, 0);
1305 /* Handle retopo painting */
1306 if(retopo_mesh_paint_check()) {
1307 if(!retopo_paint(event))
1312 /* run any view3d event handler script links */
1313 if (event && sa->scriptlink.totscript)
1314 if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT))
1315 return; /* return if event was processed (swallowed) by handler(s) */
1318 if((G.obedit) && G.obedit->type==OB_FONT) {
1325 /* use '&' here, because of alt+leftmouse which emulates middlemouse */
1326 if(U.flag & USER_VIEWMOVE) {
1327 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1329 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1331 else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
1335 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1337 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1345 /* Regular: Zoom in */
1346 /* Shift: Scroll up */
1347 /* Ctrl: Scroll right */
1348 /* Alt-Shift: Rotate up */
1349 /* Alt-Ctrl: Rotate right */
1351 if( G.qual & LR_SHIFTKEY ) {
1352 if( G.qual & LR_ALTKEY ) {
1353 G.qual &= ~LR_SHIFTKEY;
1355 G.qual |= LR_SHIFTKEY;
1359 } else if( G.qual & LR_CTRLKEY ) {
1360 if( G.qual & LR_ALTKEY ) {
1361 G.qual &= ~LR_CTRLKEY;
1363 G.qual |= LR_CTRLKEY;
1367 } else if(U.uiflag & USER_WHEELZOOMDIR)
1368 persptoetsen(PADMINUS);
1370 persptoetsen(PADPLUSKEY);
1375 case WHEELDOWNMOUSE:
1376 /* Regular: Zoom out */
1377 /* Shift: Scroll down */
1378 /* Ctrl: Scroll left */
1379 /* Alt-Shift: Rotate down */
1380 /* Alt-Ctrl: Rotate left */
1382 if( G.qual & LR_SHIFTKEY ) {
1383 if( G.qual & LR_ALTKEY ) {
1384 G.qual &= ~LR_SHIFTKEY;
1386 G.qual |= LR_SHIFTKEY;
1390 } else if( G.qual & LR_CTRLKEY ) {
1391 if( G.qual & LR_ALTKEY ) {
1392 G.qual &= ~LR_CTRLKEY;
1394 G.qual |= LR_CTRLKEY;
1398 } else if(U.uiflag & USER_WHEELZOOMDIR)
1399 persptoetsen(PADPLUSKEY);
1401 persptoetsen(PADMINUS);
1407 if(G.qual==LR_ALTKEY) {
1412 do_textedit(event, val, ascii);
1416 if(G.qual==LR_ALTKEY) {
1421 do_textedit(event, val, ascii);
1424 case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
1425 case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
1427 persptoetsen(event);
1432 do_textedit(event, val, ascii);
1436 else if(!G.obedit && (G.f & G_SCULPTMODE)) {
1437 SculptData *sd= sculpt_data();
1438 SculptSession *ss= sculpt_session();
1439 BrushData *br= sculptmode_brush();
1440 Mesh *me= get_mesh(OBACT);
1441 char update_prop= 0;
1443 if(U.flag & USER_NONUMPAD) {
1444 event= convert_for_nonumpad(event);
1449 if(G.qual==LR_SHIFTKEY+LR_CTRLKEY)
1451 else if(!(ss && ss->radialcontrol))
1456 handle_view_middlemouse();
1459 handle_view_wheelup();
1462 case WHEELDOWNMOUSE:
1463 handle_view_wheeldown();
1467 if(G.qual==LR_SHIFTKEY+LR_CTRLKEY)
1471 if(G.qual==LR_SHIFTKEY) {
1473 curs= give_cursor();
1474 curs[0]=curs[1]=curs[2]= 0.0;
1475 allqueue(REDRAWVIEW3D, 0);
1477 else if(G.qual==0) {
1478 if (G.vd->persp==V3D_CAMOB)
1479 /* center the camera offset */
1480 G.vd->camdx= G.vd->camdy= 0.0;
1482 /*non camera center*/
1484 curs= give_cursor();
1485 new_ofs[0]= -curs[0];
1486 new_ofs[1]= -curs[1];
1487 new_ofs[2]= -curs[2];
1488 smooth_view(G.vd, new_ofs, NULL, NULL, NULL);
1493 case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
1494 case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
1498 persptoetsen(event);
1502 if(G.qual==LR_ALTKEY)
1503 view3d_edit_clipping(v3d);
1504 else if(G.qual==LR_SHIFTKEY) {
1505 if(G.vd->persp==V3D_CAMOB)
1506 set_render_border();
1508 view3d_border_zoom();
1513 if(G.vd->localview) {
1515 endlocalview(curarea);
1521 allqueue(REDRAWVIEW3D, 1);
1524 /* Brush properties */
1526 if(G.qual==LR_SHIFTKEY)
1527 br->flag ^= SCULPT_BRUSH_ANCHORED;
1529 br->flag ^= SCULPT_BRUSH_AIRBRUSH;
1530 update_prop= 1; break;
1533 sculpt_radialcontrol_start(G.qual == 0 ? RADIALCONTROL_SIZE :
1534 G.qual == LR_SHIFTKEY ? RADIALCONTROL_STRENGTH :
1535 G.qual == LR_CTRLKEY ? RADIALCONTROL_ROTATION :
1536 RADIALCONTROL_NONE);
1540 br->dir= br->dir==1 ? 2 : 1;
1541 update_prop= 1; break;
1544 sd->brush_type= DRAW_BRUSH;
1545 update_prop= 1; break;
1547 if(G.qual==LR_SHIFTKEY)
1548 sd->flags ^= SCULPT_INPUT_SMOOTH;
1550 sd->brush_type= SMOOTH_BRUSH;
1555 sd->brush_type= PINCH_BRUSH;
1556 update_prop= 1; break;
1558 sd->brush_type= INFLATE_BRUSH;
1559 update_prop= 1; break;
1561 sd->brush_type= GRAB_BRUSH;
1562 update_prop= 1; break;
1564 sd->brush_type= LAYER_BRUSH;
1565 update_prop= 1; break;
1567 sd->brush_type= FLATTEN_BRUSH;
1568 update_prop= 1; break;
1572 update_prop= 1; break;
1575 update_prop= 1; break;
1578 update_prop= 1; break;
1582 toggle_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
1583 allqueue(REDRAWVIEW3D, 0);
1589 me->mr->newlvl= ((Mesh*)ob->data)->mr->current+1;
1590 multires_set_level_cb(ob, ob->data);
1595 me->mr->newlvl= ((Mesh*)ob->data)->mr->current-1;
1596 multires_set_level_cb(ob, ob->data);
1599 /* Partial Visibility */
1601 if(G.qual==LR_ALTKEY) {
1603 mesh_pmv_off(ob, get_mesh(ob));
1604 BIF_undo_push("Partial mesh hide");
1605 allqueue(REDRAWVIEW3D,0);
1611 do_layer_buttons(0); break;
1613 do_layer_buttons(1); break;
1615 do_layer_buttons(2); break;
1617 do_layer_buttons(3); break;
1619 do_layer_buttons(4); break;
1621 do_layer_buttons(5); break;
1623 do_layer_buttons(6); break;
1625 do_layer_buttons(7); break;
1627 do_layer_buttons(8); break;
1629 do_layer_buttons(9); break;
1631 do_layer_buttons(10); break;
1633 do_layer_buttons(11); break;
1634 case ACCENTGRAVEKEY:
1635 do_layer_buttons(-1); break;
1638 if (G.vd->ndofmode == 0) {
1640 } else if (G.vd->ndofmode == 1) {
1650 if (G.vd->ndofmode > 2) /* we have currently 3 modes : 0 original, 1 fly, 2 transform */
1654 G.vd->ndoffilter =(G.vd->ndoffilter == 1 ? 0 : 1);
1656 allqueue(REDRAWHEADERS, 0);
1661 /* Redraw buttons window as well as view 3d (for floating panel) */
1663 allqueue(REDRAWVIEW3D, 0);
1664 allqueue(REDRAWBUTSEDIT, 0);
1668 if (U.flag & USER_NONUMPAD) {
1669 event= convert_for_nonumpad(event);
1674 /* Afterqueue events */
1679 BIF_view3d_previewrender(sa);
1683 /* Shift-Tabe handling (other cases are in toets) */
1684 if (G.qual == LR_SHIFTKEY)
1686 /* Snap toggle only when supported */
1687 if (BIF_snappingSupported())
1689 G.scene->snap_flag ^= SCE_SNAP;
1690 allqueue(REDRAWHEADERS, 0);
1695 /* LEFTMOUSE and RIGHTMOUSE event codes can be swapped above,
1696 * based on user preference USER_LMOUSESELECT
1699 if ((G.obedit) || !(G.f&(G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT|G_PARTICLEEDIT))) {
1702 else if (G.f & G_WEIGHTPAINT) {
1705 else if (G.f & G_VERTEXPAINT) {
1708 else if (G.f & G_TEXTUREPAINT) {
1709 imagepaint_paint(L_MOUSE, 1);
1711 else if (G.f & G_PARTICLEEDIT) {
1712 if(G.qual & LR_CTRLKEY)
1714 else if(!PE_brush_particles())
1719 handle_view_middlemouse();
1722 if((G.obedit) && (G.qual & LR_CTRLKEY)==0) {
1723 if(G.obedit->type==OB_MESH)
1725 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
1727 else if(G.obedit->type==OB_MBALL)
1729 else if(G.obedit->type==OB_LATTICE)
1731 else if(G.obedit->type==OB_ARMATURE)
1734 else if((G.obedit && G.obedit->type==OB_MESH) && (G.qual == (LR_CTRLKEY|LR_ALTKEY)))
1735 mouse_mesh(); /* loop select for 1 mousebutton dudes */
1736 else if((G.obedit && G.obedit->type==OB_MESH) && (G.qual == (LR_CTRLKEY|LR_ALTKEY|LR_SHIFTKEY)))
1737 mouse_mesh(); /* loop select for 1 mousebutton dudes */
1738 else if(G.qual==LR_CTRLKEY)
1739 mouse_select(); /* also allow in editmode, for vertex parenting */
1740 else if(FACESEL_PAINT_TEST)
1742 else if( G.f & (G_VERTEXPAINT|G_TEXTUREPAINT))
1744 else if( G.f & G_PARTICLEEDIT)
1745 PE_mouse_particles();
1747 mouse_select(); /* does poses too */
1750 handle_view_wheelup();
1753 case WHEELDOWNMOUSE:
1754 handle_view_wheeldown();
1759 if (G.vd->ndofmode == 0) {
1761 } else if (G.vd->ndofmode == 1) {
1771 if (G.vd->ndofmode > 2) /* we have currently 3 modes : 0 original, 1 fly, 2 transform */
1775 G.vd->ndoffilter =(G.vd->ndoffilter == 1 ? 0 : 1);
1777 allqueue(REDRAWHEADERS, 0);
1781 if(G.qual==LR_CTRLKEY) {
1784 else do_layer_buttons(0);
1788 if(G.qual==LR_CTRLKEY) {
1791 else do_layer_buttons(1);
1795 if(G.qual==LR_CTRLKEY) {
1798 else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
1799 if ( (G.obedit) && (G.obedit->type==OB_MESH) )
1800 select_faces_by_numverts(3);
1802 else do_layer_buttons(2);
1806 if(G.qual==LR_CTRLKEY) {
1809 else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
1810 if ( (G.obedit) && (G.obedit->type==OB_MESH) )
1811 select_faces_by_numverts(4);
1813 else do_layer_buttons(3);
1817 if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
1818 if ( (G.obedit) && (G.obedit->type==OB_MESH) )
1819 select_faces_by_numverts(5);
1822 else if(G.qual==LR_CTRLKEY) {}
1823 else do_layer_buttons(4);
1827 if(G.qual==LR_CTRLKEY) {}
1828 else do_layer_buttons(5);
1831 if(G.qual==LR_CTRLKEY) {}
1832 else do_layer_buttons(6);
1835 if(G.qual==LR_CTRLKEY) {}
1836 else do_layer_buttons(7);
1839 if(G.qual==LR_CTRLKEY) {}
1840 else do_layer_buttons(8);
1843 if(G.qual==LR_CTRLKEY) {}
1844 else do_layer_buttons(9);
1847 if(G.qual==LR_CTRLKEY) {}
1848 else do_layer_buttons(10);
1851 if(G.qual==LR_CTRLKEY) {}
1852 else do_layer_buttons(11);
1854 case ACCENTGRAVEKEY:
1855 do_layer_buttons(-1);
1859 if(G.qual == LR_CTRLKEY) {
1860 val= pupmenu("Manipulator%t|Enable/Disable|Translate|Rotate|Scale|Combo");
1862 if(val==1) v3d->twflag ^= V3D_USE_MANIPULATOR;
1864 if(val==2) v3d->twtype= V3D_MANIP_TRANSLATE;
1865 else if(val==3) v3d->twtype= V3D_MANIP_ROTATE;
1866 else if(val==4) v3d->twtype= V3D_MANIP_SCALE;
1867 else if(val==5) v3d->twtype= V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE|V3D_MANIP_SCALE;
1868 v3d->twflag |= V3D_USE_MANIPULATOR;
1873 else if(G.qual == LR_ALTKEY) {
1874 BIF_selectOrientation();
1881 if(G.qual == (LR_CTRLKEY|LR_ALTKEY)) {
1884 else if(G.obedit->type==OB_ARMATURE)
1885 align_selected_bones();
1887 else if(G.qual & LR_CTRLKEY) { /* also with shift! */
1890 else if((G.qual==LR_SHIFTKEY)) {
1895 if(G.obedit->type==OB_MESH)
1897 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
1899 else if(G.obedit->type==OB_MBALL)
1900 deselectall_mball();
1901 else if(G.obedit->type==OB_LATTICE)
1903 else if(G.obedit->type==OB_ARMATURE)
1904 deselectall_armature(1, 1); /* 1 == toggle */
1906 else if (ob && (ob->flag & OB_POSEMODE)){
1907 deselectall_posearmature(ob, 1, 1);
1910 if(FACESEL_PAINT_TEST) deselectall_tface();
1911 else if(G.f & G_PARTICLEEDIT) PE_deselectall();
1913 /* by design, the center of the active object
1914 * (which need not necessarily by selected) will
1915 * still be drawn as if it were selected.
1923 if(G.qual==LR_ALTKEY)
1924 view3d_edit_clipping(v3d);
1925 else if(G.qual==LR_SHIFTKEY)
1927 if(G.vd->persp==V3D_CAMOB)
1928 set_render_border();
1930 view3d_border_zoom();
1932 else if(G.qual==LR_CTRLKEY) {
1933 extern void pointcache_bake(PTCacheID *pid, int startframe);
1934 extern void pointcache_free(PTCacheID *pid, int cacheonly);
1935 extern void fluidsimBake(Object *ob);
1936 extern void fluidsimFreeBake(Object *ob);
1939 pupval= pupmenu("Physics Baking%t|Bake selected %x1|Free bake selected %x2|Free cache selected %x3");
1943 pointcache_bake(NULL, 0);
1944 /* also bake first domain of selected objects... */
1947 else if(pupval == 2) {
1948 pointcache_free(NULL, 0);
1949 fluidsimFreeBake(NULL);
1951 else if(pupval == 3)
1952 pointcache_free(NULL, 1);
1955 else if(G.qual== (LR_ALTKEY|LR_CTRLKEY))
1956 objects_bake_render_menu();
1961 if(G.qual==LR_CTRLKEY) {
1962 if(ob && (ob->flag & OB_POSEMODE))
1963 pose_copy_menu(); /* poseobject.c */
1967 else if(G.qual==(LR_ALTKEY|LR_SHIFTKEY))
1968 gpencil_convert_menu(); /* gpencil.c */
1969 else if(G.qual==LR_ALTKEY) {
1970 if(ob && (ob->flag & OB_POSEMODE))
1971 pose_clear_constraints(); /* poseobject.c */
1973 convertmenu(); /* editobject.c */
1975 else if(G.qual==(LR_ALTKEY|LR_CTRLKEY))
1976 add_constraint(0); /* editconstraint.c, generic for objects and posemode */
1977 else if(G.qual==(LR_CTRLKEY|LR_SHIFTKEY)) {
1978 BIF_manageTransformOrientation(0, 1);
1979 allqueue(REDRAWVIEW3D, 0);
1981 else if((G.qual==LR_SHIFTKEY)) {
1983 curs= give_cursor();
1984 curs[0]=curs[1]=curs[2]= 0.0;
1985 allqueue(REDRAWVIEW3D, 0);
1987 else if((G.obedit) && ELEM(G.obedit->type, OB_CURVE, OB_SURF) ) {
1989 DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
1990 allqueue(REDRAWVIEW3D, 0);
1992 else if((G.qual==0)){
1993 if (G.vd->persp==V3D_CAMOB)
1994 /* center the camera offset */
1995 G.vd->camdx= G.vd->camdy= 0.0;
1997 /*non camera center*/
1999 curs= give_cursor();
2000 new_ofs[0]= -curs[0];
2001 new_ofs[1]= -curs[1];
2002 new_ofs[2]= -curs[2];
2003 smooth_view(G.vd, new_ofs, NULL, NULL, NULL);
2005 scrarea_queue_winredraw(curarea);
2009 if((G.qual==LR_SHIFTKEY)) {
2010 duplicate_context_selected();
2012 else if(G.qual==LR_ALTKEY) {
2013 if(ob && (ob->flag & OB_POSEMODE))
2014 error ("Duplicate not possible in posemode.");
2015 else if((G.obedit==NULL))
2018 else if(G.qual==LR_CTRLKEY) {
2019 imagestodisplist(); // removed
2021 else if((G.qual==0)){
2022 pupval= pupmenu("Draw mode%t|BoundBox %x1|Wire %x2|OpenGL Solid %x3|Shaded Solid %x4|Textured Solid %x5");
2024 G.vd->drawtype= pupval;
2033 if(G.obedit->type==OB_MESH)
2035 else if(G.obedit->type==OB_CURVE)
2037 else if(G.obedit->type==OB_SURF)
2039 else if(G.obedit->type==OB_ARMATURE)
2040 extrude_armature(0);
2043 else if (G.qual==LR_CTRLKEY) {
2044 if(G.obedit && G.obedit->type==OB_MESH)
2046 else if (FACESEL_PAINT_TEST)
2047 seam_mark_clear_tface(0);
2049 else if (G.qual==LR_SHIFTKEY) {
2050 if (G.obedit && G.obedit->type==OB_MESH &&
2051 !multires_level1_test()) {
2052 initTransform(TFM_CREASE, CTX_EDGE);
2055 else if (G.obedit && G.obedit->type==OB_ARMATURE) {
2056 extrude_armature(1);
2059 else if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY)) {
2060 if (G.obedit && G.obedit->type==OB_MESH &&
2061 !multires_level1_test()) {
2062 if (G.scene->selectmode & SCE_SELECT_VERTEX) {
2063 initTransform(TFM_BWEIGHT, CTX_NONE);
2066 initTransform(TFM_BWEIGHT, CTX_EDGE);
2074 if(G.obedit->type==OB_MESH) {
2075 if(G.qual == LR_CTRLKEY)
2077 else if((G.qual==LR_SHIFTKEY))
2079 else if(G.qual==LR_ALTKEY)
2081 else if(G.qual==(LR_CTRLKEY|LR_SHIFTKEY))
2086 (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
2087 select_linked_flat_faces();
2091 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
2094 else if(G.obedit->type == OB_ARMATURE) {
2095 fill_bones_armature();
2098 else if(G.qual==LR_CTRLKEY)
2100 else if((G.qual==LR_SHIFTKEY)) {
2101 if(ob && (ob->flag & OB_POSEMODE))
2102 pose_activate_flipped_bone();
2103 else if(G.f & G_WEIGHTPAINT)
2104 pose_activate_flipped_bone();
2105 else if(G.f & G_PARTICLEEDIT)
2106 PE_radialcontrol_start(RADIALCONTROL_STRENGTH);
2110 else if((G.qual==LR_ALTKEY)) {
2111 if(ob && (ob->flag & OB_POSEMODE))
2112 if(okee("Flip quaternion rotations"))
2116 if (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT)){
2117 G.f ^= G_FACESELECT;
2118 allqueue(REDRAWVIEW3D, 1);
2119 allqueue(REDRAWBUTSEDIT, 1);
2121 else if(G.f & G_PARTICLEEDIT) {
2122 PE_radialcontrol_start(RADIALCONTROL_SIZE);
2124 pupmenu("Note%t|UV/Face Select was removed. Editmode now allows UV editing, Add a UV layer or Unwrap (UKey)");
2130 if((G.qual == LR_CTRLKEY)) {
2132 if(ELEM(G.obedit->type, OB_MESH, OB_LATTICE))
2133 vgroup_assign_with_menu();
2135 else if(ob && (ob->flag & OB_POSEMODE))
2136 pgroup_operation_with_menu();
2138 group_operation_with_menu();
2140 else if((G.qual == (LR_CTRLKEY|LR_SHIFTKEY))) {
2142 if(ELEM(G.obedit->type, OB_MESH, OB_LATTICE))
2143 vgroup_operation_with_menu();
2146 else if((G.qual==LR_SHIFTKEY)) {
2148 if(G.obedit->type==OB_MESH)
2149 select_mesh_group_menu();
2151 else if(ob && (ob->flag & OB_POSEMODE))
2152 pose_select_grouped_menu();
2154 select_object_grouped_menu();
2156 else if((G.obedit==0) && G.qual==LR_ALTKEY) {
2157 if(okee("Clear location")) {
2161 else if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
2162 v3d->twtype= V3D_MANIP_TRANSLATE;
2165 else if((G.qual==0)) {
2166 initTransform(TFM_TRANSLATION, CTX_NONE);
2172 if(G.obedit->type==OB_MESH) {
2173 if(G.qual==LR_CTRLKEY)
2175 else if(G.qual==LR_ALTKEY)
2177 else if((G.qual==LR_SHIFTKEY))
2179 else if((G.qual==0))
2182 else if(G.obedit->type== OB_SURF) {
2183 if(G.qual==LR_CTRLKEY)
2185 else if(G.qual==LR_ALTKEY)
2187 else if((G.qual==LR_SHIFTKEY))
2189 else if((G.qual==0))
2192 else if(G.obedit->type==OB_CURVE) {
2193 if(G.qual==LR_CTRLKEY)
2195 else if(G.qual==LR_ALTKEY)
2197 /* should be G.qual==LR_SHIFTKEY, but that is taken fro handles already */
2198 else if((G.qual==(LR_ALTKEY|LR_SHIFTKEY)))
2200 /* should be G.qual==0, but that is taken for handles already */
2201 else if((G.qual==(LR_ALTKEY|LR_CTRLKEY)))
2204 if(G.qual==LR_CTRLKEY) /* conflict */
2205 autocalchandlesNurb_all(1); /* flag=1, selected */
2206 else if((G.qual==LR_SHIFTKEY))
2208 else if((G.qual==0))
2211 DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
2212 BIF_undo_push("Handle change");
2213 allqueue(REDRAWVIEW3D, 0);
2216 else if(G.obedit->type==OB_LATTICE) {
2217 if(G.qual==LR_CTRLKEY) add_hook_menu();
2219 else if(G.obedit->type==OB_MBALL) {
2220 if(G.qual==LR_ALTKEY)
2222 else if((G.qual==LR_SHIFTKEY))
2224 else if((G.qual==0))
2227 else if(G.obedit->type==OB_ARMATURE) {
2229 hide_selected_armature_bones();
2230 else if (G.qual==LR_SHIFTKEY)
2231 hide_unselected_armature_bones();
2232 else if (G.qual==LR_ALTKEY)
2233 show_all_armature_bones();
2236 else if(FACESEL_PAINT_TEST)
2238 else if(G.f & G_PARTICLEEDIT) {
2239 if(G.qual == LR_ALTKEY)
2241 else if(G.qual == LR_SHIFTKEY)
2243 else if(G.qual == 0)
2246 else if(ob && (ob->flag & OB_POSEMODE)) {
2248 hide_selected_pose_bones();
2249 else if (G.qual==LR_SHIFTKEY)
2250 hide_unselected_pose_bones();
2251 else if (G.qual==LR_ALTKEY)
2252 show_all_pose_bones();
2254 /* Object mode only, other modes are accounted for above */
2255 else if ((G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
2256 if(G.qual==LR_CTRLKEY)hookmenu();
2257 else if(G.qual==LR_ALTKEY) show_objects();
2258 else if(G.qual==LR_SHIFTKEY) hide_objects(0);
2259 else hide_objects(1);
2263 if(G.qual==LR_CTRLKEY) {
2264 if((ob) && (ob->flag & OB_POSEMODE) && (ob->type==OB_ARMATURE))
2265 deselectall_posearmature(ob, 3, 1);
2266 else if(ob && G.obedit) {
2267 if(G.obedit->type == OB_ARMATURE)
2268 deselectall_armature(3, 1);
2275 else if(G.qual==(LR_CTRLKEY|LR_ALTKEY)) {
2276 if(ob && (ob->flag & OB_POSEMODE) && ob->type==OB_ARMATURE)
2279 else if(G.qual==LR_SHIFTKEY) {
2280 if(ob && (ob->flag & OB_POSEMODE) && ob->type==OB_ARMATURE)
2286 if(G.qual==LR_CTRLKEY) {
2290 else if ((G.obedit) && ELEM(G.obedit->type, OB_CURVE, OB_SURF)) {
2293 error("Can't join unless there is an active object");
2298 if(G.obedit->type==OB_MESH) {
2306 if (G.obedit->type==OB_MESH) {
2307 if (G.qual==LR_SHIFTKEY)
2308 KnifeSubdivide(KNIFE_PROMPT);
2312 else if(G.obedit->type==OB_SURF)
2316 if((G.qual==LR_SHIFTKEY)) {
2317 if(FACESEL_PAINT_TEST)
2318 if (G.f & G_WEIGHTPAINT)
2319 clear_wpaint_selectedfaces();
2321 clear_vpaint_selectedfaces();
2322 else if(G.f & G_VERTEXPAINT)
2325 select_select_keys();
2334 if(G.obedit->type==OB_MESH) {
2335 if (G.qual & LR_CTRLKEY) {
2336 if ((G.scene->selectmode & SCE_SELECT_FACE) == 0) {
2337 selectconnected_mesh_all(); /* normal select linked */
2339 selectconnected_delimit_mesh_all(); /* select linked with edge crease delimiting */
2342 if ((G.scene->selectmode & SCE_SELECT_FACE) == 0) {
2343 selectconnected_mesh();
2345 selectconnected_delimit_mesh();
2349 if(G.obedit->type==OB_ARMATURE)
2350 selectconnected_armature();
2351 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
2352 selectconnected_nurb();
2354 else if(ob && (ob->flag & OB_POSEMODE)) {
2355 if (G.qual == LR_CTRLKEY)
2356 poselib_preview_poses(ob, 0);
2357 else if (G.qual == LR_SHIFTKEY)
2358 poselib_add_current_pose(ob, 0);
2359 else if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY))
2360 poselib_rename_pose(ob);
2361 else if (G.qual == LR_ALTKEY)
2362 poselib_remove_pose(ob, NULL);
2364 selectconnected_posearmature();
2367 if(FACESEL_PAINT_TEST) {
2369 select_linked_tfaces(0);
2370 else if((G.qual==LR_SHIFTKEY))
2371 select_linked_tfaces(1);
2372 else if(G.qual==LR_CTRLKEY)
2373 select_linked_tfaces(2);
2375 else if(G.f & G_PARTICLEEDIT) {
2382 else if((G.qual==LR_SHIFTKEY))
2384 else if(G.qual==LR_CTRLKEY)
2391 if (ELEM(G.qual, 0, LR_SHIFTKEY) && (G.obedit->type==OB_ARMATURE)) {
2394 else if (G.qual==LR_ALTKEY) {
2395 if (G.obedit->type == OB_MESH) {
2397 DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
2399 else if (G.obedit->type == OB_ARMATURE) {
2403 else if ((G.qual==0) || (G.qual==LR_CTRLKEY)) {
2406 else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
2407 if(G.obedit->type==OB_MESH) select_non_manifold();
2410 else if(G.qual & LR_CTRLKEY) {
2413 else if(G.qual==0 || G.qual==LR_SHIFTKEY) {
2414 if(ob && (ob->flag & OB_POSEMODE))
2422 toggle_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
2423 allqueue(REDRAWVIEW3D, 0);
2426 switch (G.obedit->type){
2428 if(G.qual==LR_CTRLKEY) {
2429 pupval= pupmenu("Recalculate Bone Roll Angles%t|Clear Roll (Z-Axis Up) %x1|Align Z-Axis to 3D-Cursor %x2");
2431 auto_align_armature(pupval - 1);
2432 allqueue(REDRAWVIEW3D, 0);
2437 if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
2438 if(okee("Recalculate normals inside")) {
2440 allqueue(REDRAWVIEW3D, 0);
2441 BIF_undo_push("Recalculate normals inside");
2444 else if(G.qual==LR_CTRLKEY){
2445 if(okee("Recalculate normals outside")) {
2447 allqueue(REDRAWVIEW3D, 0);
2448 BIF_undo_push("Recalculate normals outside");
2457 if (G.obedit || G.f&G_PARTICLEEDIT) {
2458 if (G.qual==LR_SHIFTKEY) {
2459 G.scene->prop_mode = (G.scene->prop_mode+1)%7;
2460 allqueue(REDRAWHEADERS, 0);
2462 else if((G.qual==LR_ALTKEY)) {
2463 if(G.scene->proportional==2) G.scene->proportional= 1;
2464 else G.scene->proportional= 2;
2465 allqueue(REDRAWHEADERS, 0);
2467 else if((G.qual==0)) {
2468 G.scene->proportional= !G.scene->proportional;
2469 allqueue(REDRAWHEADERS, 0);
2472 else if((G.qual==LR_SHIFTKEY || G.qual==(LR_ALTKEY|LR_SHIFTKEY))) {
2473 flip_subdivison(-1);
2475 else if(G.qual==LR_ALTKEY) {
2476 if(okee("Clear origin")) {
2484 if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
2485 if(G.obedit->type==OB_ARMATURE)
2491 else if(G.qual==LR_ALTKEY && G.obedit->type==OB_ARMATURE)
2492 clear_bone_parent();
2493 else if((G.qual==0) && (G.obedit->type==OB_ARMATURE))
2494 armature_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
2495 else if((G.qual==(LR_CTRLKEY|LR_ALTKEY)) && (G.obedit->type==OB_ARMATURE))
2496 separate_armature();
2497 else if((G.qual==0) && G.obedit->type==OB_MESH)
2499 else if ((G.qual==0) && ELEM(G.obedit->type, OB_CURVE, OB_SURF))
2501 else if (G.qual==LR_SHIFTKEY) {
2502 initTransform(TFM_PUSHPULL, CTX_NONE);
2506 else if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY))
2508 else if(G.qual==LR_SHIFTKEY) {
2509 toggle_blockhandler(curarea, VIEW3D_HANDLER_PREVIEW, 0);
2512 else if(G.qual==(LR_ALTKEY|LR_SHIFTKEY)) {
2513 initTransform(TFM_PUSHPULL, CTX_NONE);
2516 else if(G.qual==LR_ALTKEY)
2518 else if(G.qual==(LR_ALTKEY|LR_CTRLKEY))
2520 else if(G.qual==(LR_ALTKEY|LR_CTRLKEY|LR_SHIFTKEY)) {
2521 start_RBSimulation();
2523 else if((G.qual==0) && (OBACT) && (OBACT->type==OB_ARMATURE) && (OBACT->flag & OB_POSEMODE))
2524 pose_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
2525 else if((G.qual==0)) {
2530 if((G.obedit==0) && G.qual==LR_ALTKEY) {
2531 if(okee("Clear rotation")) {
2535 else if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
2536 v3d->twtype= V3D_MANIP_ROTATE;
2539 else if (G.obedit) {
2540 if((G.qual==LR_SHIFTKEY)) {
2541 if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
2544 else if(G.qual==LR_CTRLKEY) {
2545 if (G.obedit->type==OB_MESH) {
2547 BIF_undo_push("Cut Edgeloop");
2549 else if (G.obedit->type==OB_ARMATURE) {
2550 initTransform(TFM_BONE_ROLL, CTX_NONE);
2554 else if((G.qual==0)) {
2555 initTransform(TFM_ROTATION, CTX_NONE);
2559 else if((G.qual==0)) {
2560 initTransform(TFM_ROTATION, CTX_NONE);
2565 if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
2566 v3d->twtype= V3D_MANIP_SCALE;
2571 if(G.qual==LR_ALTKEY) {
2572 if(G.obedit->type==OB_ARMATURE) {
2573 initTransform(TFM_BONESIZE, CTX_NONE);
2575 else if (G.obedit->type==OB_CURVE) {
2576 initTransform(TFM_CURVE_SHRINKFATTEN, CTX_NONE);
2578 initTransform(TFM_SHRINKFATTEN, CTX_NONE);
2582 else if(G.qual==LR_CTRLKEY) {
2583 initTransform(TFM_SHEAR, CTX_NONE);
2586 else if(G.qual==LR_SHIFTKEY)
2588 else if(G.qual==0) {
2589 if(G.obedit->type==OB_ARMATURE) {
2590 bArmature *arm= G.obedit->data;
2591 if(arm->drawtype==ARM_ENVELOPE)
2592 initTransform(TFM_BONE_ENVELOPE, CTX_NONE);
2594 initTransform(TFM_RESIZE, CTX_NONE);
2597 initTransform(TFM_RESIZE, CTX_NONE);
2600 else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)){
2601 initTransform(TFM_TOSPHERE, CTX_NONE);
2604 if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
2605 if(G.obedit->type==OB_MESH) select_sharp_edges();
2608 else if(G.qual==LR_ALTKEY) {
2609 if(G.f & G_WEIGHTPAINT)
2611 if(ob && (ob->flag & OB_POSEMODE)) {
2612 bArmature *arm= ob->data;
2613 if( arm->drawtype==ARM_ENVELOPE) {
2614 initTransform(TFM_BONESIZE, CTX_NONE);
2620 if(okee("Clear scale")) {
2624 else if(G.qual==LR_SHIFTKEY) {
2627 else if((G.qual==0)) {
2628 initTransform(TFM_RESIZE, CTX_NONE);
2631 else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
2632 initTransform(TFM_TOSPHERE, CTX_NONE);
2635 else if(G.qual==(LR_CTRLKEY|LR_ALTKEY|LR_SHIFTKEY)) {
2636 initTransform(TFM_SHEAR, CTX_NONE);
2641 if(G.qual == LR_SHIFTKEY) { /* toggle texture in solid draw mode */
2642 G.vd->flag2 ^= V3D_SOLID_TEX;
2643 allqueue(REDRAWVIEW3D, 0);
2644 } else if(G.obedit){
2645 if((G.qual & LR_CTRLKEY) && G.obedit->type==OB_MESH) {
2646 convert_to_triface(G.qual & LR_SHIFTKEY);
2647 allqueue(REDRAWVIEW3D, 0);
2648 if (EM_texFaceCheck())
2649 allqueue(REDRAWIMAGE, 0);