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"
142 #include "BIF_sketch.h"
144 #include "BSE_edit.h"
145 #include "BSE_view.h"
146 #include "BSE_editipo.h"
147 #include "BSE_drawipo.h"
148 #include "BSE_drawview.h"
149 #include "BSE_drawnla.h"
150 #include "BSE_filesel.h"
151 #include "BSE_headerbuttons.h"
152 #include "BSE_editnla_types.h"
153 #include "BSE_time.h"
154 #include "BSE_trans_types.h"
156 #include "BDR_vpaint.h"
157 #include "BDR_editmball.h"
158 #include "BDR_editobject.h"
159 #include "BDR_editcurve.h"
160 #include "BDR_editface.h"
161 #include "BDR_drawmesh.h"
162 #include "BDR_drawobject.h"
163 #include "BDR_imagepaint.h"
164 #include "BDR_sculptmode.h"
165 #include "BDR_unwrapper.h"
166 #include "BDR_gpencil.h"
167 #include "BDR_sketch.h"
169 #include "BLO_readfile.h" /* for BLO_blendhandle_close */
171 #include "PIL_time.h"
173 #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.005))) {
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 BPY_scripts_clear_pyobjects();
1086 sound_initialize_sounds();
1095 if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
1096 undo_editmode_step(-1);
1099 if(G.f & G_TEXTUREPAINT)
1100 undo_imagepaint_step(-1);
1101 else if(curarea->spacetype==SPACE_IMAGE && (G.sima->flag & SI_DRAWTOOL))
1102 undo_imagepaint_step(-1);
1103 else if(G.f & G_PARTICLEEDIT)
1106 /* includes faceselect now */
1107 if(U.uiflag & USER_GLOBALUNDO) {
1109 sound_initialize_sounds();
1115 void BIF_undo_menu(void)
1118 if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
1119 undo_editmode_menu();
1120 allqueue(REDRAWALL, 0);
1123 if(G.f & G_PARTICLEEDIT)
1125 else if(U.uiflag & USER_GLOBALUNDO) {
1126 char *menu= BKE_undo_menu_string();
1128 short event= pupmenu_col(menu, 20);
1131 BKE_undo_number(event);
1132 sound_initialize_sounds();
1139 /* *************** */
1141 void handle_view_middlemouse() {
1142 /* use '&' here, because of alt+leftmouse which emulates middlemouse */
1143 if(U.flag & USER_VIEWMOVE) {
1144 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1146 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1148 else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
1152 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1154 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1156 else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
1161 void handle_view_wheelup()
1163 /* Regular: Zoom in */
1164 /* Shift: Scroll up */
1165 /* Ctrl: Scroll right */
1166 /* Alt-Shift: Rotate up */
1167 /* Alt-Ctrl: Rotate right */
1169 if( G.qual & LR_SHIFTKEY ) {
1170 if( G.qual & LR_ALTKEY ) {
1171 G.qual &= ~LR_SHIFTKEY;
1173 G.qual |= LR_SHIFTKEY;
1177 } else if( G.qual & LR_CTRLKEY ) {
1178 if( G.qual & LR_ALTKEY ) {
1179 G.qual &= ~LR_CTRLKEY;
1181 G.qual |= LR_CTRLKEY;
1185 } else if(U.uiflag & USER_WHEELZOOMDIR)
1186 persptoetsen(PADMINUS);
1188 persptoetsen(PADPLUSKEY);
1191 void handle_view_wheeldown()
1193 /* Regular: Zoom out */
1194 /* Shift: Scroll down */
1195 /* Ctrl: Scroll left */
1196 /* Alt-Shift: Rotate down */
1197 /* Alt-Ctrl: Rotate left */
1199 if( G.qual & LR_SHIFTKEY ) {
1200 if( G.qual & LR_ALTKEY ) {
1201 G.qual &= ~LR_SHIFTKEY;
1203 G.qual |= LR_SHIFTKEY;
1207 } else if( G.qual & LR_CTRLKEY ) {
1208 if( G.qual & LR_ALTKEY ) {
1209 G.qual &= ~LR_CTRLKEY;
1211 G.qual |= LR_CTRLKEY;
1215 } else if(U.uiflag & USER_WHEELZOOMDIR)
1216 persptoetsen(PADPLUSKEY);
1218 persptoetsen(PADMINUS);
1221 int mouse_in_header(ScrArea *sa)
1224 getmouseco_sc(mouse);
1225 return mouse[0] >= sa->headrct.xmin &&
1226 mouse[0] <= sa->headrct.xmax &&
1227 mouse[1] >= sa->headrct.ymin &&
1228 mouse[1] <= sa->headrct.ymax;
1231 static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
1233 View3D *v3d= sa->spacedata.first;
1234 Object *ob= OBACT; /* do not change! */
1236 int doredraw= 0, pupval;
1237 unsigned short event= evt->event;
1238 short val= evt->val;
1239 char ascii= evt->ascii;
1241 if(curarea->win==0) return; /* when it comes from sa->headqread() */
1245 if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
1247 if(event==UI_BUT_EVENT) do_butspace(val); /* temporal, view3d deserves own queue? */
1249 /* - we consider manipulator a button, defaulting to leftmouse
1250 * - grease-pencil also defaults to leftmouse
1252 if(event==LEFTMOUSE) {
1253 /* run any view3d event handler script links */
1254 if (sa->scriptlink.totscript) {
1255 if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT))
1256 return; /* return if event was processed (swallowed) by handler(s) */
1259 if(BIF_paintSketch(LEFTMOUSE)) return;
1260 if(gpencil_do_paint(sa, L_MOUSE)) return;
1261 if(BIF_do_manipulator(sa)) return;
1263 else if(event==RIGHTMOUSE) {
1264 if(gpencil_do_paint(sa, R_MOUSE)) return;
1265 if(BIF_paintSketch(RIGHTMOUSE)) return;
1268 /* swap mouse buttons based on user preference */
1269 if (U.flag & USER_LMOUSESELECT) {
1270 /* only swap mouse button for selection, in modes where it is relevant.
1271 * painting/sculpting stays on LEFTMOUSE */
1272 if ( !((G.f & G_SCULPTMODE) || (G.f & G_WEIGHTPAINT) || (G.f & G_GREASEPENCIL) ||
1273 (G.f & G_VERTEXPAINT) || (G.f & G_TEXTUREPAINT) || (G.f & G_PARTICLEEDIT)) ||
1276 if (event==LEFTMOUSE) event = RIGHTMOUSE;
1277 else if (event==RIGHTMOUSE) event = LEFTMOUSE;
1281 if(!mouse_in_header(sa)) {
1282 if(!G.obedit && (G.f & G_SCULPTMODE)) {
1283 SculptSession *ss= sculpt_session();
1284 if(ss && ss->radialcontrol) {
1285 radialcontrol_do_events(ss->radialcontrol, event);
1288 else if(event!=LEFTMOUSE && event!=MIDDLEMOUSE && (event==MOUSEY || event==MOUSEX)) {
1289 if(!bwin_qtest(sa->win))
1290 allqueue(REDRAWVIEW3D, 0);
1293 else if(!G.obedit && OBACT && G.f&G_PARTICLEEDIT){
1294 ParticleSystem *psys=PE_get_current(OBACT);
1295 ParticleEditSettings *pset=PE_settings();
1296 if(*PE_radialcontrol()) {
1297 radialcontrol_do_events(*PE_radialcontrol(), event);
1300 if(psys && psys->edit){
1301 if(pset->brushtype>=0 &&
1302 event!=LEFTMOUSE && event!=RIGHTMOUSE && event!=MIDDLEMOUSE &&
1303 (event==MOUSEY || event==MOUSEX) && bwin_qtest(sa->win)==0) {
1304 allqueue(REDRAWVIEW3D, 0);
1309 BDR_queueDrawSketch();
1311 /* Handle retopo painting */
1312 if(retopo_mesh_paint_check()) {
1313 if(!retopo_paint(event))
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) */
1324 if((G.obedit) && G.obedit->type==OB_FONT) {
1331 /* use '&' here, because of alt+leftmouse which emulates middlemouse */
1332 if(U.flag & USER_VIEWMOVE) {
1333 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1335 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1337 else if((G.qual==0) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==LR_ALTKEY)))
1341 if((G.qual==LR_SHIFTKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_SHIFTKEY))))
1343 else if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
1351 /* Regular: Zoom in */
1352 /* Shift: Scroll up */
1353 /* Ctrl: Scroll right */
1354 /* Alt-Shift: Rotate up */
1355 /* Alt-Ctrl: Rotate right */
1357 if( G.qual & LR_SHIFTKEY ) {
1358 if( G.qual & LR_ALTKEY ) {
1359 G.qual &= ~LR_SHIFTKEY;
1361 G.qual |= LR_SHIFTKEY;
1365 } else if( G.qual & LR_CTRLKEY ) {
1366 if( G.qual & LR_ALTKEY ) {
1367 G.qual &= ~LR_CTRLKEY;
1369 G.qual |= LR_CTRLKEY;
1373 } else if(U.uiflag & USER_WHEELZOOMDIR)
1374 persptoetsen(PADMINUS);
1376 persptoetsen(PADPLUSKEY);
1381 case WHEELDOWNMOUSE:
1382 /* Regular: Zoom out */
1383 /* Shift: Scroll down */
1384 /* Ctrl: Scroll left */
1385 /* Alt-Shift: Rotate down */
1386 /* Alt-Ctrl: Rotate left */
1388 if( G.qual & LR_SHIFTKEY ) {
1389 if( G.qual & LR_ALTKEY ) {
1390 G.qual &= ~LR_SHIFTKEY;
1392 G.qual |= LR_SHIFTKEY;
1396 } else if( G.qual & LR_CTRLKEY ) {
1397 if( G.qual & LR_ALTKEY ) {
1398 G.qual &= ~LR_CTRLKEY;
1400 G.qual |= LR_CTRLKEY;
1404 } else if(U.uiflag & USER_WHEELZOOMDIR)
1405 persptoetsen(PADPLUSKEY);
1407 persptoetsen(PADMINUS);
1413 if(G.qual==LR_ALTKEY) {
1418 do_textedit(event, val, ascii);
1422 if(G.qual==LR_ALTKEY) {
1427 do_textedit(event, val, ascii);
1430 case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
1431 case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
1433 persptoetsen(event);
1438 do_textedit(event, val, ascii);
1442 else if(!G.obedit && (G.f & G_SCULPTMODE)) {
1443 SculptData *sd= sculpt_data();
1444 SculptSession *ss= sculpt_session();
1445 BrushData *br= sculptmode_brush();
1446 Mesh *me= get_mesh(OBACT);
1447 char update_prop= 0;
1449 if(U.flag & USER_NONUMPAD) {
1450 event= convert_for_nonumpad(event);
1455 if(G.qual==LR_SHIFTKEY+LR_CTRLKEY)
1457 else if(!(ss && ss->radialcontrol))
1462 handle_view_middlemouse();
1465 handle_view_wheelup();
1468 case WHEELDOWNMOUSE:
1469 handle_view_wheeldown();
1473 if(G.qual==LR_SHIFTKEY+LR_CTRLKEY)
1477 if(G.qual==LR_SHIFTKEY) {
1479 curs= give_cursor();
1480 curs[0]=curs[1]=curs[2]= 0.0;
1481 allqueue(REDRAWVIEW3D, 0);
1483 else if(G.qual==0) {
1484 if (G.vd->persp==V3D_CAMOB)
1485 /* center the camera offset */
1486 G.vd->camdx= G.vd->camdy= 0.0;
1488 /*non camera center*/
1490 curs= give_cursor();
1491 new_ofs[0]= -curs[0];
1492 new_ofs[1]= -curs[1];
1493 new_ofs[2]= -curs[2];
1494 smooth_view(G.vd, new_ofs, NULL, NULL, NULL);
1499 case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
1500 case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
1504 persptoetsen(event);
1508 if(G.qual==LR_ALTKEY)
1509 view3d_edit_clipping(v3d);
1510 else if(G.qual==LR_SHIFTKEY) {
1511 if(G.vd->persp==V3D_CAMOB)
1512 set_render_border();
1514 view3d_border_zoom();
1519 if(G.vd->localview) {
1521 endlocalview(curarea);
1527 allqueue(REDRAWVIEW3D, 1);
1530 /* Brush properties */
1532 if(G.qual==LR_SHIFTKEY)
1533 br->flag ^= SCULPT_BRUSH_ANCHORED;
1535 br->flag ^= SCULPT_BRUSH_AIRBRUSH;
1536 update_prop= 1; break;
1539 sculpt_radialcontrol_start(G.qual == 0 ? RADIALCONTROL_SIZE :
1540 G.qual == LR_SHIFTKEY ? RADIALCONTROL_STRENGTH :
1541 G.qual == LR_CTRLKEY ? RADIALCONTROL_ROTATION :
1542 RADIALCONTROL_NONE);
1546 br->dir= br->dir==1 ? 2 : 1;
1547 update_prop= 1; break;
1550 sd->brush_type= DRAW_BRUSH;
1551 update_prop= 1; break;
1553 if(G.qual==LR_SHIFTKEY)
1554 sd->flags ^= SCULPT_INPUT_SMOOTH;
1556 sd->brush_type= SMOOTH_BRUSH;
1561 sd->brush_type= PINCH_BRUSH;
1562 update_prop= 1; break;
1564 sd->brush_type= INFLATE_BRUSH;
1565 update_prop= 1; break;
1567 sd->brush_type= GRAB_BRUSH;
1568 update_prop= 1; break;
1570 sd->brush_type= LAYER_BRUSH;
1571 update_prop= 1; break;
1573 sd->brush_type= FLATTEN_BRUSH;
1574 update_prop= 1; break;
1578 update_prop= 1; break;
1581 update_prop= 1; break;
1584 update_prop= 1; break;
1588 toggle_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
1589 allqueue(REDRAWVIEW3D, 0);
1595 me->mr->newlvl= ((Mesh*)ob->data)->mr->current+1;
1596 multires_set_level_cb(ob, ob->data);
1601 me->mr->newlvl= ((Mesh*)ob->data)->mr->current-1;
1602 multires_set_level_cb(ob, ob->data);
1605 /* Partial Visibility */
1607 if(G.qual==LR_ALTKEY) {
1609 mesh_pmv_off(ob, get_mesh(ob));
1610 BIF_undo_push("Partial mesh hide");
1611 allqueue(REDRAWVIEW3D,0);
1617 do_layer_buttons(0); break;
1619 do_layer_buttons(1); break;
1621 do_layer_buttons(2); break;
1623 do_layer_buttons(3); break;
1625 do_layer_buttons(4); break;
1627 do_layer_buttons(5); break;
1629 do_layer_buttons(6); break;
1631 do_layer_buttons(7); break;
1633 do_layer_buttons(8); break;
1635 do_layer_buttons(9); break;
1637 do_layer_buttons(10); break;
1639 do_layer_buttons(11); break;
1640 case ACCENTGRAVEKEY:
1641 do_layer_buttons(-1); break;
1644 if (G.vd->ndofmode == 0) {
1646 } else if (G.vd->ndofmode == 1) {
1656 if (G.vd->ndofmode > 2) /* we have currently 3 modes : 0 original, 1 fly, 2 transform */
1660 G.vd->ndoffilter =(G.vd->ndoffilter == 1 ? 0 : 1);
1662 allqueue(REDRAWHEADERS, 0);
1667 /* Redraw buttons window as well as view 3d (for floating panel) */
1669 allqueue(REDRAWVIEW3D, 0);
1670 allqueue(REDRAWBUTSEDIT, 0);
1674 if (U.flag & USER_NONUMPAD) {
1675 event= convert_for_nonumpad(event);
1680 /* Afterqueue events */
1685 BIF_view3d_previewrender(sa);
1689 /* Shift-Tabe handling (other cases are in toets) */
1690 if (G.qual == LR_SHIFTKEY)
1692 /* Snap toggle only when supported */
1693 if (BIF_snappingSupported())
1695 G.scene->snap_flag ^= SCE_SNAP;
1696 allqueue(REDRAWHEADERS, 0);
1701 /* LEFTMOUSE and RIGHTMOUSE event codes can be swapped above,
1702 * based on user preference USER_LMOUSESELECT
1705 if ((G.obedit) || !(G.f&(G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT|G_PARTICLEEDIT))) {
1708 else if (G.f & G_WEIGHTPAINT) {
1711 else if (G.f & G_VERTEXPAINT) {
1714 else if (G.f & G_TEXTUREPAINT) {
1715 imagepaint_paint(L_MOUSE, 1);
1717 else if (G.f & G_PARTICLEEDIT) {
1718 if(G.qual & LR_CTRLKEY)
1720 else if(!PE_brush_particles())
1725 handle_view_middlemouse();
1728 if((G.obedit) && (G.qual & LR_CTRLKEY)==0) {
1729 if(G.obedit->type==OB_MESH)
1731 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
1733 else if(G.obedit->type==OB_MBALL)
1735 else if(G.obedit->type==OB_LATTICE)
1737 else if(G.obedit->type==OB_ARMATURE)
1740 else if((G.obedit && G.obedit->type==OB_MESH) && (G.qual == (LR_CTRLKEY|LR_ALTKEY)))
1741 mouse_mesh(); /* loop select for 1 mousebutton dudes */
1742 else if((G.obedit && G.obedit->type==OB_MESH) && (G.qual == (LR_CTRLKEY|LR_ALTKEY|LR_SHIFTKEY)))
1743 mouse_mesh(); /* loop select for 1 mousebutton dudes */
1744 else if(G.qual==LR_CTRLKEY)
1745 mouse_select(); /* also allow in editmode, for vertex parenting */
1746 else if(FACESEL_PAINT_TEST)
1748 else if( G.f & (G_VERTEXPAINT|G_TEXTUREPAINT))
1750 else if( G.f & G_PARTICLEEDIT)
1751 PE_mouse_particles();
1753 mouse_select(); /* does poses too */
1756 handle_view_wheelup();
1759 case WHEELDOWNMOUSE:
1760 handle_view_wheeldown();
1765 if (G.vd->ndofmode == 0) {
1767 } else if (G.vd->ndofmode == 1) {
1777 if (G.vd->ndofmode > 2) /* we have currently 3 modes : 0 original, 1 fly, 2 transform */
1781 G.vd->ndoffilter =(G.vd->ndoffilter == 1 ? 0 : 1);
1783 allqueue(REDRAWHEADERS, 0);
1787 if(G.qual==LR_CTRLKEY) {
1790 else do_layer_buttons(0);
1794 if(G.qual==LR_CTRLKEY) {
1797 else do_layer_buttons(1);
1801 if(G.qual==LR_CTRLKEY) {
1804 else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
1805 if ( (G.obedit) && (G.obedit->type==OB_MESH) )
1806 select_faces_by_numverts(3);
1808 else do_layer_buttons(2);
1812 if(G.qual==LR_CTRLKEY) {
1815 else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
1816 if ( (G.obedit) && (G.obedit->type==OB_MESH) )
1817 select_faces_by_numverts(4);
1819 else do_layer_buttons(3);
1823 if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
1824 if ( (G.obedit) && (G.obedit->type==OB_MESH) )
1825 select_faces_by_numverts(5);
1828 else if(G.qual==LR_CTRLKEY) {}
1829 else do_layer_buttons(4);
1833 if(G.qual==LR_CTRLKEY) {}
1834 else do_layer_buttons(5);
1837 if(G.qual==LR_CTRLKEY) {}
1838 else do_layer_buttons(6);
1841 if(G.qual==LR_CTRLKEY) {}
1842 else do_layer_buttons(7);
1845 if(G.qual==LR_CTRLKEY) {}
1846 else do_layer_buttons(8);
1849 if(G.qual==LR_CTRLKEY) {}
1850 else do_layer_buttons(9);
1853 if(G.qual==LR_CTRLKEY) {}
1854 else do_layer_buttons(10);
1857 if(G.qual==LR_CTRLKEY) {}
1858 else do_layer_buttons(11);
1860 case ACCENTGRAVEKEY:
1861 do_layer_buttons(-1);
1865 if(G.qual == LR_CTRLKEY) {
1866 val= pupmenu("Manipulator%t|Enable/Disable|Translate|Rotate|Scale|Combo");
1868 if(val==1) v3d->twflag ^= V3D_USE_MANIPULATOR;
1870 if(val==2) v3d->twtype= V3D_MANIP_TRANSLATE;
1871 else if(val==3) v3d->twtype= V3D_MANIP_ROTATE;
1872 else if(val==4) v3d->twtype= V3D_MANIP_SCALE;
1873 else if(val==5) v3d->twtype= V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE|V3D_MANIP_SCALE;
1874 v3d->twflag |= V3D_USE_MANIPULATOR;
1879 else if(G.qual == LR_ALTKEY) {
1880 BIF_selectOrientation();
1887 if(G.qual == (LR_CTRLKEY|LR_ALTKEY)) {
1890 else if(G.obedit->type==OB_ARMATURE)
1891 align_selected_bones();
1893 else if(G.qual & LR_CTRLKEY) { /* also with shift! */
1896 else if((G.qual==LR_SHIFTKEY)) {
1901 if(G.obedit->type==OB_MESH)
1903 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
1905 else if(G.obedit->type==OB_MBALL)
1906 deselectall_mball();
1907 else if(G.obedit->type==OB_LATTICE)
1909 else if(G.obedit->type==OB_ARMATURE)
1911 if (BIF_fullSketchMode())
1913 BIF_selectAllSketch(1);
1917 deselectall_armature(1, 1); /* 1 == toggle */
1921 else if (ob && (ob->flag & OB_POSEMODE)){
1922 deselectall_posearmature(ob, 1, 1);
1925 if(FACESEL_PAINT_TEST) deselectall_tface();
1926 else if(G.f & G_PARTICLEEDIT) PE_deselectall();
1928 /* by design, the center of the active object
1929 * (which need not necessarily by selected) will
1930 * still be drawn as if it were selected.
1938 if(G.qual==LR_ALTKEY)
1939 view3d_edit_clipping(v3d);
1940 else if(G.qual==LR_SHIFTKEY)
1942 if(G.vd->persp==V3D_CAMOB)
1943 set_render_border();
1945 view3d_border_zoom();
1947 else if(G.qual==LR_CTRLKEY) {
1948 extern void pointcache_bake(PTCacheID *pid, int startframe);
1949 extern void pointcache_free(PTCacheID *pid, int cacheonly);
1950 extern void fluidsimBake(Object *ob);
1951 extern void fluidsimFreeBake(Object *ob);
1954 pupval= pupmenu("Physics Baking%t|Bake selected %x1|Free bake selected %x2|Free cache selected %x3");
1958 pointcache_bake(NULL, 0);
1959 /* also bake first domain of selected objects... */
1962 else if(pupval == 2) {
1963 pointcache_free(NULL, 0);
1964 fluidsimFreeBake(NULL);
1966 else if(pupval == 3)
1967 pointcache_free(NULL, 1);
1970 else if(G.qual== (LR_ALTKEY|LR_CTRLKEY))
1971 objects_bake_render_menu();
1976 if(G.qual==LR_CTRLKEY) {
1977 if(ob && (ob->flag & OB_POSEMODE))
1978 pose_copy_menu(); /* poseobject.c */
1982 else if(G.qual==(LR_ALTKEY|LR_SHIFTKEY))
1983 gpencil_convert_menu(); /* gpencil.c */
1984 else if(G.qual==LR_ALTKEY) {
1985 if(ob && (ob->flag & OB_POSEMODE))
1986 pose_clear_constraints(); /* poseobject.c */
1987 else if (BIF_fullSketchMode())
1989 BIF_convertSketch();
1992 convertmenu(); /* editobject.c */
1994 else if(G.qual==(LR_ALTKEY|LR_CTRLKEY))
1995 add_constraint(0); /* editconstraint.c, generic for objects and posemode */
1996 else if(G.qual==(LR_CTRLKEY|LR_SHIFTKEY)) {
1997 BIF_manageTransformOrientation(0, 1);
1998 allqueue(REDRAWVIEW3D, 0);
2000 else if((G.qual==LR_SHIFTKEY)) {
2002 curs= give_cursor();
2003 curs[0]=curs[1]=curs[2]= 0.0;
2004 allqueue(REDRAWVIEW3D, 0);
2006 else if((G.obedit) && ELEM(G.obedit->type, OB_CURVE, OB_SURF) ) {
2008 DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
2009 allqueue(REDRAWVIEW3D, 0);
2011 else if((G.qual==0)){
2012 if (G.vd->persp==V3D_CAMOB)
2013 /* center the camera offset */
2014 G.vd->camdx= G.vd->camdy= 0.0;
2016 /*non camera center*/
2018 curs= give_cursor();
2019 new_ofs[0]= -curs[0];
2020 new_ofs[1]= -curs[1];
2021 new_ofs[2]= -curs[2];
2022 smooth_view(G.vd, new_ofs, NULL, NULL, NULL);
2024 scrarea_queue_winredraw(curarea);
2028 if((G.qual==LR_SHIFTKEY)) {
2029 duplicate_context_selected();
2031 else if(G.qual==LR_ALTKEY) {
2032 if(ob && (ob->flag & OB_POSEMODE))
2033 error ("Duplicate not possible in posemode.");
2034 else if((G.obedit==NULL))
2037 else if(G.qual==LR_CTRLKEY) {
2038 imagestodisplist(); // removed
2040 else if((G.qual==0)){
2041 pupval= pupmenu("Draw mode%t|BoundBox %x1|Wire %x2|OpenGL Solid %x3|Shaded Solid %x4|Textured Solid %x5");
2043 G.vd->drawtype= pupval;
2052 if(G.obedit->type==OB_MESH)
2054 else if(G.obedit->type==OB_CURVE)
2056 else if(G.obedit->type==OB_SURF)
2058 else if(G.obedit->type==OB_ARMATURE)
2059 extrude_armature(0);
2062 else if (G.qual==LR_CTRLKEY) {
2063 if(G.obedit && G.obedit->type==OB_MESH)
2065 else if (FACESEL_PAINT_TEST)
2066 seam_mark_clear_tface(0);
2068 else if (G.qual==LR_SHIFTKEY) {
2069 if (G.obedit && G.obedit->type==OB_MESH &&
2070 !multires_level1_test()) {
2071 initTransform(TFM_CREASE, CTX_EDGE);
2074 else if (G.obedit && G.obedit->type==OB_ARMATURE) {
2075 extrude_armature(1);
2078 else if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY)) {
2079 if (G.obedit && G.obedit->type==OB_MESH &&
2080 !multires_level1_test()) {
2081 if (G.scene->selectmode & SCE_SELECT_VERTEX) {
2082 initTransform(TFM_BWEIGHT, CTX_NONE);
2085 initTransform(TFM_BWEIGHT, CTX_EDGE);
2093 if(G.obedit->type==OB_MESH) {
2094 if(G.qual == LR_CTRLKEY)
2096 else if((G.qual==LR_SHIFTKEY))
2098 else if(G.qual==LR_ALTKEY)
2100 else if(G.qual==(LR_CTRLKEY|LR_SHIFTKEY))
2105 (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
2106 select_linked_flat_faces();
2110 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
2113 else if(G.obedit->type == OB_ARMATURE) {
2114 fill_bones_armature();
2117 else if(G.qual==LR_CTRLKEY)
2119 else if((G.qual==LR_SHIFTKEY)) {
2120 if(ob && (ob->flag & OB_POSEMODE))
2121 pose_activate_flipped_bone();
2122 else if(G.f & G_WEIGHTPAINT)
2123 pose_activate_flipped_bone();
2124 else if(G.f & G_PARTICLEEDIT)
2125 PE_radialcontrol_start(RADIALCONTROL_STRENGTH);
2129 else if((G.qual==LR_ALTKEY)) {
2130 if(ob && (ob->flag & OB_POSEMODE))
2131 if(okee("Flip quaternion rotations"))
2135 if (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT)){
2136 G.f ^= G_FACESELECT;
2137 allqueue(REDRAWVIEW3D, 1);
2138 allqueue(REDRAWBUTSEDIT, 1);
2140 else if(G.f & G_PARTICLEEDIT) {
2141 PE_radialcontrol_start(RADIALCONTROL_SIZE);
2143 pupmenu("Note%t|UV/Face Select was removed. Editmode now allows UV editing, Add a UV layer or Unwrap (UKey)");
2149 if((G.qual == LR_CTRLKEY)) {
2151 if(ELEM(G.obedit->type, OB_MESH, OB_LATTICE))
2152 vgroup_assign_with_menu();
2154 else if(ob && (ob->flag & OB_POSEMODE))
2155 pgroup_operation_with_menu();
2157 group_operation_with_menu();
2159 else if((G.qual == (LR_CTRLKEY|LR_SHIFTKEY))) {
2161 if(ELEM(G.obedit->type, OB_MESH, OB_LATTICE))
2162 vgroup_operation_with_menu();
2165 else if((G.qual==LR_SHIFTKEY)) {
2167 if(G.obedit->type==OB_MESH)
2168 select_mesh_group_menu();
2170 else if(ob && (ob->flag & OB_POSEMODE))
2171 pose_select_grouped_menu();
2173 select_object_grouped_menu();
2175 else if((G.obedit==0) && G.qual==LR_ALTKEY) {
2176 if(okee("Clear location")) {
2180 else if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
2181 v3d->twtype= V3D_MANIP_TRANSLATE;
2184 else if((G.qual==0)) {
2185 initTransform(TFM_TRANSLATION, CTX_NONE);
2191 if(G.obedit->type==OB_MESH) {
2192 if(G.qual==LR_CTRLKEY)
2194 else if(G.qual==LR_ALTKEY)
2196 else if((G.qual==LR_SHIFTKEY))
2198 else if((G.qual==0))
2201 else if(G.obedit->type== OB_SURF) {
2202 if(G.qual==LR_CTRLKEY)
2204 else if(G.qual==LR_ALTKEY)
2206 else if((G.qual==LR_SHIFTKEY))
2208 else if((G.qual==0))
2211 else if(G.obedit->type==OB_CURVE) {
2212 if(G.qual==LR_CTRLKEY)
2214 else if(G.qual==LR_ALTKEY)
2216 /* should be G.qual==LR_SHIFTKEY, but that is taken fro handles already */
2217 else if((G.qual==(LR_ALTKEY|LR_SHIFTKEY)))
2219 /* should be G.qual==0, but that is taken for handles already */
2220 else if((G.qual==(LR_ALTKEY|LR_CTRLKEY)))
2223 if(G.qual==LR_CTRLKEY) /* conflict */
2224 autocalchandlesNurb_all(1); /* flag=1, selected */
2225 else if((G.qual==LR_SHIFTKEY))
2227 else if((G.qual==0))
2230 DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
2231 BIF_undo_push("Handle change");
2232 allqueue(REDRAWVIEW3D, 0);
2235 else if(G.obedit->type==OB_LATTICE) {
2236 if(G.qual==LR_CTRLKEY) add_hook_menu();
2238 else if(G.obedit->type==OB_MBALL) {
2239 if(G.qual==LR_ALTKEY)
2241 else if((G.qual==LR_SHIFTKEY))
2243 else if((G.qual==0))
2246 else if(G.obedit->type==OB_ARMATURE) {
2248 hide_selected_armature_bones();
2249 else if (G.qual==LR_SHIFTKEY)
2250 hide_unselected_armature_bones();
2251 else if (G.qual==LR_ALTKEY)
2252 show_all_armature_bones();
2255 else if(FACESEL_PAINT_TEST)
2257 else if(G.f & G_PARTICLEEDIT) {
2258 if(G.qual == LR_ALTKEY)
2260 else if(G.qual == LR_SHIFTKEY)
2262 else if(G.qual == 0)
2265 else if(ob && (ob->flag & OB_POSEMODE)) {
2267 hide_selected_pose_bones();
2268 else if (G.qual==LR_SHIFTKEY)
2269 hide_unselected_pose_bones();
2270 else if (G.qual==LR_ALTKEY)
2271 show_all_pose_bones();
2273 /* Object mode only, other modes are accounted for above */
2274 else if ((G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
2275 if(G.qual==LR_CTRLKEY)hookmenu();
2276 else if(G.qual==LR_ALTKEY) show_objects();
2277 else if(G.qual==LR_SHIFTKEY) hide_objects(0);
2278 else hide_objects(1);
2282 if(G.qual==LR_CTRLKEY) {
2283 if((ob) && (ob->flag & OB_POSEMODE) && (ob->type==OB_ARMATURE))
2284 deselectall_posearmature(ob, 3, 1);
2285 else if(ob && G.obedit) {
2286 if(G.obedit->type == OB_ARMATURE)
2287 deselectall_armature(3, 1);
2294 else if(G.qual==(LR_CTRLKEY|LR_ALTKEY)) {
2295 if(ob && (ob->flag & OB_POSEMODE) && ob->type==OB_ARMATURE)
2298 else if(G.qual==LR_SHIFTKEY) {
2299 if(ob && (ob->flag & OB_POSEMODE) && ob->type==OB_ARMATURE)
2305 if(G.qual==LR_CTRLKEY) {
2309 else if ((G.obedit) && ELEM(G.obedit->type, OB_CURVE, OB_SURF)) {
2312 error("Can't join unless there is an active object");
2317 if(G.obedit->type==OB_MESH) {
2325 if (G.obedit->type==OB_MESH) {
2326 if (G.qual==LR_SHIFTKEY)
2327 KnifeSubdivide(KNIFE_PROMPT);
2331 else if(G.obedit->type==OB_SURF)
2335 if((G.qual==LR_SHIFTKEY)) {
2336 if(FACESEL_PAINT_TEST)
2337 if (G.f & G_WEIGHTPAINT)
2338 clear_wpaint_selectedfaces();
2340 clear_vpaint_selectedfaces();
2341 else if(G.f & G_VERTEXPAINT)
2344 select_select_keys();
2353 if(G.obedit->type==OB_MESH) {
2354 if (G.qual & LR_CTRLKEY) {
2355 if ((G.scene->selectmode & SCE_SELECT_FACE) == 0) {
2356 selectconnected_mesh_all(); /* normal select linked */
2358 selectconnected_delimit_mesh_all(); /* select linked with edge crease delimiting */
2361 if ((G.scene->selectmode & SCE_SELECT_FACE) == 0) {
2362 selectconnected_mesh();
2364 selectconnected_delimit_mesh();
2368 if(G.obedit->type==OB_ARMATURE)
2369 selectconnected_armature();
2370 else if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
2371 selectconnected_nurb();
2373 else if(ob && (ob->flag & OB_POSEMODE)) {
2374 if (G.qual == LR_CTRLKEY)
2375 poselib_preview_poses(ob, 0);
2376 else if (G.qual == LR_SHIFTKEY)
2377 poselib_add_current_pose(ob, 0);
2378 else if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY))
2379 poselib_rename_pose(ob);
2380 else if (G.qual == LR_ALTKEY)
2381 poselib_remove_pose(ob, NULL);
2383 selectconnected_posearmature();
2386 if(FACESEL_PAINT_TEST) {
2388 select_linked_tfaces(0);
2389 else if((G.qual==LR_SHIFTKEY))
2390 select_linked_tfaces(1);
2391 else if(G.qual==LR_CTRLKEY)
2392 select_linked_tfaces(2);
2394 else if(G.f & G_PARTICLEEDIT) {
2401 else if((G.qual==LR_SHIFTKEY))
2403 else if(G.qual==LR_CTRLKEY)
2410 if (ELEM(G.qual, 0, LR_SHIFTKEY) && (G.obedit->type==OB_ARMATURE)) {
2413 else if (G.qual==LR_ALTKEY) {
2414 if (G.obedit->type == OB_MESH) {
2416 DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
2418 else if (G.obedit->type == OB_ARMATURE) {
2422 else if ((G.qual==0) || (G.qual==LR_CTRLKEY)) {
2425 else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
2426 if(G.obedit->type==OB_MESH) select_non_manifold();
2429 else if(G.qual & LR_CTRLKEY) {
2432 else if(G.qual==0 || G.qual==LR_SHIFTKEY) {
2433 if(ob && (ob->flag & OB_POSEMODE))
2441 toggle_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
2442 allqueue(REDRAWVIEW3D, 0);
2445 switch (G.obedit->type){
2447 if(G.qual==LR_CTRLKEY) {
2448 pupval= pupmenu("Recalculate Bone Roll Angles%t|Clear Roll (Z-Axis Up) %x1|Align Z-Axis to 3D-Cursor %x2");
2450 auto_align_armature(pupval - 1);
2451 allqueue(REDRAWVIEW3D, 0);
2456 if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
2457 if(okee("Recalculate normals inside")) {
2459 allqueue(REDRAWVIEW3D, 0);
2460 BIF_undo_push("Recalculate normals inside");
2463 else if(G.qual==LR_CTRLKEY){
2464 if(okee("Recalculate normals outside")) {
2466 allqueue(REDRAWVIEW3D, 0);
2467 BIF_undo_push("Recalculate normals outside");
2476 if (G.obedit || G.f&G_PARTICLEEDIT) {
2477 if (G.qual==LR_SHIFTKEY) {
2478 G.scene->prop_mode = (G.scene->prop_mode+1)%7;
2479 allqueue(REDRAWHEADERS, 0);
2481 else if((G.qual==LR_ALTKEY)) {
2482 if(G.scene->proportional==2) G.scene->proportional= 1;
2483 else G.scene->proportional= 2;
2484 allqueue(REDRAWHEADERS, 0);
2486 else if((G.qual==0)) {
2487 G.scene->proportional= !G.scene->proportional;
2488 allqueue(REDRAWHEADERS, 0);
2491 else if((G.qual==LR_SHIFTKEY || G.qual==(LR_ALTKEY|LR_SHIFTKEY))) {
2492 flip_subdivison(-1);
2494 else if(G.qual==LR_ALTKEY) {
2495 if(okee("Clear origin")) {
2503 if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
2504 if(G.obedit->type==OB_ARMATURE)
2510 else if(G.qual==LR_ALTKEY && G.obedit->type==OB_ARMATURE)
2511 clear_bone_parent();
2512 else if((G.qual==0) && (G.obedit->type==OB_ARMATURE))
2513 armature_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
2514 else if((G.qual==(LR_CTRLKEY|LR_ALTKEY)) && (G.obedit->type==OB_ARMATURE))
2515 separate_armature();
2516 else if((G.qual==0) && G.obedit->type==OB_MESH)
2518 else if ((G.qual==0) && ELEM(G.obedit->type, OB_CURVE, OB_SURF))
2520 else if (G.qual==LR_SHIFTKEY) {
2521 initTransform(TFM_PUSHPULL, CTX_NONE);
2525 else if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY))
2527 else if(G.qual==LR_SHIFTKEY) {
2528 toggle_blockhandler(curarea, VIEW3D_HANDLER_PREVIEW, 0);
2531 else if(G.qual==(LR_ALTKEY|LR_SHIFTKEY)) {
2532 initTransform(TFM_PUSHPULL, CTX_NONE);
2535 else if(G.qual==LR_ALTKEY)
2537 else if(G.qual==(LR_ALTKEY|LR_CTRLKEY))
2539 else if(G.qual==(LR_ALTKEY|LR_CTRLKEY|LR_SHIFTKEY)) {
2540 start_RBSimulation();
2542 else if((G.qual==0) && (OBACT) && (OBACT->type==OB_ARMATURE) && (OBACT->flag & OB_POSEMODE))
2543 pose_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
2544 else if((G.qual==0)) {
2549 if((G.obedit==0) && G.qual==LR_ALTKEY) {
2550 if(okee("Clear rotation")) {
2554 else if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
2555 v3d->twtype= V3D_MANIP_ROTATE;
2558 else if (G.obedit) {
2559 if((G.qual==LR_SHIFTKEY)) {
2560 if ELEM(G.obedit->type, OB_CURVE, OB_SURF)
2563 else if(G.qual==LR_CTRLKEY) {
2564 if (G.obedit->type==OB_MESH) {
2566 BIF_undo_push("Cut Edgeloop");
2568 else if (G.obedit->type==OB_ARMATURE) {
2569 initTransform(TFM_BONE_ROLL, CTX_NONE);
2573 else if((G.qual==0)) {
2574 initTransform(TFM_ROTATION, CTX_NONE);
2578 else if((G.qual==0)) {
2579 initTransform(TFM_ROTATION, CTX_NONE);
2584 if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
2585 v3d->twtype= V3D_MANIP_SCALE;
2590 if(G.qual==LR_ALTKEY) {
2591 if(G.obedit->type==OB_ARMATURE) {
2592 initTransform(TFM_BONESIZE, CTX_NONE);
2594 else if (G.obedit->type==OB_CURVE) {
2595 initTransform(TFM_CURVE_SHRINKFATTEN, CTX_NONE);
2597 initTransform(TFM_SHRINKFATTEN, CTX_NONE);
2601 else if(G.qual==LR_CTRLKEY) {
2602 initTransform(TFM_SHEAR, CTX_NONE);
2605 else if(G.qual==LR_SHIFTKEY)
2607 else if(G.qual==0) {
2608 if(G.obedit->type==OB_ARMATURE) {
2609 bArmature *arm= G.obedit->data;
2610 if(arm->drawtype==ARM_ENVELOPE)
2611 initTransform(TFM_BONE_ENVELOPE, CTX_NONE);
2613 initTransform(TFM_RESIZE, CTX_NONE);
2616 initTransform(TFM_RESIZE, CTX_NONE);
2619 else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)){
2620 initTransform(TFM_TOSPHERE, CTX_NONE);
2623 if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
2624 if(G.obedit->type==OB_MESH) select_sharp_edges();
2627 else if(G.qual==LR_ALTKEY) {
2628 if(G.f & G_WEIGHTPAINT)
2630 if(ob && (ob->flag & OB_POSEMODE)) {
2631 bArmature *arm= ob->data;
2632 if( arm->drawtype==ARM_ENVELOPE) {
2633 initTransform(TFM_BONESIZE, CTX_NONE);
2639 if(okee("Clear scale")) {
2643 else if(G.qual==LR_SHIFTKEY) {
2646 else if((G.qual==0)) {
2647 initTransform(TFM_RESIZE, CTX_NONE);
2650 else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) {
2651 initTransform(TFM_TOSPHERE, CTX_NONE);
2654 else if(G.qual==(LR_CTRLKEY|LR_ALTKEY|LR_SHIFTKEY)) {