Revision: 17969 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17969 Author: ton Date: 2008-12-20 13:36:14 +0100 (Sat, 20 Dec 2008)
Log Message: ----------- 2.5 - Ported over view3d header buttons. Most of the options don't work :) but some do! - Fixed makefiles for new animation module - added icon definitions in resources to match current trunk. Modified Paths: -------------- branches/blender2.5/blender/source/Makefile branches/blender2.5/blender/source/blender/editors/Makefile branches/blender2.5/blender/source/blender/editors/include/UI_resources.h branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c branches/blender2.5/blender/source/blender/windowmanager/intern/wm_init_exit.c Modified: branches/blender2.5/blender/source/Makefile =================================================================== --- branches/blender2.5/blender/source/Makefile 2008-12-20 11:33:16 UTC (rev 17968) +++ branches/blender2.5/blender/source/Makefile 2008-12-20 12:36:14 UTC (rev 17969) @@ -251,6 +251,7 @@ PULIB += $(OCGDIR)/blender/ed_time/libed_time.a PULIB += $(OCGDIR)/blender/ed_view3d/libed_view3d.a PULIB += $(OCGDIR)/blender/ed_interface/libed_interface.a +PULIB += $(OCGDIR)/blender/ed_animation/libed_animation.a PULIB += $(OCGDIR)/blender/ed_util/libed_util.a PULIB += $(OCGDIR)/blender/ed_datafiles/libed_datafiles.a PULIB += $(OCGDIR)/blender/ed_screen/libed_screen.a Modified: branches/blender2.5/blender/source/blender/editors/Makefile =================================================================== --- branches/blender2.5/blender/source/blender/editors/Makefile 2008-12-20 11:33:16 UTC (rev 17968) +++ branches/blender2.5/blender/source/blender/editors/Makefile 2008-12-20 12:36:14 UTC (rev 17969) @@ -29,6 +29,6 @@ # Bounces make to subdirectories. SOURCEDIR = source/blender/editors -DIRS = datafiles screen space_outliner space_time space_view3d interface util space_api space_ipo space_image space_node space_buttons space_info space_file space_sound space_action space_nla space_script space_text space_sequencer +DIRS = animation datafiles screen space_outliner space_time space_view3d interface util space_api space_ipo space_image space_node space_buttons space_info space_file space_sound space_action space_nla space_script space_text space_sequencer include nan_subdirs.mk Modified: branches/blender2.5/blender/source/blender/editors/include/UI_resources.h =================================================================== --- branches/blender2.5/blender/source/blender/editors/include/UI_resources.h 2008-12-20 11:33:16 UTC (rev 17968) +++ branches/blender2.5/blender/source/blender/editors/include/UI_resources.h 2008-12-20 12:36:14 UTC (rev 17969) @@ -84,11 +84,11 @@ ICON_SHORTDISPLAY, ICON_TRIA_DOWN, ICON_TRIA_RIGHT, - ICON_BLANK7, - ICON_BLANK8, - ICON_BLANK9, - ICON_BLANK10, - + ICON_NDOF_TURN, + ICON_NDOF_FLY, + ICON_NDOF_TRANS, + ICON_NDOF_DOM, + ICON_VIEW_AXIS_ALL, ICON_VIEW_AXIS_NONE, ICON_VIEW_AXIS_NONE2, @@ -269,8 +269,8 @@ ICON_WINDOW_WINDOW, ICON_PANEL_CLOSE, ICON_PHYSICS, - ICON_BLANK36, - ICON_BLANK37, + ICON_LAYER_USED, + ICON_LAYER_ACTIVE, ICON_BLANK38, ICON_BLENDER, @@ -296,7 +296,7 @@ ICON_ARMATURE_DEHLT, ICON_SNAP_GEAR, ICON_SNAP_GEO, - ICON_BLANK41, + ICON_SNAP_NORMAL, ICON_BLANK42, ICON_SMOOTHCURVE, Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c =================================================================== --- branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c 2008-12-20 11:33:16 UTC (rev 17968) +++ branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c 2008-12-20 12:36:14 UTC (rev 17969) @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * The Original Code is Copyright (C) 2008 Blender Foundation. + * The Original Code is Copyright (C) 2004-2008 Blender Foundation. * All rights reserved. * * @@ -28,19 +28,39 @@ #include <string.h> #include <stdio.h> +#include <stdlib.h> +#include "DNA_armature_types.h" +#include "DNA_ID.h" +#include "DNA_image_types.h" +#include "DNA_meshdata_types.h" +#include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_space_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" +#include "DNA_texture_types.h" +#include "DNA_userdef_types.h" /* U.smooth_viewtx */ +#include "DNA_view3d_types.h" #include "DNA_windowmanager_types.h" #include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" - +#include "BKE_action.h" #include "BKE_context.h" +#include "BKE_curve.h" +#include "BKE_depsgraph.h" +#include "BKE_displist.h" +#include "BKE_effect.h" +#include "BKE_global.h" +#include "BKE_image.h" +#include "BKE_library.h" +#include "BKE_main.h" +#include "BKE_mesh.h" +#include "BKE_modifier.h" +#include "BKE_particle.h" #include "BKE_screen.h" +#include "BKE_utildefines.h" /* for VECCOPY */ #include "ED_screen.h" #include "ED_util.h" @@ -52,78 +72,5928 @@ #include "BIF_gl.h" #include "BIF_glutil.h" +#include "BLI_arithb.h" +#include "BLI_blenlib.h" +#include "BLI_editVert.h" + #include "UI_interface.h" +#include "UI_interface_icons.h" #include "UI_resources.h" #include "UI_view2d.h" +#include "BMF_Api.h" + #include "view3d_intern.h" -/* ************************ header area region *********************** */ +/* View3d->modeselect + * This is a bit of a dodgy hack to enable a 'mode' menu with icons+labels + * rather than those buttons. + * I know the implementation's not good - it's an experiment to see if this + * approach would work well + * + * This can be cleaned when I make some new 'mode' icons. + */ -static void do_viewmenu(bContext *C, void *arg, int event) +#define V3D_OBJECTMODE_SEL ICON_OBJECT +#define V3D_EDITMODE_SEL ICON_EDITMODE_HLT +#define V3D_SCULPTMODE_SEL ICON_SCULPTMODE_HLT +#define V3D_FACESELECT_SEL ICON_FACESEL_HLT /* this is not a mode anymore - just a switch */ +#define V3D_VERTEXPAINTMODE_SEL ICON_VPAINT_HLT +#define V3D_TEXTUREPAINTMODE_SEL ICON_TPAINT_HLT +#define V3D_WEIGHTPAINTMODE_SEL ICON_WPAINT_HLT +#define V3D_POSEMODE_SEL ICON_POSE_HLT +#define V3D_PARTICLEEDITMODE_SEL ICON_ANIM + +#define TEST_EDITMESH if(G.obedit==0) return; \ + if( (v3d->lay & G.obedit->lay)==0 ) return; + +/* XXX port over */ +void handle_view3d_lock(void) {} +void allqueue(int x, int y) {} +void persptoetsen(int x) {} +void fly(void) {} +void editmesh_align_view_to_selected(void *x, int y) {} +void play_anim(int x) {} +void add_blockhandler(void *x, int y, int z) {} +void toggle_blockhandler(void *x, int y, int z) {} +void view3d_edit_clipping(void *x) {} +void view3d_border_zoom(void) {} +void selectlinks(void) {} +void countall(void) {} +void select_object_grouped() {} +void borderselect() {} +int BIF_snappingSupported() {return 1;} +void BIF_undo_push() {} +int retopo_mesh_paint_check() {return 0;} +int object_data_is_libdata() {return 0;} + +/* view3d handler codes */ +#define VIEW3D_HANDLER_BACKGROUND 1 +#define VIEW3D_HANDLER_PROPERTIES 2 +#define VIEW3D_HANDLER_OBJECT 3 +#define VIEW3D_HANDLER_PREVIEW 4 +#define VIEW3D_HANDLER_MULTIRES 5 +#define VIEW3D_HANDLER_TRANSFORM 6 +#define VIEW3D_HANDLER_GREASEPENCIL 7 + +/* end XXX ************* */ + +static void do_view3d_buttons(bContext *C, void *arg, int event); + +#define B_SCENELOCK 101 +#define B_FULL 102 +#define B_HOME 103 +#define B_VIEWBUT 104 +#define B_PERSP 105 +#define B_VIEWRENDER 106 +#define B_STARTGAME 107 +#define B_MODESELECT 108 +#define B_AROUND 109 +#define B_SEL_VERT 110 +#define B_SEL_EDGE 111 +#define B_SEL_FACE 112 +#define B_SEL_PATH 113 +#define B_SEL_POINT 114 +#define B_SEL_END 115 +#define B_MAN_TRANS 116 +#define B_MAN_ROT 117 +#define B_MAN_SCALE 118 +#define B_NDOF 119 +#define B_MAN_MODE 120 +#define B_VIEW_BUTSEDIT 121 +#define B_REDR 122 +#define B_NOP 123 +#define B_ACTCOPY 124 +#define B_ACTPASTE 125 +#define B_ACTPASTEFLIP 126 + +#define B_LAY 201 + + +/* temp hack to get the region window */ +static ARegion *ed_regionwin(ScrArea *sa) { + ARegion *ar; + for(ar= sa->regionbase.first; ar; ar= ar->next) + if(ar->regiontype==RGN_TYPE_WINDOW) + return ar; + return NULL; +} + +/* XXX; all this context stuff... should become operator */ +void do_layer_buttons(bContext *C, short event) +{ + wmWindow *win= CTX_wm_window(C); + Scene *scene= CTX_data_scene(C); + ScrArea *sa= CTX_wm_area(C); + View3D *v3d= sa->spacedata.first; + static int oldlay= 1; + short shift, alt, ctrl; + shift= win->eventstate->shift; + alt= win->eventstate->alt; + ctrl= win->eventstate->ctrl; + + if(v3d==0) return; + if(v3d->localview) return; + + if(event==-1 && ctrl) { + v3d->scenelock= !v3d->scenelock; + do_view3d_buttons(C, NULL, B_SCENELOCK); + } else if (event<0) { + if(v3d->lay== (1<<20)-1) { + if(event==-2 || shift) v3d->lay= oldlay; + } + else { + oldlay= v3d->lay; + v3d->lay= (1<<20)-1; + } + + if(v3d->scenelock) handle_view3d_lock(); + + /* new layers might need unflushed events events */ + DAG_scene_update_flags(scene, v3d->lay); /* tags all that moves and flushes */ + } + else { + if(alt) { + if(event<11) event+= 10; + } + if(shift) { + if(v3d->lay & (1<<event)) v3d->lay -= (1<<event); + else v3d->lay += (1<<event); + } + do_view3d_buttons(C, NULL, event+B_LAY); + } + ED_area_tag_redraw(sa); + + if(sa->spacetype==SPACE_OOPS) allqueue(REDRAWVIEW3D, 1); /* 1==also do headwin */ + if(v3d->drawtype == OB_SHADED) reshadeall_displist(); + allqueue(REDRAWNLA, 0); } -static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused) +static void do_view3d_view_camerasmenu(bContext *C, void *arg, int event) { - ScrArea *curarea= CTX_wm_area(C); + View3D *v3d; + Base *base; + int i=1; + + if (event == 1) { + /* Set Active Object as Active Camera */ + /* XXX ugly hack alert */ +// G.qual |= LR_CTRLKEY; + persptoetsen(PAD0); +// G.qual &= ~LR_CTRLKEY; + } else { + /* store settings of current view before allowing overwriting with camera view */ + /* this is a copy of the code in toets.c */ + if(v3d->persp != V3D_CAMOB) { + QUATCOPY(v3d->lviewquat, v3d->viewquat); + v3d->lview= v3d->view; + v3d->lpersp= v3d->persp; + } + + for( base = FIRSTBASE; base; base = base->next ) { + if (base->object->type == OB_CAMERA) { + i++; + + if (event==i) { + + if (v3d->camera == base->object && v3d->persp==V3D_CAMOB) + return; + + if (U.smooth_viewtx) { + /* move 3d view to camera view */ + float orig_ofs[3], orig_lens = v3d->lens; + VECCOPY(orig_ofs, v3d->ofs); + + if (v3d->camera && v3d->persp==V3D_CAMOB) + view_settings_from_ob(v3d->camera, v3d->ofs, v3d->viewquat, &v3d->dist, &v3d->lens); + + v3d->camera = base->object; + handle_view3d_lock(); + v3d->persp= V3D_CAMOB; + v3d->view= 0; + + smooth_view_to_camera(v3d); + + /* restore values */ + VECCOPY(v3d->ofs, orig_ofs); + v3d->lens = orig_lens; + } else { + v3d->camera= base->object; + handle_view3d_lock(); + v3d->persp= V3D_CAMOB; @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs