diff options
author | Arystanbek Dyussenov <arystan.d@gmail.com> | 2009-09-15 22:01:18 +0400 |
---|---|---|
committer | Arystanbek Dyussenov <arystan.d@gmail.com> | 2009-09-15 22:01:18 +0400 |
commit | 816377cc02fe5dd4be945c0f3d415861114b4980 (patch) | |
tree | 306e9d1363aa66bc919e43b80b3380fab9f60ea9 /source/blender/editors/space_view3d | |
parent | c8af263e5d8d9d41a757e8438cdcf3b64d57e0c0 (diff) | |
parent | ee768ada680ce0a8aa184c882005c0ef1c0140fb (diff) |
Undo revision 23130 which was a merge with 2.5, a messy one because I did something wrong (`svn status` output: http://www.pasteall.org/7887).soc-2009-kazanbas
The command: svn merge -r 23130:23129 https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-kazanbas
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/SConscript | 1 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 573 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawvolume.c | 350 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 49 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_buttons.c | 62 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_header.c | 1291 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_intern.h | 3 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 25 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 19 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_toolbar.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 84 |
15 files changed, 1779 insertions, 716 deletions
diff --git a/source/blender/editors/space_view3d/SConscript b/source/blender/editors/space_view3d/SConscript index 057c98a1d49..4eb9f3f5ecb 100644 --- a/source/blender/editors/space_view3d/SConscript +++ b/source/blender/editors/space_view3d/SConscript @@ -9,7 +9,6 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../render/extern/include #/intern/guardedalloc' incs += ' ../../gpu ../../makesrna ../../blenfont' incs += ' #/intern/smoke/extern' -incs += ' #source/kernel/gen_system' if env['WITH_BF_GAMEENGINE']: defs.append('GAMEBLENDER=1') diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index fa810677fe8..a5718386554 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1816,7 +1816,7 @@ static void draw_pose_channels(Scene *scene, View3D *v3d, RegionView3D *rv3d, Ba if ( (arm->flag & ARM_DRAWAXES) && (arm->flag & ARM_POSEMODE) ) { glPushMatrix(); glMultMatrixf(pchan->pose_mat); - glTranslatef(0.0f, pchan->bone->length, 0.0f); + //glTranslatef(0.0f, pchan->bone->length, 0.0f); drawaxes(0.25f*pchan->bone->length, 0, OB_ARROWS); glPopMatrix(); } @@ -2000,7 +2000,7 @@ static void draw_ebones(View3D *v3d, RegionView3D *rv3d, Object *ob, int dt) if (arm->flag & ARM_DRAWAXES) { glPushMatrix(); set_matrix_editbone(eBone); - glTranslatef(0.0f, eBone->length, 0.0f); + //glTranslatef(0.0f, eBone->length, 0.0f); drawaxes(eBone->length*0.25f, 0, OB_ARROWS); glPopMatrix(); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 7ed029f3eaf..466b55ba862 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -37,7 +37,7 @@ #include "IMB_imbuf.h" - +#include "MTC_matrixops.h" #include "DNA_armature_types.h" #include "DNA_boid_types.h" @@ -89,7 +89,6 @@ #include "BKE_object.h" #include "BKE_paint.h" #include "BKE_particle.h" -#include "BKE_pointcache.h" #include "BKE_property.h" #include "BKE_smoke.h" #include "BKE_unit.h" @@ -1124,7 +1123,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob Mat4Ortho(vec); wmMultMatrix(vec); - Mat4SwapMat4(rv3d->persmat, tmat); + MTC_Mat4SwapMat4(rv3d->persmat, tmat); wmGetSingleMatrix(rv3d->persmat); if(cam->flag & CAM_SHOWLIMITS) { @@ -1137,7 +1136,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob if(cam->flag & CAM_SHOWMIST) if(wrld) draw_limit_line(wrld->miststa, wrld->miststa+wrld->mistdist, 0xFFFFFF); - Mat4SwapMat4(rv3d->persmat, tmat); + MTC_Mat4SwapMat4(rv3d->persmat, tmat); } } } @@ -1198,7 +1197,7 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i if(use_wcol) { float col[3]; - MDeformWeight *mdw= ED_vgroup_weight_get (lt->dvert+index, use_wcol-1); + MDeformWeight *mdw= get_defweight (lt->dvert+index, use_wcol-1); weight_to_rgb(mdw?mdw->weight:0.0f, col, col+1, col+2); glColor3fv(col); @@ -1392,13 +1391,12 @@ void nurbs_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, Nurb int i; for (nu= cu->editnurb->first; nu; nu=nu->next) { - if(nu->type == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { for (i=0; i<nu->pntsu; i++) { BezTriple *bezt = &nu->bezt[i]; if(bezt->hide==0) { - - if(cu->drawflag & CU_HIDE_HANDLES) { + if (G.f & G_HIDDENHANDLES) { view3d_project_short_clip(vc->ar, bezt->vec[1], s); if (s[0] != IS_CLIPPED) func(userData, nu, NULL, bezt, 1, s[0], s[1]); @@ -2798,7 +2796,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas if(solid) { dl= lb->first; if(dl==NULL) return 1; - + if(dl->nors==0) addnormalsDispList(ob, lb); index3_nors_incr= 0; @@ -2839,7 +2837,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } break; case OB_SURF: - + lb= &((Curve *)ob->data)->disp; if(solid) { @@ -3140,7 +3138,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv { Object *ob=base->object; ParticleSystemModifierData *psmd; - ParticleEditSettings *pset = PE_settings(scene); ParticleSettings *part; ParticleData *pars, *pa; ParticleKey state, *states=0; @@ -3169,8 +3166,9 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if(pars==0) return; - /* don't draw normal paths in edit mode */ - if(psys_in_edit_mode(scene, psys) && (pset->flag & PE_DRAW_PART)==0) + // XXX what logic is this? + if(!scene->obedit && psys_in_edit_mode(scene, psys) + && psys->flag & PSYS_HAIR_DONE && part->draw_as==PART_DRAW_PATH) return; if(part->draw_as==PART_DRAW_NOT) return; @@ -3374,9 +3372,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv pa_birthtime=pa->time; pa_dietime = pa->dietime; pa_size=pa->size; - if(part->phystype==PART_PHYS_BOIDS) { - pa_health = pa->boid->data.health; - } + if(part->phystype==PART_PHYS_BOIDS) + pa_health = pa->boid->health; else pa_health = -1.0; @@ -3411,10 +3408,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv } #endif // XXX old animation system - BLI_srandom(psys->seed+a); - - r_tilt = 2.0f*(BLI_frand() - 0.5f); - r_length = BLI_frand(); + r_tilt = 1.0f + pa->r_ave[0]; + r_length = 0.5f * (1.0f + pa->r_ave[1]); } else{ ChildParticle *cpa= &psys->child[a-totpart]; @@ -3714,27 +3709,33 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv wmLoadMatrix(rv3d->viewmat); } -static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, PTCacheEdit *edit, int dt) +static void draw_particle_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, ParticleSystem *psys, int dt) { - ParticleCacheKey **cache, *path, *pkey; - PTCacheEditPoint *point; - PTCacheEditKey *key; + ParticleEdit *edit = psys->edit; + ParticleData *pa; + ParticleCacheKey **path; + ParticleEditKey *key; ParticleEditSettings *pset = PE_settings(scene); - int i, k, totpoint = edit->totpoint, timed = pset->flag & PE_FADE_TIME ? pset->fade_frames : 0; - int steps; + int i, k, totpart = psys->totpart, totchild=0, timed = pset->draw_timed; char nosel[4], sel[4]; float sel_col[3]; float nosel_col[3]; - float *pathcol = NULL, *pcol; + char val[32]; /* create path and child path cache if it doesn't exist already */ - if(edit->pathcache==0) - psys_cache_edit_paths(scene, ob, edit, CFRA); - - if(edit->pathcache==0) + if(psys->pathcache==0){ + PE_hide_keys_time(scene, psys,CFRA); + psys_cache_paths(scene, ob, psys, CFRA,0); + } + if(psys->pathcache==0) return; - PE_hide_keys_time(scene, edit, CFRA); + if(pset->flag & PE_SHOW_CHILD && psys->part->draw_as == PART_DRAW_PATH) { + if(psys->childcache==0) + psys_cache_child_paths(scene, ob, psys, CFRA, 0); + } + else if(!(pset->flag & PE_SHOW_CHILD) && psys->childcache) + free_child_path_cache(psys); /* opengl setup */ if((v3d->flag & V3D_ZBUF_SELECT)==0) @@ -3750,115 +3751,129 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj nosel_col[1]=(float)nosel[1]/255.0f; nosel_col[2]=(float)nosel[2]/255.0f; + if(psys->childcache) + totchild = psys->totchildcache; + /* draw paths */ - if(timed) { + if(timed) glEnable(GL_BLEND); - steps = (*edit->pathcache)->steps + 1; - pathcol = MEM_callocN(steps*4*sizeof(float), "particle path color data"); - } glEnableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); - glEnableClientState(GL_COLOR_ARRAY); - glEnable(GL_COLOR_MATERIAL); - glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); + if(dt > OB_WIRE) { + /* solid shaded with lighting */ + glEnableClientState(GL_NORMAL_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); - cache=edit->pathcache; - for(i=0; i<totpoint; i++){ - path = cache[i]; - glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co); + glEnable(GL_COLOR_MATERIAL); + glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); + } + else { + /* flat wire color */ + glDisableClientState(GL_NORMAL_ARRAY); + glDisable(GL_LIGHTING); + UI_ThemeColor(TH_WIRE); + } - if(timed) { - for(k=0, pcol=pathcol, pkey=path; k<steps; k++, pkey++, pcol+=4){ - VECCOPY(pcol, pkey->col); - pcol[3] = 1.0f - fabs((float)CFRA - pkey->time)/(float)pset->fade_frames; + /* only draw child paths with lighting */ + if(dt > OB_WIRE) + glEnable(GL_LIGHTING); + + if(psys->part->draw_as == PART_DRAW_PATH) { + for(i=0, path=psys->childcache; i<totchild; i++,path++){ + glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), (*path)->co); + if(dt > OB_WIRE) { + glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), (*path)->vel); + glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), (*path)->col); } - glColorPointer(4, GL_FLOAT, 4*sizeof(float), pathcol); + glDrawArrays(GL_LINE_STRIP, 0, (int)(*path)->steps + 1); } - else - glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col); + } + + if(dt > OB_WIRE) + glDisable(GL_LIGHTING); - glDrawArrays(GL_LINE_STRIP, 0, path->steps + 1); + if(pset->brushtype == PE_BRUSH_WEIGHT) { + glLineWidth(2.0f); + glEnableClientState(GL_COLOR_ARRAY); + glDisable(GL_LIGHTING); } - if(pathcol) { MEM_freeN(pathcol); pathcol = pcol = NULL; } + /* draw parents last without lighting */ + for(i=0, pa=psys->particles, path = psys->pathcache; i<totpart; i++, pa++, path++){ + glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), (*path)->co); + if(dt > OB_WIRE) + glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), (*path)->vel); + if(dt > OB_WIRE || pset->brushtype == PE_BRUSH_WEIGHT) + glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), (*path)->col); + glDrawArrays(GL_LINE_STRIP, 0, (int)(*path)->steps + 1); + } /* draw edit vertices */ if(pset->selectmode!=SCE_SELECT_PATH){ + glDisableClientState(GL_NORMAL_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + glDisable(GL_LIGHTING); glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); if(pset->selectmode==SCE_SELECT_POINT){ - float *pd=0,*pdata=0; float *cd=0,*cdata=0; - int totkeys = 0; - - for (i=0, point=edit->points; i<totpoint; i++, point++) - if(!(point->flag & PEP_HIDE)) - totkeys += point->totkey; - - if(!(edit->points->keys->flag & PEK_USE_WCO)) - pd=pdata=MEM_callocN(totkeys*3*sizeof(float), "particle edit point data"); - cd=cdata=MEM_callocN(totkeys*(timed?4:3)*sizeof(float), "particle edit color data"); - - for(i=0, point=edit->points; i<totpoint; i++, point++){ - if(point->flag & PEP_HIDE) - continue; - - for(k=0, key=point->keys; k<point->totkey; k++, key++){ - if(pd) { - VECCOPY(pd, key->co); - pd += 3; - } + cd=cdata=MEM_callocN(edit->totkeys*(timed?4:3)*sizeof(float), "particle edit color data"); + for(i=0, pa=psys->particles; i<totpart; i++, pa++){ + for(k=0, key=edit->keys[i]; k<pa->totkey; k++, key++){ if(key->flag&PEK_SELECT){ VECCOPY(cd,sel_col); } else{ VECCOPY(cd,nosel_col); } - if(timed) - *(cd+3) = 1.0f - fabs((float)CFRA - *key->time)/(float)pset->fade_frames; - + *(cd+3) = (key->flag&PEK_HIDE)?0.0f:1.0f; cd += (timed?4:3); } } cd=cdata; - pd=pdata; - for(i=0, point=edit->points; i<totpoint; i++, point++){ - if(point->flag & PEP_HIDE) - continue; - - if(point->keys->flag & PEK_USE_WCO) - glVertexPointer(3, GL_FLOAT, sizeof(PTCacheEditKey), point->keys->world_co); - else - glVertexPointer(3, GL_FLOAT, 3*sizeof(float), pd); - - glColorPointer((timed?4:3), GL_FLOAT, (timed?4:3)*sizeof(float), cd); + for(i=0, pa=psys->particles; i<totpart; i++, pa++){ + if((pa->flag & PARS_HIDE)==0){ + glVertexPointer(3, GL_FLOAT, sizeof(ParticleEditKey), edit->keys[i]->world_co); + glColorPointer((timed?4:3), GL_FLOAT, (timed?4:3)*sizeof(float), cd); + glDrawArrays(GL_POINTS, 0, pa->totkey); + } + cd += (timed?4:3) * pa->totkey; - glDrawArrays(GL_POINTS, 0, point->totkey); + if((pset->flag&PE_SHOW_TIME) && (pa->flag&PARS_HIDE)==0 && !(G.f & G_RENDER_SHADOW)){ + for(k=0, key=edit->keys[i]+k; k<pa->totkey; k++, key++){ + if(key->flag & PEK_HIDE) continue; - pd += pd ? 3 * point->totkey : 0; - cd += (timed?4:3) * point->totkey; + sprintf(val," %.1f",*key->time); + view3d_particle_text_draw_add(key->world_co[0], key->world_co[1], key->world_co[2], val, 0); + } + } } - if(pdata) { MEM_freeN(pdata); pd=pdata=0; } - if(cdata) { MEM_freeN(cdata); cd=cdata=0; } + if(cdata) + MEM_freeN(cdata); + cd=cdata=0; } else if(pset->selectmode == SCE_SELECT_END){ - for(i=0, point=edit->points; i<totpoint; i++, point++){ - if((point->flag & PEP_HIDE)==0){ - key = point->keys + point->totkey - 1; + for(i=0, pa=psys->particles; i<totpart; i++, pa++){ + if((pa->flag & PARS_HIDE)==0){ + key = edit->keys[i] + pa->totkey - 1; if(key->flag & PEK_SELECT) glColor3fv(sel_col); else glColor3fv(nosel_col); /* has to be like this.. otherwise selection won't work, have try glArrayElement later..*/ glBegin(GL_POINTS); - glVertex3fv(key->flag & PEK_USE_WCO ? key->world_co : key->co); + glVertex3fv(key->world_co); glEnd(); + + if((pset->flag & PE_SHOW_TIME) && !(G.f & G_RENDER_SHADOW)){ + sprintf(val," %.1f",*key->time); + view3d_particle_text_draw_add(key->world_co[0], key->world_co[1], key->world_co[2], val, 0); + } } } } @@ -3878,18 +3893,18 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj unsigned int nurbcol[8]= { 0, 0x9090, 0x409030, 0x603080, 0, 0x40fff0, 0x40c033, 0xA090F0 }; -static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) +static void tekenhandlesN(Nurb *nu, short sel) { BezTriple *bezt; float *fp; unsigned int *col; int a; - if(nu->hide || hide_handles) return; + if(nu->hide || (G.f & G_HIDDENHANDLES)) return; glBegin(GL_LINES); - if(nu->type == CU_BEZIER) { + if( (nu->type & 7)==CU_BEZIER) { if(sel) col= nurbcol+4; else col= nurbcol; @@ -3929,7 +3944,7 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) glEnd(); } -static void tekenvertsN(Nurb *nu, short sel, short hide_handles) +static void tekenvertsN(Nurb *nu, short sel) { BezTriple *bezt; BPoint *bp; @@ -3946,13 +3961,13 @@ static void tekenvertsN(Nurb *nu, short sel, short hide_handles) bglBegin(GL_POINTS); - if(nu->type == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { if(bezt->hide==0) { - if (hide_handles) { + if (G.f & G_HIDDENHANDLES) { if((bezt->f2 & SELECT)==sel) bglVertex3fv(bezt->vec[1]); } else { if((bezt->f1 & SELECT)==sel) bglVertex3fv(bezt->vec[0]); @@ -3987,7 +4002,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel) nu= nurb; while(nu) { if(nu->hide==0) { - switch(nu->type) { + switch(nu->type & 7) { case CU_POLY: cpack(nurbcol[3]); bp= nu->bp; @@ -4084,7 +4099,6 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, Curve *cu = ob->data; Nurb *nu; BevList *bl; - short hide_handles = (cu->drawflag & CU_HIDE_HANDLES); // XXX retopo_matrix_update(v3d); @@ -4096,25 +4110,23 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* first non-selected handles */ for(nu=nurb; nu; nu=nu->next) { - if(nu->type == CU_BEZIER) { - tekenhandlesN(nu, 0, hide_handles); + if((nu->type & 7)==CU_BEZIER) { + tekenhandlesN(nu, 0); } } draw_editnurb(ob, nurb, 0); draw_editnurb(ob, nurb, 1); /* selected handles */ for(nu=nurb; nu; nu=nu->next) { - if(nu->type == CU_BEZIER && (cu->drawflag & CU_HIDE_HANDLES)==0) - tekenhandlesN(nu, 1, hide_handles); - tekenvertsN(nu, 0, hide_handles); + if((nu->type & 7)==1) tekenhandlesN(nu, 1); + tekenvertsN(nu, 0); } if(v3d->zbuf) glEnable(GL_DEPTH_TEST); /* direction vectors for 3d curve paths when at its lowest, dont render normals */ - if(cu->flag & CU_3D && ts->normalsize > 0.0015 && (cu->drawflag & CU_HIDE_NORMALS)==0) { - + if(cu->flag & CU_3D && ts->normalsize > 0.0015) { UI_ThemeColor(TH_WIRE); for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) { BevPoint *bevp= (BevPoint *)(bl+1); @@ -4149,7 +4161,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, if(v3d->zbuf) glDisable(GL_DEPTH_TEST); for(nu=nurb; nu; nu=nu->next) { - tekenvertsN(nu, 1, hide_handles); + tekenvertsN(nu, 1); } if(v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -5011,9 +5023,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* patch? children objects with a timeoffs change the parents. How to solve! */ /* if( ((int)ob->ctime) != F_(scene->r.cfra)) where_is_object(scene, ob); */ - - /* draw paths... */ - // TODO... /* multiply view with object matrix */ wmMultMatrix(ob->obmat); @@ -5286,6 +5295,11 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) for(psys=ob->particlesystem.first; psys; psys=psys->next) draw_new_particle_system(scene, v3d, rv3d, base, psys, dt); + if(ob->mode & OB_MODE_PARTICLE_EDIT && ob==OBACT) { + psys= PE_get_current(scene, ob); + if(psys && !scene->obedit && psys_in_edit_mode(scene, psys)) + draw_particle_edit(scene, v3d, rv3d, ob, psys, dt); + } view3d_particle_text_draw(v3d, ar); wmMultMatrix(ob->obmat); @@ -5293,21 +5307,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) //glDepthMask(GL_TRUE); if(col) cpack(col); } - - if( (warning_recursive==0) && - (flag & DRAW_PICKING)==0 && - (!scene->obedit) - ) { - - if(ob->mode & OB_MODE_PARTICLE_EDIT && ob==OBACT) { - PTCacheEdit *edit = PE_get_current(scene, ob); - if(edit) { - wmLoadMatrix(rv3d->viewmat); - draw_ptcache_edit(scene, v3d, rv3d, ob, edit, dt); - wmMultMatrix(ob->obmat); - } - } - } /* draw code for smoke */ if((md = modifiers_findByType(ob, eModifierType_Smoke))) @@ -5352,20 +5351,314 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) // only draw domains if(smd->domain && smd->domain->fluid) { - if(!smd->domain->wt || !(smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) + int x, y, z, i; + float viewnormal[3]; + int mainaxis[3] = {0,0,0}; + float align = 0, signed_align = 0; + int max_textures = 0, counter_textures = 0; + float *buffer = NULL; + int res[3]; + float bigfactor = 1.0; + int big = (smd->domain->flags & MOD_SMOKE_HIGHRES) && (smd->domain->viewsettings & MOD_SMOKE_VIEW_USEBIG); + int new = 0; + int have_lamp = 0; + + // GUI sent redraw event + if(smd->domain->flags & MOD_SMOKE_VIEW_REDRAWNICE) + { + new = 1; + smd->domain->flags &= ~MOD_SMOKE_VIEW_REDRAWNICE; + } + + if(!big) + { + res[0] = smd->domain->res[0]; + res[1] = smd->domain->res[1]; + res[2] = smd->domain->res[2]; + } + else + { + smoke_turbulence_get_res(smd->domain->wt, res); + bigfactor = 1.0 / (smd->domain->amplify + 1); + } + + wmLoadMatrix(rv3d->viewmat); + + if(col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */ + glDepthMask(GL_FALSE); + glEnable(GL_BLEND); + + // get view vector + VECCOPY(viewnormal, rv3d->viewinv[2]); + Normalize(viewnormal); + for(i = 0; i < 3; i++) + { + if(ABS(viewnormal[i]) > align) + { + mainaxis[0] = i; + align = ABS(viewnormal[i]); + signed_align = viewnormal[i]; + } + } + mainaxis[1] = (mainaxis[0] + 1) % 3; + mainaxis[2] = (mainaxis[0] + 2) % 3; + + if(!smd->domain->bind) + { + smd->domain->bind = MEM_callocN(sizeof(GLuint)*256, "Smoke_bind"); + if(big) + smd->domain->viewsettings |= MOD_SMOKE_VIEW_CHANGETOBIG; + new = 3; + } + + // check if view axis / mode has been changed + if(smd->domain->viewsettings) + { + if(big) + { + if(!(smd->domain->viewsettings & MOD_SMOKE_VIEW_BIG)) + new = 2; + else if(!(smd->domain->viewsettings & MOD_SMOKE_VIEW_CHANGETOBIG)) + new = 1; + + smd->domain->viewsettings |= MOD_SMOKE_VIEW_CHANGETOBIG; + } + else + { + if(!(smd->domain->viewsettings & MOD_SMOKE_VIEW_SMALL)) + new = 2; + else if(smd->domain->viewsettings & MOD_SMOKE_VIEW_CHANGETOBIG) + new = 1; + + smd->domain->viewsettings &= ~MOD_SMOKE_VIEW_CHANGETOBIG; + } + + if(!new) + { + if((mainaxis[0] == 0) && !(smd->domain->viewsettings & MOD_SMOKE_VIEW_X)) + new = 1; + else if((mainaxis[0] == 1) && !(smd->domain->viewsettings & MOD_SMOKE_VIEW_Y)) + new = 1; + else if((mainaxis[0] == 2) && !(smd->domain->viewsettings & MOD_SMOKE_VIEW_Z)) + new = 1; + + // printf("check axis\n"); + } + } + else + new = 3; + + if(new > 1) + { + float light[3] = {0.0,0.0,0.0}; // TODO: take real LAMP coordinates - dg + Base *base_tmp = NULL; + + for(base_tmp = scene->base.first; base_tmp; base_tmp= base_tmp->next) + { + if(base_tmp->object->type == OB_LAMP) + { + Lamp *la = (Lamp *)base_tmp->object->data; + + if(la->type == LA_LOCAL) + { + VECCOPY(light, base_tmp->object->obmat[3]); + have_lamp = 1; + break; + } + } + } + + if(!big && !(smd->domain->viewsettings & MOD_SMOKE_VIEW_SMALL)) + { + smoke_prepare_View(smd, light); + // printf("prepared View!\n"); + } + else if(big && !(smd->domain->viewsettings & MOD_SMOKE_VIEW_BIG)) + { + smoke_prepare_bigView(smd, light); + // printf("prepared bigView!\n"); + } + } + + // printf("big: %d, new: %d\n", big, new); + + // only create buffer if we need to create new textures + if(new) + buffer = MEM_mallocN(sizeof(float)*res[mainaxis[1]]*res[mainaxis[2]]*4, "SmokeDrawBuffer"); + + if(buffer || smd->domain->viewsettings) + { + int mod_texture = 0; + + // printf("if(buffer || smd->domain->viewsettings)\n"); + + max_textures = (res[mainaxis[0]] > 256) ? 256 : res[mainaxis[0]]; + + if(!smd->domain->viewsettings) // new frame or new start + { + smd->domain->max_textures = max_textures; + glGenTextures(smd->domain->max_textures, (GLuint *)smd->domain->bind); + new = 1; + // printf("glGenTextures\n"); + } + else + { + if(new) + { + // printf("glDeleteTextures\n"); + glDeleteTextures(smd->domain->max_textures, (GLuint *)smd->domain->bind); + smd->domain->max_textures = max_textures; + glGenTextures(smd->domain->max_textures, (GLuint *)smd->domain->bind); + } + } + + mod_texture = MAX3(1, smd->domain->visibility, (int)(res[mainaxis[0]] / smd->domain->max_textures )); + + // align order of billboards to be front or backview (e.g. +x or -x axis) + if(signed_align < 0) + { + z = res[mainaxis[0]] - 1; + } + else + { + z = 0; + } + + for (; signed_align > 0 ? (z < res[mainaxis[0]]) : (z >= 0); signed_align > 0 ? z++ : z--) // 2 + { + float quad[4][3]; + + if(new) + { + for (y = 0; y < res[mainaxis[1]]; y++) // 1 + { + for (x = 0; x < res[mainaxis[2]]; x++) // 0 + { + size_t index; + size_t image_index; + float tray, tvox; + + image_index = smoke_get_index2d(y, res[mainaxis[1]], x); + + if(mainaxis[0] == 0) + { + // mainaxis[1] == 1, mainaxis[2] == 2 + index = smoke_get_index(z, res[mainaxis[0]], y, res[mainaxis[1]], x); + } + else if(mainaxis[0] == 1) + { + // mainaxis[1] == 2, mainaxis[2] == 0 + index = smoke_get_index(x, res[mainaxis[2]], z, res[mainaxis[0]], y); + } + else // mainaxis[0] == 2 + { + // mainaxis[1] == 0, mainaxis[2] == 1 + index = smoke_get_index(y, res[mainaxis[1]], x, res[mainaxis[2]], z); + } + + if(!big) + { + tvox = smoke_get_tvox(smd, index); + tray = smoke_get_tray(smd, index); + } + else + { + tvox = smoke_get_bigtvox(smd, index); + tray = smoke_get_bigtray(smd, index); + } + + if(!have_lamp) + tray = 1.0; + + // fill buffer with luminance and alpha + // 1 - T_vox + buffer[image_index*4 + 3] = 1.0 - tvox; // 0 = transparent => d.h. tvox = 1 + + // L_vox = Omega * L_light * (1 - T_vox) * T_ray + buffer[image_index*4] = buffer[image_index*4 + 1] = buffer[image_index*4 + 2] = smd->domain->omega * 1.0 * tvox * tray; + } + } + } + glBindTexture(GL_TEXTURE_2D, smd->domain->bind[counter_textures]); + glEnable(GL_TEXTURE_2D); + + if(new) + { + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, res[mainaxis[1]], res[mainaxis[2]], 0, GL_RGBA, GL_FLOAT, buffer); + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); // Linear Filtering + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering + } + + if((z % mod_texture) == 0 ) + { + // botttom left + quad[3][mainaxis[0]] = smd->domain->p0[mainaxis[0]] + z * smd->domain->dx * bigfactor + smd->domain->dx * bigfactor * 0.5; + quad[3][mainaxis[1]] = smd->domain->p0[mainaxis[1]] + smd->domain->dx * bigfactor * 0.5; + quad[3][mainaxis[2]] = smd->domain->p0[mainaxis[2]] + smd->domain->dx * bigfactor * 0.5; + + // top right + quad[1][mainaxis[0]] = smd->domain->p0[mainaxis[0]] + z * smd->domain->dx * bigfactor + smd->domain->dx * bigfactor * 0.5; + quad[1][mainaxis[1]] = smd->domain->p0[mainaxis[1]] + (res[mainaxis[1]] - 1) * smd->domain->dx * bigfactor + smd->domain->dx * bigfactor * 0.5; + quad[1][mainaxis[2]] = smd->domain->p0[mainaxis[2]] + (res[mainaxis[2]] - 1) * smd->domain->dx * bigfactor + smd->domain->dx * bigfactor * 0.5; + + // top left + quad[2][mainaxis[0]] = smd->domain->p0[mainaxis[0]] + z * smd->domain->dx * bigfactor + smd->domain->dx * bigfactor * 0.5; + quad[2][mainaxis[1]] = smd->domain->p0[mainaxis[1]] + smd->domain->dx * bigfactor * 0.5; + quad[2][mainaxis[2]] = smd->domain->p0[mainaxis[2]] + (res[mainaxis[2]] - 1) * smd->domain->dx * bigfactor + smd->domain->dx * bigfactor * 0.5; + + // bottom right + quad[0][mainaxis[0]] = smd->domain->p0[mainaxis[0]] + z * smd->domain->dx * bigfactor + smd->domain->dx * bigfactor * 0.5; + quad[0][mainaxis[1]] = smd->domain->p0[mainaxis[1]] + (res[mainaxis[1]] - 1) * smd->domain->dx * bigfactor + smd->domain->dx * bigfactor * 0.5; + quad[0][mainaxis[2]] = smd->domain->p0[mainaxis[2]] + smd->domain->dx * bigfactor * 0.5; + + glBegin(GL_QUADS); // Start Drawing Quads + + glTexCoord2f(1.0f, 0.0f); + glVertex3fv(quad[0]); // Left And Up 1 Unit (Top Left) + glTexCoord2f(1.0f, 1.0f); + glVertex3fv(quad[1]); // Right And Up 1 Unit (Top Right) + glTexCoord2f(0.0f, 1.0f); + glVertex3fv(quad[2]); // Right And Down One Unit (Bottom Right) + glTexCoord2f(0.0f, 0.0f); + glVertex3fv(quad[3]); // Left And Down One Unit (Bottom Left) + + glEnd(); + } + counter_textures++; + } + } + if(buffer) { - smd->domain->tex = NULL; - GPU_create_smoke(smd, 0); - draw_volume(scene, ar, v3d, base, smd->domain->tex, smd->domain->res, smd->domain->dx, smd->domain->tex_shadow); - GPU_free_smoke(smd); + MEM_freeN(buffer); + buffer = NULL; } - else if(smd->domain->wt || (smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) + + // set correct flag for viewsettings + if(1) { - smd->domain->tex = NULL; - GPU_create_smoke(smd, 1); - draw_volume(scene, ar, v3d, base, smd->domain->tex, smd->domain->res_wt, smd->domain->dx_wt, smd->domain->tex_shadow); - GPU_free_smoke(smd); + // do not clear BIG/SMALL flag + smd->domain->viewsettings &= ~MOD_SMOKE_VIEW_X; + smd->domain->viewsettings &= ~MOD_SMOKE_VIEW_Y; + smd->domain->viewsettings &= ~MOD_SMOKE_VIEW_Z; + + // set what caches we have + if(big) + smd->domain->viewsettings |= MOD_SMOKE_VIEW_BIG; + else + smd->domain->viewsettings |= MOD_SMOKE_VIEW_SMALL; + + if(mainaxis[0] == 0) + smd->domain->viewsettings |= MOD_SMOKE_VIEW_X; + else if(mainaxis[0] == 1) + smd->domain->viewsettings |= MOD_SMOKE_VIEW_Y; + else if(mainaxis[0] == 2) + smd->domain->viewsettings |= MOD_SMOKE_VIEW_Z; } + + wmMultMatrix(ob->obmat); + glDisable(GL_BLEND); + glDepthMask(GL_TRUE); + if(col) cpack(col); } } diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c deleted file mode 100644 index c8eda10566c..00000000000 --- a/source/blender/editors/space_view3d/drawvolume.c +++ /dev/null @@ -1,350 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * 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) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * Contributor(s): Daniel Genrich - * - * ***** END GPL LICENSE BLOCK ***** - */ - - -#include <string.h> -#include <math.h> - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "MEM_guardedalloc.h" - -#include "IMB_imbuf.h" - - - - -#include "DNA_armature_types.h" -#include "DNA_boid_types.h" -#include "DNA_camera_types.h" -#include "DNA_curve_types.h" -#include "DNA_constraint_types.h" // for drawing constraint -#include "DNA_effect_types.h" -#include "DNA_lamp_types.h" -#include "DNA_lattice_types.h" -#include "DNA_material_types.h" -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_meta_types.h" -#include "DNA_modifier_types.h" -#include "DNA_object_types.h" -#include "DNA_object_force.h" -#include "DNA_object_fluidsim.h" -#include "DNA_particle_types.h" -#include "DNA_space_types.h" -#include "DNA_scene_types.h" -#include "DNA_screen_types.h" -#include "DNA_smoke_types.h" -#include "DNA_userdef_types.h" -#include "DNA_view3d_types.h" -#include "DNA_world_types.h" - -#include "BLI_blenlib.h" -#include "BLI_arithb.h" -#include "BLI_editVert.h" -#include "BLI_edgehash.h" -#include "BLI_rand.h" - -#include "BKE_anim.h" //for the where_on_path function -#include "BKE_curve.h" -#include "BKE_constraint.h" // for the get_constraint_target function -#include "BKE_DerivedMesh.h" -#include "BKE_deform.h" -#include "BKE_displist.h" -#include "BKE_effect.h" -#include "BKE_font.h" -#include "BKE_global.h" -#include "BKE_image.h" -#include "BKE_key.h" -#include "BKE_lattice.h" -#include "BKE_mesh.h" -#include "BKE_material.h" -#include "BKE_mball.h" -#include "BKE_modifier.h" -#include "BKE_object.h" -#include "BKE_paint.h" -#include "BKE_particle.h" -#include "BKE_property.h" -#include "BKE_smoke.h" -#include "BKE_unit.h" -#include "BKE_utildefines.h" -#include "smoke_API.h" - -#include "BIF_gl.h" -#include "BIF_glutil.h" - -#include "GPU_draw.h" -#include "GPU_material.h" -#include "GPU_extensions.h" - -#include "ED_mesh.h" -#include "ED_particle.h" -#include "ED_screen.h" -#include "ED_types.h" -#include "ED_util.h" - -#include "UI_resources.h" -#include "UI_interface_icons.h" - -#include "WM_api.h" -#include "BLF_api.h" - -#include "GPU_extensions.h" - -#include "view3d_intern.h" // own include - -struct GPUTexture; - -/* draw slices of smoke is adapted from c++ code authored by: Johannes Schmid and Ingemar Rask, 2006, johnny@grob.org */ -static float cv[][3] = { - {1.0f, 1.0f, 1.0f}, {-1.0f, 1.0f, 1.0f}, {-1.0f, -1.0f, 1.0f}, {1.0f, -1.0f, 1.0f}, - {1.0f, 1.0f, -1.0f}, {-1.0f, 1.0f, -1.0f}, {-1.0f, -1.0f, -1.0f}, {1.0f, -1.0f, -1.0f} -}; - -// edges have the form edges[n][0][xyz] + t*edges[n][1][xyz] -static float edges[12][2][3] = { - {{1.0f, 1.0f, -1.0f}, {0.0f, 0.0f, 1.0f}}, - {{-1.0f, 1.0f, -1.0f}, {0.0f, 0.0f, 1.0f}}, - {{-1.0f, -1.0f, -1.0f}, {0.0f, 0.0f, 1.0f}}, - {{1.0f, -1.0f, -1.0f}, {0.0f, 0.0f, 1.0f}}, - - {{1.0f, -1.0f, 1.0f}, {0.0f, 1.0f, 0.0f}}, - {{-1.0f, -1.0f, 1.0f}, {0.0f, 1.0f, 0.0f}}, - {{-1.0f, -1.0f, -1.0f}, {0.0f, 1.0f, 0.0f}}, - {{1.0f, -1.0f, -1.0f}, {0.0f, 1.0f, 0.0f}}, - - {{-1.0f, 1.0f, 1.0f}, {1.0f, 0.0f, 0.0f}}, - {{-1.0f, -1.0f, 1.0f}, {1.0f, 0.0f, 0.0f}}, - {{-1.0f, -1.0f, -1.0f}, {1.0f, 0.0f, 0.0f}}, - {{-1.0f, 1.0f, -1.0f}, {1.0f, 0.0f, 0.0f}} -}; - -int intersect_edges(float *points, float a, float b, float c, float d) -{ - int i; - float t; - int numpoints = 0; - - for (i=0; i<12; i++) { - t = -(a*edges[i][0][0] + b*edges[i][0][1] + c*edges[i][0][2] + d) - / (a*edges[i][1][0] + b*edges[i][1][1] + c*edges[i][1][2]); - if ((t>0)&&(t<2)) { - points[numpoints * 3 + 0] = edges[i][0][0] + edges[i][1][0]*t; - points[numpoints * 3 + 1] = edges[i][0][1] + edges[i][1][1]*t; - points[numpoints * 3 + 2] = edges[i][0][2] + edges[i][1][2]*t; - numpoints++; - } - } - return numpoints; -} - -static int convex(float *p0, float *up, float *a, float *b) -{ - // Vec3 va = a-p0, vb = b-p0; - float va[3], vb[3], tmp[3]; - VECSUB(va, a, p0); - VECSUB(vb, b, p0); - Crossf(tmp, va, vb); - return INPR(up, tmp) >= 0; -} - -// copied from gpu_extension.c -static int is_pow2(int n) -{ - return ((n)&(n-1))==0; -} - -static int larger_pow2(int n) -{ - if (is_pow2(n)) - return n; - - while(!is_pow2(n)) - n= n&(n-1); - - return n*2; -} - -void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture *tex, int res[3], float dx, GPUTexture *tex_shadow) -{ - Object *ob = base->object; - RegionView3D *rv3d= ar->regiondata; - - float viewnormal[3]; - int i, j, n; - float d, d0, dd; - float *points = NULL; - int numpoints = 0; - float cor[3] = {1.,1.,1.}; - int gl_depth = 0, gl_blend = 0; - - /* Fragment program to calculate the 3dview of smoke */ - /* using 2 textures, density and shadow */ - const char *text = "!!ARBfp1.0\n" - "PARAM dx = program.local[0];\n" - "PARAM darkness = program.local[1];\n" - "PARAM f = {1.442695041, 1.442695041, 1.442695041, 0.01};\n" - "TEMP temp, shadow, value;\n" - "TEX temp, fragment.texcoord[0], texture[0], 3D;\n" - "TEX shadow, fragment.texcoord[0], texture[1], 3D;\n" - "MUL value, temp, darkness;\n" - "MUL value, value, dx;\n" - "MUL value, value, f;\n" - "EX2 temp, -value.r;\n" - "SUB temp.a, 1.0, temp.r;\n" - "MUL temp.r, temp.r, shadow.r;\n" - "MUL temp.g, temp.g, shadow.r;\n" - "MUL temp.b, temp.b, shadow.r;\n" - "MOV result.color, temp;\n" - "END\n"; - unsigned int prog; - - glGetBooleanv(GL_BLEND, (GLboolean *)&gl_blend); - glGetBooleanv(GL_DEPTH_TEST, (GLboolean *)&gl_depth); - - wmLoadMatrix(rv3d->viewmat); - wmMultMatrix(ob->obmat); - - glDepthMask(GL_FALSE); - glDisable(GL_DEPTH_TEST); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - // get view vector - VECCOPY(viewnormal, rv3d->viewinv[2]); - Normalize(viewnormal); - - // find cube vertex that is closest to the viewer - for (i=0; i<8; i++) { - float x,y,z; - - x = cv[i][0] + viewnormal[0]; - y = cv[i][1] + viewnormal[1]; - z = cv[i][2] + viewnormal[2]; - - if ((x>=-1.0f)&&(x<=1.0f) - &&(y>=-1.0f)&&(y<=1.0f) - &&(z>=-1.0f)&&(z<=1.0f)) { - break; - } - } - - if(GLEW_ARB_fragment_program) - { - glGenProgramsARB(1, &prog); - glEnable(GL_FRAGMENT_PROGRAM_ARB); - - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(text), text); - - // cell spacing - glProgramLocalParameter4fARB (GL_FRAGMENT_PROGRAM_ARB, 0, dx, dx, dx, 1.0); - // custom parameter for smoke style (higher = thicker) - glProgramLocalParameter4fARB (GL_FRAGMENT_PROGRAM_ARB, 1, 7.0, 7.0, 7.0, 1.0); - } - - GPU_texture_bind(tex, 0); - if(tex_shadow) - GPU_texture_bind(tex_shadow, 1); - - if (!GLEW_ARB_texture_non_power_of_two) { - cor[0] = (float)res[0]/(float)larger_pow2(res[0]); - cor[1] = (float)res[1]/(float)larger_pow2(res[1]); - cor[2] = (float)res[2]/(float)larger_pow2(res[2]); - } - - // our slices are defined by the plane equation a*x + b*y +c*z + d = 0 - // (a,b,c), the plane normal, are given by viewdir - // d is the parameter along the view direction. the first d is given by - // inserting previously found vertex into the plane equation - d0 = -(viewnormal[0]*cv[i][0] + viewnormal[1]*cv[i][1] + viewnormal[2]*cv[i][2]); - dd = 2.0*d0/64.0f; - n = 0; - - // printf("d0: %f, dd: %f\n", d0, dd); - - points = MEM_callocN(sizeof(float)*12*3, "smoke_points_preview"); - - for (d = d0; d > -d0; d -= dd) { - float p0[3]; - // intersect_edges returns the intersection points of all cube edges with - // the given plane that lie within the cube - numpoints = intersect_edges(points, viewnormal[0], viewnormal[1], viewnormal[2], d); - - if (numpoints > 2) { - VECCOPY(p0, points); - - // sort points to get a convex polygon - for(i = 1; i < numpoints - 1; i++) - { - for(j = i + 1; j < numpoints; j++) - { - if(convex(p0, viewnormal, &points[j * 3], &points[i * 3])) - { - float tmp2[3]; - VECCOPY(tmp2, &points[i * 3]); - VECCOPY(&points[i * 3], &points[j * 3]); - VECCOPY(&points[j * 3], tmp2); - } - } - } - - glBegin(GL_POLYGON); - for (i = 0; i < numpoints; i++) { - glColor3f(1.0, 1.0, 1.0); - glTexCoord3d((points[i * 3 + 0] + 1.0)*cor[0]/2.0, (points[i * 3 + 1] + 1)*cor[1]/2.0, (points[i * 3 + 2] + 1.0)*cor[2]/2.0); - glVertex3f(points[i * 3 + 0], points[i * 3 + 1], points[i * 3 + 2]); - } - glEnd(); - } - n++; - } - - if(tex_shadow) - GPU_texture_unbind(tex_shadow); - GPU_texture_unbind(tex); - - if(GLEW_ARB_fragment_program) - { - glDisable(GL_FRAGMENT_PROGRAM_ARB); - glDeleteProgramsARB(1, &prog); - } - - - MEM_freeN(points); - - if(!gl_blend) - glDisable(GL_BLEND); - if(gl_depth) - { - glEnable(GL_DEPTH_TEST); - glDepthMask(GL_TRUE); - } -} - diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 2250c2e7718..8b719dd2d80 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -280,7 +280,7 @@ static void view3d_modal_keymaps(wmWindowManager *wm, ARegion *ar, int stype) /* copy last mode, then we can re-init the region maps */ rv3d->lastmode= stype; - + keymap= WM_keymap_listbase(wm, "Object Mode", 0, 0); if(ELEM(stype, 0, NS_MODE_OBJECT)) WM_event_add_keymap_handler(&ar->handlers, keymap); @@ -304,12 +304,6 @@ static void view3d_modal_keymaps(wmWindowManager *wm, ARegion *ar, int stype) WM_event_add_keymap_handler(&ar->handlers, keymap); else WM_event_remove_keymap_handler(&ar->handlers, keymap); - - keymap= WM_keymap_listbase(wm, "Pose", 0, 0); - if(stype==NS_MODE_POSE) - WM_event_add_keymap_handler(&ar->handlers, keymap); - else - WM_event_remove_keymap_handler(&ar->handlers, keymap); keymap= WM_keymap_listbase(wm, "Metaball", 0, 0); if(stype==NS_EDITMODE_MBALL) @@ -325,7 +319,7 @@ static void view3d_modal_keymaps(wmWindowManager *wm, ARegion *ar, int stype) /* armature sketching needs to take over mouse */ keymap= WM_keymap_listbase(wm, "Armature_Sketch", 0, 0); - if(stype==NS_EDITMODE_ARMATURE) + if(stype==NS_EDITMODE_TEXT) WM_event_add_keymap_handler_priority(&ar->handlers, keymap, 10); else WM_event_remove_keymap_handler(&ar->handlers, keymap); @@ -452,24 +446,16 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_BONE_ACTIVE: case ND_BONE_SELECT: case ND_TRANSFORM: + case ND_GEOM_SELECT: + case ND_GEOM_DATA: case ND_DRAW: case ND_MODIFIER: case ND_CONSTRAINT: case ND_KEYS: - case ND_PARTICLE_SELECT: - case ND_PARTICLE_DATA: - ED_region_tag_redraw(ar); - break; - } - break; - case NC_GEOM: - switch(wmn->data) { - case ND_DATA: - case ND_SELECT: + case ND_PARTICLE: ED_region_tag_redraw(ar); break; } - break; case NC_GROUP: /* all group ops for now */ ED_region_tag_redraw(ar); @@ -491,10 +477,6 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) * more context than just the region */ ED_region_tag_redraw(ar); break; - case NC_SPACE: - if(wmn->data == ND_SPACE_VIEW3D) - ED_region_tag_redraw(ar); - break; } } @@ -540,10 +522,6 @@ static void view3d_header_area_listener(ARegion *ar, wmNotifier *wmn) break; } break; - case NC_SPACE: - if(wmn->data == ND_SPACE_VIEW3D) - ED_region_tag_redraw(ar); - break; } } @@ -592,24 +570,13 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn) case ND_BONE_ACTIVE: case ND_BONE_SELECT: case ND_TRANSFORM: + case ND_GEOM_SELECT: + case ND_GEOM_DATA: case ND_DRAW: case ND_KEYS: ED_region_tag_redraw(ar); break; } - break; - case NC_GEOM: - switch(wmn->data) { - case ND_DATA: - case ND_SELECT: - ED_region_tag_redraw(ar); - break; - } - break; - case NC_SPACE: - if(wmn->data == ND_SPACE_VIEW3D) - ED_region_tag_redraw(ar); - break; } } @@ -898,7 +865,7 @@ void ED_spacetype_view3d(void) /* regions: main window */ art= MEM_callocN(sizeof(ARegionType), "spacetype view3d region"); art->regionid = RGN_TYPE_WINDOW; - art->keymapflag= ED_KEYMAP_FRAMES|ED_KEYMAP_GPENCIL; + art->keymapflag= ED_KEYMAP_FRAMES; art->draw= view3d_main_area_draw; art->init= view3d_main_area_init; art->free= view3d_main_area_free; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 06320f871da..9b05f5b25b2 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -36,7 +36,6 @@ #include "DNA_armature_types.h" #include "DNA_curve_types.h" #include "DNA_camera_types.h" -#include "DNA_gpencil_types.h" #include "DNA_lamp_types.h" #include "DNA_lattice_types.h" #include "DNA_meta_types.h" @@ -82,7 +81,6 @@ #include "ED_armature.h" #include "ED_curve.h" #include "ED_image.h" -#include "ED_gpencil.h" #include "ED_keyframing.h" #include "ED_mesh.h" #include "ED_object.h" @@ -226,7 +224,7 @@ static void v3d_editvertex_buts(const bContext *C, uiBlock *block, View3D *v3d, nu= cu->editnurb->first; while(nu) { - if(nu->type == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { @@ -409,7 +407,7 @@ static void v3d_editvertex_buts(const bContext *C, uiBlock *block, View3D *v3d, nu= cu->editnurb->first; while(nu) { - if(nu->type == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { @@ -512,7 +510,7 @@ static void v3d_posearmature_buts(uiBlock *block, View3D *v3d, Object *ob, float uiButSetFunc(but, validate_bonebutton_cb, bone, NULL); uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob); - QuatToEulO(pchan->quat, tfp->ob_eul, pchan->rotmode); // XXX? + QuatToEul(pchan->quat, tfp->ob_eul); tfp->ob_eul[0]*= 180.0/M_PI; tfp->ob_eul[1]*= 180.0/M_PI; tfp->ob_eul[2]*= 180.0/M_PI; @@ -660,7 +658,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) return; /* no notifier! */ case B_OBJECTPANEL: - DAG_id_flush_update(&ob->id, OB_RECALC_OB); + DAG_object_flush_update(scene, ob, OB_RECALC_OB); break; case B_OBJECTPANELROT: @@ -668,7 +666,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) ob->rot[0]= M_PI*tfp->ob_eul[0]/180.0; ob->rot[1]= M_PI*tfp->ob_eul[1]/180.0; ob->rot[2]= M_PI*tfp->ob_eul[2]/180.0; - DAG_id_flush_update(&ob->id, OB_RECALC_OB); + DAG_object_flush_update(scene, ob, OB_RECALC_OB); } break; @@ -706,7 +704,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) VECCOPY(ob->size, tfp->ob_scale); } - DAG_id_flush_update(&ob->id, OB_RECALC_OB); + DAG_object_flush_update(scene, ob, OB_RECALC_OB); } break; @@ -752,14 +750,14 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) /* prevent multiple B_OBJECTPANELDIMS events to keep scaling, cycling with TAB on buttons can cause that */ VECCOPY(tfp->ob_dims, old_dims); - DAG_id_flush_update(&ob->id, OB_RECALC_OB); + DAG_object_flush_update(scene, ob, OB_RECALC_OB); } break; case B_OBJECTPANELMEDIAN: if(ob) { v3d_editvertex_buts(C, NULL, v3d, ob, 1.0); - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } break; @@ -770,7 +768,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) ob->parent= NULL; else { DAG_scene_sort(scene); - DAG_id_flush_update(&ob->id, OB_RECALC_OB); + DAG_object_flush_update(scene, ob, OB_RECALC_OB); } } break; @@ -841,13 +839,13 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) eul[0]= M_PI*tfp->ob_eul[0]/180.0; eul[1]= M_PI*tfp->ob_eul[1]/180.0; eul[2]= M_PI*tfp->ob_eul[2]/180.0; - EulOToQuat(eul, pchan->rotmode, pchan->quat); // xxx? + EulToQuat(eul, pchan->quat); } /* no break, pass on */ case B_ARMATUREPANEL2: { ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } break; case B_TRANSFORMSPACEADD: @@ -899,8 +897,8 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) Mesh *me= ob->data; int a; for(a=0; a<me->totvert; a++) - ED_vgroup_vert_remove (ob, defGroup, a); - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + remove_vert_defgroup (ob, defGroup, a); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } } break; @@ -1201,6 +1199,33 @@ static void view3d_panel_preview(bContext *C, ARegion *ar, short cntrl) // VIEW3 } #endif +#if 0 +static void view3d_panel_gpencil(const bContext *C, Panel *pa) +{ + View3D *v3d= CTX_wm_view3d(C); + uiBlock *block; + + block= uiLayoutFreeBlock(pa->layout); + + /* allocate memory for gpd if drawing enabled (this must be done first or else we crash) */ + if (v3d->flag2 & V3D_DISPGP) { +// if (v3d->gpd == NULL) +// XXX gpencil_data_setactive(ar, gpencil_data_addnew()); + } + + if (v3d->flag2 & V3D_DISPGP) { +// XXX bGPdata *gpd= v3d->gpd; + + /* draw button for showing gpencil settings and drawings */ + uiDefButBitS(block, TOG, V3D_DISPGP, B_REDR, "Use Grease Pencil", 10, 225, 150, 20, &v3d->flag2, 0, 0, 0, 0, "Display freehand annotations overlay over this 3D View (draw using Shift-LMB)"); + } + else { + uiDefButBitS(block, TOG, V3D_DISPGP, B_REDR, "Use Grease Pencil", 10, 225, 150, 20, &v3d->flag2, 0, 0, 0, 0, "Display freehand annotations overlay over this 3D View"); + uiDefBut(block, LABEL, 1, " ", 160, 180, 150, 20, NULL, 0.0, 0.0, 0, 0, ""); + } +} +#endif + static void delete_sketch_armature(bContext *C, void *arg1, void *arg2) { BIF_deleteSketch(C); @@ -1391,12 +1416,6 @@ void view3d_buttons_register(ARegionType *art) strcpy(pt->label, "Transform"); pt->draw= view3d_panel_object; BLI_addtail(&art->paneltypes, pt); - - pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel gpencil"); - strcpy(pt->idname, "VIEW3D_PT_gpencil"); - strcpy(pt->label, "Grease Pencil"); - pt->draw= gpencil_panel_standard; - BLI_addtail(&art->paneltypes, pt); /* pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel properties"); strcpy(pt->idname, "VIEW3D_PT_properties"); @@ -1451,7 +1470,6 @@ static int view3d_properties(bContext *C, wmOperator *op) void VIEW3D_OT_properties(wmOperatorType *ot) { ot->name= "Properties"; - ot->description= "Display the properties panel."; ot->idname= "VIEW3D_OT_properties"; ot->exec= view3d_properties; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 66113ec4941..3140ae76d4b 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -78,7 +78,6 @@ #include "ED_armature.h" #include "ED_keyframing.h" -#include "ED_gpencil.h" #include "ED_mesh.h" #include "ED_screen.h" #include "ED_space_api.h" @@ -1093,7 +1092,6 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) { RegionView3D *rv3d= ar->regiondata; struct Base *base = scene->basact; - rcti winrct; /*for 2.43 release, don't use glext and just define the constant. this to avoid possibly breaking platforms before release.*/ @@ -1139,9 +1137,6 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) glDisable(GL_DITHER); - region_scissor_winrct(ar, &winrct); - glScissor(winrct.xmin, winrct.ymin, winrct.xmax - winrct.xmin, winrct.ymax - winrct.ymin); - glClearColor(0.0, 0.0, 0.0, 0.0); if(v3d->zbuf) { glEnable(GL_DEPTH_TEST); @@ -1421,8 +1416,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d) glMatrixMode(GL_MODELVIEW); glPushMatrix(); -// glaDefine2DArea(&ar->winrct); - ED_region_pixelspace(ar); + glaDefine2DArea(&ar->winrct); glEnable(GL_BLEND); @@ -2084,8 +2078,8 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) } /* draw grease-pencil stuff */ - //if (v3d->flag2 & V3D_DISPGP) - draw_gpencil_3dview((bContext *)C, 1); +// if (v3d->flag2 & V3D_DISPGP) +// draw_gpencil_3dview(ar, 1); BDR_drawSketch(C); @@ -2101,9 +2095,9 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) if(rv3d->persp>1) drawviewborder(scene, ar, v3d); if(rv3d->rflag & RV3D_FLYMODE) drawviewborder_flymode(ar); - /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */ + /* draw grease-pencil stuff */ // if (v3d->flag2 & V3D_DISPGP) - draw_gpencil_3dview((bContext *)C, 0); +// draw_gpencil_3dview(ar, 0); drawcursor(scene, ar, v3d); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index bbcee0415f8..5ef64274e72 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -857,7 +857,6 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2. RegionView3D *rv3d= CTX_wm_region_view3d(C); Scene *scene= CTX_data_scene(C); Base *base; - float *curs; int center= RNA_boolean_get(op->ptr, "center"); @@ -867,10 +866,6 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2. if(center) { min[0]= min[1]= min[2]= 0.0f; max[0]= max[1]= max[2]= 0.0f; - - /* in 2.4x this also move the cursor to (0, 0, 0) (with shift+c). */ - curs= give_cursor(scene, v3d); - curs[0]= curs[1]= curs[2]= 0.0; } else { INIT_MINMAX(min, max); @@ -1895,7 +1890,7 @@ void VIEW3D_OT_manipulator(wmOperatorType *ot) /* identifiers */ ot->name= "3D Manipulator"; - ot->description = "Manipulate selected item by axis."; + ot->description = ""; ot->idname= "VIEW3D_OT_manipulator"; /* api callbacks */ diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index a633969d557..6c86c87302c 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -188,6 +188,55 @@ static void handle_view3d_lock(bContext *C) } } +/* 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_header_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(C); + + /* 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_header_buttons(C, NULL, event+B_LAY); + } + ED_area_tag_redraw(sa); + + if(v3d->drawtype == OB_SHADED) reshadeall_displist(scene); +} + static int layers_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); @@ -252,7 +301,6 @@ void VIEW3D_OT_layers(wmOperatorType *ot) { /* identifiers */ ot->name= "Layers"; - ot->description= "Toggle layer(s) visibility."; ot->idname= "VIEW3D_OT_layers"; /* api callbacks */ @@ -267,6 +315,403 @@ void VIEW3D_OT_layers(wmOperatorType *ot) RNA_def_boolean(ot->srna, "extend", 0, "Extend", ""); } + +#if 0 +static void do_view3d_view_camerasmenu(bContext *C, void *arg, int event) +{ + Scene *scene= CTX_data_scene(C); + 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 { + + for( base = FIRSTBASE; base; base = base->next ) { + if (base->object->type == OB_CAMERA) { + i++; + + if (event==i) { + /* XXX use api call! */ + + break; + } + } + } + } + +} + + +static uiBlock *view3d_view_camerasmenu(bContext *C, ARegion *ar, void *arg_unused) +{ + Scene *scene= CTX_data_scene(C); + Base *base; + uiBlock *block; + short yco= 0, menuwidth=120; + int i=1; + char camname[48]; + + block= uiBeginBlock(C, ar, "view3d_view_camerasmenu", UI_EMBOSSP); + uiBlockSetButmFunc(block, do_view3d_view_camerasmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Active Object as Active Camera|Ctrl NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, 140, 6, NULL, 0.0, 0.0, 0, 0, ""); + + for( base = FIRSTBASE; base; base = base->next ) { + if (base->object->type == OB_CAMERA) { + i++; + + strcpy(camname, base->object->id.name+2); + if (base->object == scene->camera) strcat(camname, " (Active)"); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, camname, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, i, ""); + } + } + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 50); + return block; +} +#endif + +#if 0 +static void do_view3d_view_cameracontrolsmenu(bContext *C, void *arg, int event) +{ + switch(event) { + case 0: /* Orbit Left */ + persptoetsen(PAD4); + break; + case 1: /* Orbit Right */ + persptoetsen(PAD6); + break; + case 2: /* Orbit Up */ + persptoetsen(PAD8); + break; + case 3: /* Orbit Down */ + persptoetsen(PAD2); + break; + case 4: /* Pan left */ + /* XXX ugly hack alert */ +// G.qual |= LR_CTRLKEY; + persptoetsen(PAD4); +// G.qual &= ~LR_CTRLKEY; + break; + case 5: /* Pan right */ + /* XXX ugly hack alert */ +// G.qual |= LR_CTRLKEY; + persptoetsen(PAD6); +// G.qual &= ~LR_CTRLKEY; + break; + case 6: /* Pan up */ + /* ugly hack alert */ +// G.qual |= LR_CTRLKEY; + persptoetsen(PAD8); +// G.qual &= ~LR_CTRLKEY; + break; + case 7: /* Pan down */ + /* ugly hack alert */ +// G.qual |= LR_CTRLKEY; + persptoetsen(PAD2); +// G.qual &= ~LR_CTRLKEY; + break; + case 8: /* Zoom In */ + persptoetsen(PADPLUSKEY); + break; + case 9: /* Zoom Out */ + persptoetsen(PADMINUS); + break; + case 10: /* Reset Zoom */ + persptoetsen(PADENTER); + break; + case 11: /* Camera Fly mode */ + fly(); + break; + } +} + + +static uiBlock *view3d_view_cameracontrolsmenu(bContext *C, ARegion *ar, void *arg_unused) +{ +/* static short tog=0; */ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiBeginBlock(C, ar, "view3d_view_cameracontrolsmenu", UI_EMBOSSP); + uiBlockSetButmFunc(block, do_view3d_view_cameracontrolsmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera Fly Mode|Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, 140, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Orbit Left|NumPad 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Orbit Right|NumPad 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Orbit Up|NumPad 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Orbit Down|NumPad 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, 140, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pan Left|Ctrl NumPad 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pan Right|Ctrl NumPad 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pan Up|Ctrl NumPad 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pan Down|Ctrl NumPad 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, 140, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom In|NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Out|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Zoom|NumPad Enter", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, ""); + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 50); + return block; +} + +static void do_view3d_view_alignviewmenu(bContext *C, void *arg, int event) +{ + Scene *scene= CTX_data_scene(C); + ScrArea *sa= CTX_wm_area(C); + View3D *v3d= sa->spacedata.first; + Object *obedit = CTX_data_edit_object(C); + float *curs; + + switch(event) { + + case 0: /* Align View to Selected (edit/faceselect mode) */ + case 1: + case 2: + if ((obedit) && (obedit->type == OB_MESH)) { + editmesh_align_view_to_selected(v3d, event + 1); + } + else if (paint_facesel_test(CTX_data_active_object(C))) { + Object *obact= OBACT; + if (obact && obact->type==OB_MESH) { + Mesh *me= obact->data; + + if (me->mtface) { +// XXX faceselect_align_view_to_selected(v3d, me, event + 1); + ED_area_tag_redraw(sa); + } + } + } + break; + case 3: /* Center View to Cursor */ + curs= give_cursor(scene, v3d); + v3d->ofs[0]= -curs[0]; + v3d->ofs[1]= -curs[1]; + v3d->ofs[2]= -curs[2]; + ED_area_tag_redraw(sa); + break; + case 4: /* Align Active Camera to View */ + /* XXX This ugly hack is a symptom of the nasty persptoetsen function, + * but at least it works for now. + */ +// G.qual |= LR_CTRLKEY|LR_ALTKEY; + persptoetsen(PAD0); +// G.qual &= ~(LR_CTRLKEY|LR_ALTKEY); + break; + case 5: /* Align View to Selected (object mode) */ +// XXX mainqenter(PADASTERKEY, 1); + break; + case 6: /* Center View and Cursor to Origin */ + WM_operator_name_call(C, "VIEW3D_OT_view_center", WM_OP_EXEC_REGION_WIN, NULL); + curs= give_cursor(scene, v3d); + curs[0]=curs[1]=curs[2]= 0.0; + break; + } +} + +static uiBlock *view3d_view_alignviewmenu(bContext *C, ARegion *ar, void *arg_unused) +{ +/* static short tog=0; */ + uiBlock *block; + Object *obedit = CTX_data_edit_object(C); + short yco= 0, menuwidth=120; + + block= uiBeginBlock(C, ar, "view3d_view_alignviewmenu", UI_EMBOSSP); + uiBlockSetButmFunc(block, do_view3d_view_alignviewmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center View to Cursor|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center Cursor and View All|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align Active Camera to View|Ctrl Alt NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); + + if (((obedit) && (obedit->type == OB_MESH)) || (paint_facesel_test(CTX_data_active_object(C)))) { + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Top)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Front)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Side)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); + } else { + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected|NumPad *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); + } + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 50); + return block; +} +#endif + +#if 0 +static uiBlock *view3d_view_spacehandlers(bContext *C, ARegion *ar, void *arg_unused) +{ + /* XXX */ + return NULL; +} + + +static void do_view3d_viewmenu(bContext *C, void *arg, int event) +{ + + switch(event) { + case 0: /* User */ + break; + case 1: /* Camera */ + break; + case 2: /* Top */ + break; + case 3: /* Front */ + break; + case 4: /* Side */ + break; + case 5: /* Perspective */ + break; + case 6: /* Orthographic */ + break; + case 7: /* Local View */ + break; + case 8: /* Global View */ + break; + case 9: /* View All (Home) */ + WM_operator_name_call(C, "VIEW3D_OT_view_all", WM_OP_EXEC_REGION_WIN, NULL); + break; + case 11: /* View Selected */ + WM_operator_name_call(C, "VIEW3D_OT_view_center", WM_OP_EXEC_REGION_WIN, NULL); + break; + case 13: /* Play Back Animation */ + break; + case 15: /* Background Image... */ +// add_blockhandler(sa, VIEW3D_HANDLER_BACKGROUND, UI_PNL_UNSTOW); + break; + case 16: /* View Panel */ +// add_blockhandler(sa, VIEW3D_HANDLER_PROPERTIES, UI_PNL_UNSTOW); + break; + case 17: /* Set Clipping Border */ + WM_operator_name_call(C, "VIEW3D_OT_clip_border", WM_OP_INVOKE_REGION_WIN, NULL); + break; + case 18: /* render preview */ +// toggle_blockhandler(sa, VIEW3D_HANDLER_PREVIEW, 0); + break; + case 19: /* zoom within border */ +// view3d_border_zoom(); + break; + case 20: /* Transform Space Panel */ +// add_blockhandler(sa, VIEW3D_HANDLER_TRANSFORM, UI_PNL_UNSTOW); + break; + case 21: /* Grease Pencil */ +// add_blockhandler(sa, VIEW3D_HANDLER_GREASEPENCIL, UI_PNL_UNSTOW); + break; + case 22: /* View all layers */ + do_layer_buttons(C, -2); + break; + } +} +#endif + +#if 0 +static uiBlock *view3d_viewmenu(bContext *C, ARegion *ar, void *arg_unused) +{ + ScrArea *sa= CTX_wm_area(C); + View3D *v3d= sa->spacedata.first; + RegionView3D *rv3d= wm_region_view3d(C); + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiBeginBlock(C, ar, "view3d_viewmenu", UI_EMBOSSP); + uiBlockSetButmFunc(block, do_view3d_viewmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Orientations...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 20, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Render Preview...|Shift P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 18, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "View Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 16, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Background Image...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Grease Pencil...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 21, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + if ((rv3d->viewbut == 0) && !(rv3d->persp == V3D_CAMOB)) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "User", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); + else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "User", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); + if (rv3d->persp == V3D_CAMOB) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Camera|NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); + else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Camera|NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); + if (rv3d->viewbut == 1) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Top|NumPad 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); + else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Top|NumPad 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); + if (rv3d->viewbut == 2) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Front|NumPad 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, ""); + else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Front|NumPad 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, ""); + if (rv3d->viewbut == 3) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Side|NumPad 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); + else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Side|NumPad 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); + + uiDefIconTextBlockBut(block, view3d_view_camerasmenu, NULL, ICON_RIGHTARROW_THIN, "Cameras", 0, yco-=20, 120, 19, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + if(rv3d->persp==V3D_PERSP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Perspective|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); + else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Perspective|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); + if(rv3d->persp==V3D_ORTHO) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Orthographic|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); + else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Orthographic|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + if(v3d->lay== (1<<20)-1) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Previous Layers|Shift ~", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 22, ""); + else uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show All Layers| ~", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 22, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + if(v3d->localview) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, ""); + else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, ""); + if(!v3d->localview) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Global View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, ""); + else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Global View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBlockBut(block, view3d_view_cameracontrolsmenu, NULL, ICON_RIGHTARROW_THIN, "View Navigation", 0, yco-=20, 120, 19, ""); + uiDefIconTextBlockBut(block, view3d_view_alignviewmenu, NULL, ICON_RIGHTARROW_THIN, "Align View", 0, yco-=20, 120, 19, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + if(rv3d->rflag & RV3D_CLIPPING) + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Clipping Border|Alt B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 17, ""); + else + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Clipping Border|Alt B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 17, ""); + if (rv3d->persp==V3D_ORTHO) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Within Border...|Shift B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 19, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View Selected|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, ""); + if(!sa->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 99, ""); + else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 99, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation|Alt A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 13, ""); + +#ifndef DISABLE_PYTHON + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBlockBut(block, view3d_view_spacehandlers, NULL, ICON_RIGHTARROW_THIN, "Space Handler Scripts", 0, yco-=20, 120, 19, ""); +#endif + + if(ar->alignment==RGN_ALIGN_TOP) { + uiBlockSetDirection(block, UI_DOWN); + } + else { + uiBlockSetDirection(block, UI_TOP); + uiBlockFlipOrder(block); + } + + uiTextBoundsBlock(block, 50); + + return block; +} +#endif + #if 0 void do_view3d_select_object_typemenu(bContext *C, void *arg, int event) { @@ -487,6 +932,82 @@ static uiBlock *view3d_select_object_groupedmenu(bContext *C, ARegion *ar, void #endif +static void view3d_select_metaballmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); + uiItemS(layout); + uiItemO(layout, NULL, 0, "MBALL_OT_select_deselect_all_metaelems"); + uiItemO(layout, NULL, 0, "MBALL_OT_select_inverse_metaelems"); + uiItemS(layout); + uiItemO(layout, NULL, 0, "MBALL_OT_select_random_metaelems"); +} + +/* wrapper for python layouts */ +void uiTemplate_view3d_select_metaballmenu(uiLayout *layout, bContext *C) +{ + void *arg_unused = NULL; + view3d_select_metaballmenu(C, layout, arg_unused); +} + +static void view3d_select_armaturemenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + PointerRNA ptr; + + /* this part of the menu has been moved to python */ + /*uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); + + uiItemS(layout); + + uiItemO(layout, "Select/Deselect All", 0, "ARMATURE_OT_select_all_toggle"); + uiItemO(layout, "Inverse", 0, "ARMATURE_OT_select_inverse"); + + uiItemS(layout); + + uiItemEnumO(layout, "Parent", 0, "ARMATURE_OT_select_hierarchy", "direction", BONE_SELECT_PARENT); + uiItemEnumO(layout, "Child", 0, "ARMATURE_OT_select_hierarchy", "direction", BONE_SELECT_CHILD); + + uiItemS(layout);*/ + + WM_operator_properties_create(&ptr, "ARMATURE_OT_select_hierarchy"); + RNA_boolean_set(&ptr, "extend", 1); + RNA_enum_set(&ptr, "direction", BONE_SELECT_PARENT); + uiItemFullO(layout, "Extend Parent", 0, "ARMATURE_OT_select_hierarchy", ptr.data, WM_OP_EXEC_REGION_WIN); + + WM_operator_properties_create(&ptr, "ARMATURE_OT_select_hierarchy"); + RNA_boolean_set(&ptr, "extend", 1); + RNA_enum_set(&ptr, "direction", BONE_SELECT_CHILD); + uiItemFullO(layout, "Extend Child", 0, "ARMATURE_OT_select_hierarchy", ptr.data, WM_OP_EXEC_REGION_WIN); +} + +/* wrapper for python layouts */ +void uiTemplate_view3d_select_armaturemenu(uiLayout *layout, bContext *C) +{ + void *arg_unused = NULL; + view3d_select_armaturemenu(C, layout, arg_unused); +} + +static void view3d_select_posemenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + PointerRNA ptr; + + WM_operator_properties_create(&ptr, "POSE_OT_select_hierarchy"); + RNA_boolean_set(&ptr, "extend", 1); + RNA_enum_set(&ptr, "direction", BONE_SELECT_PARENT); + uiItemFullO(layout, "Extend Parent", 0, "POSE_OT_select_hierarchy", ptr.data, WM_OP_EXEC_REGION_WIN); + + WM_operator_properties_create(&ptr, "POSE_OT_select_hierarchy"); + RNA_boolean_set(&ptr, "extend", 1); + RNA_enum_set(&ptr, "direction", BONE_SELECT_CHILD); + uiItemFullO(layout, "Extend Child", 0, "POSE_OT_select_hierarchy", ptr.data, WM_OP_EXEC_REGION_WIN); +} + +/* wrapper for python layouts */ +void uiTemplate_view3d_select_posemenu(uiLayout *layout, bContext *C) +{ + void *arg_unused = NULL; + view3d_select_posemenu(C, layout, arg_unused); +} + void do_view3d_select_faceselmenu(bContext *C, void *arg, int event) { #if 0 @@ -565,6 +1086,19 @@ void uiTemplate_view3d_select_faceselmenu(uiLayout *layout, bContext *C) view3d_select_faceselmenu(C, ar, arg_unused); } +static void view3d_edit_snapmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_selected_to_grid"); + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_selected_to_cursor"); + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_selected_to_center"); + + uiItemS(layout); + + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_cursor_to_selected"); + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_cursor_to_grid"); + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_cursor_to_active"); +} + #if 0 void do_view3d_transform_moveaxismenu(bContext *C, void *arg, int event) { @@ -1006,10 +1540,9 @@ static uiBlock *view3d_object_mirrormenu(bContext *C, ARegion *ar, void *arg_unu #endif #endif -#if 0 static void view3d_edit_object_transformmenu(bContext *C, uiLayout *layout, void *arg_unused) { -#if 0 // XXX not used anymore +#if 0 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Scale/Rotation to ObData|Ctrl A, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); apply_objects_locrot(); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Visual Transform|Ctrl A, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); @@ -1026,7 +1559,6 @@ static void view3d_edit_object_transformmenu(bContext *C, uiLayout *layout, void uiItemO(layout, NULL, 0, "OBJECT_OT_scale_clear"); uiItemO(layout, NULL, 0, "OBJECT_OT_origin_clear"); } -#endif #if 0 static void do_view3d_edit_object_makelocalmenu(bContext *C, void *arg, int event) @@ -1340,6 +1872,683 @@ static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event) } #endif +#if 0 +/* visible buttons ported to python, check ifedout buttons */ +static void view3d_edit_mesh_verticesmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemO(layout, "Merge...", 0, "MESH_OT_merge"); + uiItemO(layout, "Rip", 0, "MESH_OT_rip"); + uiItemO(layout, "Split", 0, "MESH_OT_split"); + uiItemO(layout, "Separate", 0, "MESH_OT_separate"); + + uiItemS(layout); + + uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth"); + uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles"); + +#if 0 + uiItemS(layout); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Vertex Parent|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); // add_hook_menu(); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Hook|Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); // make_parent(); +#endif +} +#endif + +#if 0 +/* visible buttons ported to python, check ifedout buttons */ +static void view3d_edit_mesh_edgesmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemO(layout, NULL, 0, "MESH_OT_edge_face_add"); + +#if 0 + uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em) + uiItemO(layout, "Loop Subdivide...", 0, "MESH_OT_loop_subdivide"); // Ctr R, CutEdgeloop(1); + uiItemO(layout, "Knife Subdivide...", 0, "MESH_OT_loop_subdivide"); // Shift K, KnifeSubdivide(KNIFE_PROMPT); + + uiItemS(layout); +#endif + + uiItemO(layout, "Subdivide", 0, "MESH_OT_subdivide"); + uiItemFloatO(layout, "Subdivide Smooth", 0, "MESH_OT_subdivide", "smoothness", 1.0f); + + uiItemS(layout); + + uiItemO(layout, "Mark Seam", 0, "MESH_OT_mark_seam"); + uiItemBooleanO(layout, "Clear Seam", 0, "MESH_OT_mark_seam", "clear", 1); + + uiItemS(layout); + + uiItemO(layout, "Mark Sharp", 0, "MESH_OT_mark_sharp"); + uiItemBooleanO(layout, "Clear Sharp", 0, "MESH_OT_mark_sharp", "clear", 1); + +#if 0 + uiItemS(layout); + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Adjust Bevel Weight|Ctrl Shift E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Crease SubSurf|Shift E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, ""); +#endif + + uiItemS(layout); + + uiItemEnumO(layout, "Rotate Edge CW", 0, "MESH_OT_edge_rotate", "direction", 1); + uiItemEnumO(layout, "Rotate Edge CCW", 0, "MESH_OT_edge_rotate", "direction", 2); + +#if 0 + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Slide Edge |Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Edge Loop|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Collapse", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, ""); +#endif +} +#endif + +#if 0 +void do_view3d_edit_mirrormenu(bContext *C, void *arg, int event) +{ + float mat[3][3]; + + Mat3One(mat); + + switch(event) { + case 0: + initTransform(TFM_MIRROR, CTX_NO_PET); + Transform(); + break; + case 1: + initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM); + BIF_setSingleAxisConstraint(mat[0], " on global X axis"); + Transform(); + break; + case 2: + initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM); + BIF_setSingleAxisConstraint(mat[1], " on global Y axis"); + Transform(); + break; + case 3: + initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM); + BIF_setSingleAxisConstraint(mat[2], "on global Z axis"); + Transform(); + break; + case 4: + initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM); + BIF_setLocalAxisConstraint('X', " on local X axis"); + Transform(); + break; + case 5: + initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM); + BIF_setLocalAxisConstraint('Y', " on local Y axis"); + Transform(); + break; + case 6: + initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM); + BIF_setLocalAxisConstraint('Z', " on local Z axis"); + Transform(); + break; + } +} + +static uiBlock *view3d_edit_mirrormenu(bContext *C, ARegion *ar, void *arg_unused) +{ + uiBlock *block; + short yco = 20, menuwidth = 120; + + block= uiBeginBlock(C, ar, "view3d_edit_mirrormenu", UI_EMBOSSP); + uiBlockSetButmFunc(block, do_view3d_edit_mirrormenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Interactive Mirror|Ctrl M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Global|Ctrl M, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Global|Ctrl M, Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z Global|Ctrl M, Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Local|Ctrl M, X X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Y Local|Ctrl M, Y Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Z Local|Ctrl M, Z Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 60); + return block; +} +#endif + +#ifndef DISABLE_PYTHON +#if 0 +static void do_view3d_edit_mesh_scriptsmenu(bContext *C, void *arg, int event) +{ + BPY_menu_do_python(PYMENU_MESH, event); +} + +static uiBlock *view3d_edit_mesh_scriptsmenu(bContext *C, ARegion *ar, void *arg_unused) +{ + uiBlock *block; +// short yco = 20, menuwidth = 120; +// XXX BPyMenu *pym; +// int i = 0; + + block= uiBeginBlock(C, ar, "v3d_emesh_pymenu", UI_EMBOSSP); + uiBlockSetButmFunc(block, do_view3d_edit_mesh_scriptsmenu, NULL); + +// for (pym = BPyMenuTable[PYMENU_MESH]; pym; pym = pym->next, i++) { +// uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename); +// } + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 60); + + return block; +} +#endif +#endif /* DISABLE_PYTHON */ + +#if 0 +static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event) +{ + ScrArea *sa= CTX_wm_area(C); + + switch(event) { + + case 2: /* transform properties */ + add_blockhandler(sa, VIEW3D_HANDLER_OBJECT, 0); + break; + case 4: /* insert keyframe */ + common_insertkey(); + break; + case 16: /* delete keyframe */ + common_deletekey(); + break; + } +} +#endif + +#if 0 +/* visible buttons ported to python, check ifedout buttons */ +static void view3d_edit_meshmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); + PointerRNA tsptr; + + RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &tsptr); + + uiItemO(layout, "Undo Editing", 0, "ED_OT_undo"); + uiItemO(layout, "Redo Editing", 0, "ED_OT_redo"); + +#if 0 + uiDefIconTextBlockBut(block, editmode_undohistorymenu, NULL, ICON_RIGHTARROW_THIN, "Undo History", 0, yco-=20, 120, 19, ""); +#endif + + uiItemS(layout); + +#if 0 + uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); + uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, 120, 19, ""); + uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, ""); +#endif + + uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu, NULL); + + uiItemS(layout); + +#if 0 + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Keyframe|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, ""); + + uiItemS(layout); +#endif + + uiItemO(layout, NULL, 0, "UV_OT_mapping_menu"); + + uiItemS(layout); + + uiItemO(layout, NULL, 0, "MESH_OT_extrude"); + uiItemO(layout, NULL, 0, "MESH_OT_duplicate"); + uiItemO(layout, "Delete...", 0, "MESH_OT_delete"); + + uiItemS(layout); + + uiItemMenuF(layout, "Vertices", 0, view3d_edit_mesh_verticesmenu, NULL); + uiItemMenuF(layout, "Edges", 0, view3d_edit_mesh_edgesmenu, NULL); + uiItemMenuF(layout, "Faces", 0, view3d_edit_mesh_facesmenu, NULL); + uiItemMenuF(layout, "Normals", 0, view3d_edit_mesh_normalsmenu, NULL); + + uiItemS(layout); + + uiItemR(layout, NULL, 0, &tsptr, "automerge_editing", 0, 0, 0); + uiItemR(layout, NULL, 0, &tsptr, "proportional_editing", 0, 0, 0); // |O + uiItemMenuEnumR(layout, NULL, 0, &tsptr, "proportional_editing_falloff"); // |Shift O + + uiItemS(layout); + + uiItemMenuF(layout, "Show/Hide", 0, view3d_edit_mesh_showhidemenu, NULL); + +#if 0 +#ifndef DISABLE_PYTHON + uiItemS(layout); + uiDefIconTextBlockBut(block, view3d_edit_mesh_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, ""); +#endif +#endif +} +#endif + +#if 0 +/* visible buttons ported to python, check ifedout buttons */ +static void view3d_edit_curve_controlpointsmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + Object *obedit= CTX_data_edit_object(C); + + if(obedit->type == OB_CURVE) { + uiItemEnumO(layout, NULL, 0, "TFM_OT_transform", "mode", TFM_TILT); + uiItemO(layout, NULL, 0, "CURVE_OT_tilt_clear"); + uiItemO(layout, NULL, 0, "CURVE_OT_separate"); + + uiItemS(layout); + + uiItemEnumO(layout, NULL, 0, "CURVE_OT_handle_type_set", "type", 1); + uiItemEnumO(layout, NULL, 0, "CURVE_OT_handle_type_set", "type", 3); + uiItemEnumO(layout, NULL, 0, "CURVE_OT_handle_type_set", "type", 2); + + uiItemS(layout); + } + + // XXX uiItemO(layout, NULL, 0, "OBJECT_OT_make_vertex_parent"); Make VertexParent|Ctrl P + // make_parent() + // XXX uiItemO(layout, NULL, 0, "OBJECT_OT_add_hook"); Add Hook| Ctrl H + // add_hook_menu() +} +#endif + +#if 0 +/* visible buttons ported to python, check ifedout buttons */ +static void view3d_edit_curvemenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); + PointerRNA tsptr; + + RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &tsptr); + +#if 0 + uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); + uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, ""); +#endif + + uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu, NULL); + + uiItemS(layout); + + // XXX uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + // common_insertkey(); + // XXX uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Keyframe|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, ""); + // common_deletekey(); + + + uiItemO(layout, NULL, 0, "CURVE_OT_extrude"); + uiItemO(layout, NULL, 0, "CURVE_OT_duplicate"); + uiItemO(layout, NULL, 0, "CURVE_OT_separate"); + uiItemO(layout, NULL, 0, "CURVE_OT_make_segment"); + uiItemO(layout, NULL, 0, "CURVE_OT_cyclic_toggle"); + uiItemO(layout, NULL, 0, "CURVE_OT_delete"); // Delete... + + uiItemS(layout); + + uiItemMenuF(layout, "Control Points", 0, view3d_edit_curve_controlpointsmenu, NULL); + uiItemMenuF(layout, "Segments", 0, view3d_edit_curve_segmentsmenu, NULL); + + uiItemS(layout); + + uiItemR(layout, NULL, 0, &tsptr, "proportional_editing", 0, 0, 0); // |O + uiItemMenuEnumR(layout, NULL, 0, &tsptr, "proportional_editing_falloff"); // |Shift O + + uiItemS(layout); + + uiItemMenuF(layout, "Show/Hide Control Points", 0, view3d_edit_curve_showhidemenu, NULL); +} +#endif + +#if 0 +/* visible buttons ported to python, check ifedout buttons */ +static void view3d_edit_latticemenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); + PointerRNA tsptr; + + RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &tsptr); + +#if 0 + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); + uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, ""); +#endif + + uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu, NULL); + + uiItemS(layout); + + // XXX uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + // common_insertkey(); + // XXX uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Keyframe|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, ""); + // common_deletekey(); + + uiItemO(layout, NULL, 0, "LATTICE_OT_make_regular"); + + uiItemS(layout); + + uiItemR(layout, NULL, 0, &tsptr, "proportional_editing", 0, 0, 0); // |O + uiItemMenuEnumR(layout, NULL, 0, &tsptr, "proportional_editing_falloff"); // |Shift O +} +#endif + +#if 0 +static void do_view3d_edit_armaturemenu(bContext *C, void *arg, int event) +{ + static short numcuts= 2; + + switch(event) { + case 0: /* Undo Editing */ + remake_editArmature(); + break; + + case 6: /* Shear */ + initTransform(TFM_SHEAR, CTX_NONE); + Transform(); + break; + case 7: /* Warp */ + initTransform(TFM_WARP, CTX_NONE); + Transform(); + case 23: /* bone sketching panel */ + add_blockhandler(curarea, VIEW3D_HANDLER_BONESKETCH, UI_PNL_UNSTOW); + break; + } +} +#endif + +#if 0 +/* visible buttons ported to python, check ifedout buttons */ +static void view3d_edit_armaturemenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + Object *obedit = CTX_data_edit_object(C); + bArmature *arm= obedit->data; + +#if 0 + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Bone Sketching|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 23, ""); + uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); + uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, ""); +#endif + uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu, NULL); + uiItemMenuF(layout, "Bone Roll", 0, view3d_edit_armature_rollmenu, NULL); + + if (arm->drawtype == ARM_ENVELOPE) + uiItemEnumO(layout, "Scale Envelope Distance", 0, "TFM_OT_transform", "mode", TFM_BONESIZE); + else + uiItemEnumO(layout, "Scale B-Bone Width", 0, "TFM_OT_transform", "mode", TFM_BONESIZE); + + uiItemS(layout); + + uiItemO(layout, "Extrude", 0, "ARMATURE_OT_extrude"); + if (arm->flag & ARM_MIRROR_EDIT) + uiItemBooleanO(layout, "Extrude Forked", 0, "ARMATURE_OT_extrude", "forked", 1); + + uiItemO(layout, NULL, 0, "ARMATURE_OT_duplicate"); + uiItemO(layout, NULL, 0, "ARMATURE_OT_merge"); + uiItemO(layout, NULL, 0, "ARMATURE_OT_fill"); + uiItemO(layout, NULL, 0, "ARMATURE_OT_delete"); + uiItemO(layout, NULL, 0, "ARMATURE_OT_separate"); + + uiItemS(layout); + + uiItemO(layout, NULL, 0, "ARMATURE_OT_subdivide_simple"); + uiItemO(layout, NULL, 0, "ARMATURE_OT_subdivide_multi"); + + uiItemEnumO(layout, "AutoName Left/Right", 0, "ARMATURE_OT_autoside_names", "axis", 0); + uiItemEnumO(layout, "AutoName Front/Back", 0, "ARMATURE_OT_autoside_names", "axis", 1); + uiItemEnumO(layout, "AutoName Top/Bottom", 0, "ARMATURE_OT_autoside_names", "axis", 2); + + uiItemO(layout, "Flip Left/Right Names", 0, "ARMATURE_OT_flip_names"); + + uiItemS(layout); + + uiItemO(layout, NULL, 0, "ARMATURE_OT_armature_layers"); + uiItemO(layout, NULL, 0, "ARMATURE_OT_bone_layers"); + + uiItemS(layout); + + uiItemMenuF(layout, "Parent", 0, view3d_edit_armature_parentmenu, NULL); + + uiItemS(layout); + + uiItemMenuF(layout, "Bone Settings ", 0, view3d_edit_armature_settingsmenu, NULL); +} +#endif + +static void view3d_pose_armature_transformmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + //uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear User Transform|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); + //used: clear_user_transform(scene, ob); + //uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiItemO(layout, NULL, 0, "POSE_OT_loc_clear"); + uiItemO(layout, NULL, 0, "POSE_OT_rot_clear"); + uiItemO(layout, NULL, 0, "POSE_OT_scale_clear"); + + // ??? + //uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Origin|Alt O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); + //used:clear_object('o'); +} + +static void view3d_pose_armature_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemO(layout, "Show Hidden", 0, "POSE_OT_reveal"); + + uiItemO(layout, "Hide Selected", 0, "POSE_OT_hide"); + uiItemBooleanO(layout, "Hide Unselected", 0, "POSE_OT_hide", "unselected", 1); +} + +static void view3d_pose_armature_ikmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemO(layout, NULL, 0, "POSE_OT_ik_add"); + uiItemO(layout, NULL, 0, "POSE_OT_ik_clear"); +} + +static void view3d_pose_armature_constraintsmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemO(layout, NULL, 0, "POSE_OT_constraint_add_with_targets"); + uiItemO(layout, NULL, 0, "POSE_OT_constraints_clear"); +} + +static void view3d_pose_armature_groupmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemO(layout, "Add Selected to Active Group", 0, "POSE_OT_group_assign"); + //uiItemO(layout, "Add Selected to Group", 0, "POSE_OT_group_assign"); + + uiItemO(layout, "Add New Group", 0, "POSE_OT_group_add"); + + uiItemO(layout, "Remove from All Groups", 0, "POSE_OT_group_unassign"); + uiItemO(layout, "Remove Active Group", 0, "POSE_OT_group_remove"); +} + +static void view3d_pose_armature_motionpathsmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemO(layout, NULL, 0, "POSE_OT_paths_calculate"); + uiItemO(layout, NULL, 0, "POSE_OT_paths_clear"); +} + +static void view3d_pose_armature_poselibmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemO(layout, NULL, 0, "POSELIB_OT_browse_interactive"); + + uiItemS(layout); + + uiItemO(layout, NULL, 0, "POSELIB_OT_pose_add"); + uiItemO(layout, NULL, 0, "POSELIB_OT_pose_rename"); + uiItemO(layout, NULL, 0, "POSELIB_OT_pose_remove"); +} + +static void view3d_pose_armature_settingsmenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemEnumO(layout, "Toggle a Setting", 0, "POSE_OT_flags_set", "mode", 2); + uiItemEnumO(layout, "Enable a Setting", 0, "POSE_OT_flags_set", "mode", 1); + uiItemEnumO(layout, "Disable a Setting", 0, "POSE_OT_flags_set", "mode", 0); +} + +#if 0 +static void do_view3d_pose_armaturemenu(bContext *C, void *arg, int event) +{ + Object *ob; + ob=OBACT; + + switch(event) { + case 5: + pose_copy_menu(); + break; + case 15: + pose_relax(); + break; + } +} +#endif + +static void view3d_pose_armaturemenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + Object *ob = CTX_data_active_object(C); + bArmature *arm= ob->data; + +#if 0 // XXX to be ported, using uiItemMenuF(layout, "<Name>", 0, view3d_pose_armature_<category>menu); + uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); +#endif + if ( (arm) && ((arm->drawtype == ARM_B_BONE) || (arm->drawtype == ARM_ENVELOPE)) ) + uiItemEnumO(layout, "Scale Envelope Distance", 0, "TFM_OT_transform", "mode", TFM_BONESIZE); + uiItemMenuF(layout, "Clear Transform", 0, view3d_pose_armature_transformmenu, NULL); + + uiItemS(layout); + + // TODO: these operators may get renamed + uiItemO(layout, NULL, 0, "ANIM_OT_insert_keyframe_menu"); + uiItemO(layout, NULL, 0, "ANIM_OT_delete_keyframe_v3d"); + + uiItemS(layout); + +#if 0 + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Relax Pose|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, ""); +#endif + uiItemO(layout, NULL, 0, "POSE_OT_apply"); + + uiItemS(layout); + + uiItemO(layout, "Copy Current Pose", 0, "POSE_OT_copy"); + uiItemO(layout, "Paste Pose", 0, "POSE_OT_paste"); + uiItemBooleanO(layout, "Paste X-Flipped Pose", 0, "POSE_OT_paste", "flipped", 1); + + uiItemS(layout); + + uiItemMenuF(layout, "Pose Library", 0, view3d_pose_armature_poselibmenu, NULL); + uiItemMenuF(layout, "Motion Paths", 0, view3d_pose_armature_motionpathsmenu, NULL); + uiItemMenuF(layout, "Bone Groups", 0, view3d_pose_armature_groupmenu, NULL); + + uiItemS(layout); + + uiItemMenuF(layout, "Inverse Kinematics", 0, view3d_pose_armature_ikmenu, NULL); + uiItemMenuF(layout, "Constraints", 0, view3d_pose_armature_constraintsmenu, NULL); + + uiItemS(layout); + + uiItemEnumO(layout, "AutoName Left/Right", 0, "POSE_OT_autoside_names", "axis", 0); + uiItemEnumO(layout, "AutoName Front/Back", 0, "POSE_OT_autoside_names", "axis", 1); + uiItemEnumO(layout, "AutoName Top/Bottom", 0, "POSE_OT_autoside_names", "axis", 2); + + uiItemO(layout, "Flip Left/Right Names", 0, "POSE_OT_flip_names"); + + uiItemS(layout); + + uiItemO(layout, NULL, 0, "POSE_OT_armature_layers"); + uiItemO(layout, NULL, 0, "POSE_OT_bone_layers"); + + uiItemS(layout); + + uiItemMenuF(layout, "Show/Hide Bones", 0, view3d_pose_armature_showhidemenu, NULL); + uiItemMenuF(layout, "Bone Settings", 0, view3d_pose_armature_settingsmenu, NULL); + +#if 0 + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Copy Attributes...|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); +#endif +} + + +/* vertex paint menu */ +static void do_view3d_vpaintmenu(bContext *C, void *arg, int event) +{ +#if 0 + /* events >= 3 are registered bpython scripts */ +#ifndef DISABLE_PYTHON + if (event >= 3) BPY_menu_do_python(PYMENU_VERTEXPAINT, event - 3); +#endif + switch(event) { + case 0: /* undo vertex painting */ + BIF_undo(); + break; + case 1: /* set vertex colors/weight */ + if(paint_facesel_test(CTX_data_active_object(C))) + clear_vpaint_selectedfaces(); + else /* we know were in vertex paint mode */ + clear_vpaint(); + break; + case 2: + make_vertexcol(1); + break; + } +#endif +} + +static uiBlock *view3d_vpaintmenu(bContext *C, ARegion *ar, void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; +#ifndef DISABLE_PYTHON +// XXX BPyMenu *pym; +// int i=0; +#endif + + block= uiBeginBlock(C, ar, "view3d_paintmenu", UI_EMBOSSP); + uiBlockSetButmFunc(block, do_view3d_vpaintmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Vertex Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Vertex Colors|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Shaded Vertex Colors", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + +#ifndef DISABLE_PYTHON + /* note that we account for the 3 previous entries with i+3: + even if the last item isnt displayed, it dosent matter */ +// for (pym = BPyMenuTable[PYMENU_VERTEXPAINT]; pym; pym = pym->next, i++) { +// uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, +// menuwidth, 19, NULL, 0.0, 0.0, 1, i+3, +// pym->tooltip?pym->tooltip:pym->filename); +// } +#endif + + if(ar->alignment==RGN_ALIGN_TOP) { + uiBlockSetDirection(block, UI_DOWN); + } + else { + uiBlockSetDirection(block, UI_TOP); + uiBlockFlipOrder(block); + } + + uiTextBoundsBlock(block, 50); + return block; +} + /* texture paint menu (placeholder, no items yet??) */ static void do_view3d_tpaintmenu(bContext *C, void *arg, int event) @@ -1537,6 +2746,39 @@ static uiBlock *view3d_faceselmenu(bContext *C, ARegion *ar, void *arg_unused) return block; } +static void view3d_particle_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + uiItemO(layout, NULL, 0, "PARTICLE_OT_reveal"); + uiItemO(layout, NULL, 0, "PARTICLE_OT_hide"); + uiItemBooleanO(layout, "Hide Unselected", 0, "PARTICLE_OT_hide", "unselected", 1); +} + +static void view3d_particlemenu(bContext *C, uiLayout *layout, void *arg_unused) +{ + ToolSettings *ts= CTX_data_tool_settings(C); + + // XXX uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Particle Edit Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); + // add_blockhandler(sa, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW); + // XXX uiItemS(layout); + // + // XXX uiDefIconTextBut(block, BUTM, 1, (pset->flag & PE_X_MIRROR)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT, "X-Axis Mirror Editing", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); + // pset->flag ^= PE_X_MIRROR; + + uiItemO(layout, NULL, 0, "PARTICLE_OT_mirror"); // |Ctrl M + + uiItemS(layout); + + uiItemO(layout, NULL, 0, "PARTICLE_OT_remove_doubles"); // |W, 5 + uiItemO(layout, NULL, 0, "PARTICLE_OT_delete"); + if(ts->particle.selectmode & SCE_SELECT_POINT) + uiItemO(layout, NULL, 0, "PARTICLE_OT_subdivide"); // |W, 2 + uiItemO(layout, NULL, 0, "PARTICLE_OT_rekey"); // |W, 1 + + uiItemS(layout); + + uiItemMenuF(layout, "Show/Hide Particles", 0, view3d_particle_showhidemenu, NULL); +} + static char *view3d_modeselect_pup(Scene *scene) { Object *ob= OBACT; @@ -1551,18 +2793,12 @@ static char *view3d_modeselect_pup(Scene *scene) if(ob==NULL) return string; /* if active object is editable */ - if ( ((ob->type == OB_MESH) + if ( ((ob->type == OB_MESH) || (ob->type == OB_ARMATURE) || (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT) || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) { str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT); } - else if (ob->type == OB_ARMATURE) { - if (ob->mode & OB_MODE_POSE) - str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT); - else - str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT); - } if (ob->type == OB_MESH) { @@ -1578,7 +2814,7 @@ static char *view3d_modeselect_pup(Scene *scene) str += sprintf(str, formatstr, "Pose Mode", OB_MODE_POSE, ICON_POSE_HLT); } - if (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody)) { + if (ob->particlesystem.first) { str += sprintf(str, formatstr, "Particle Mode", OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE); } @@ -1668,7 +2904,6 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; Object *obedit = CTX_data_edit_object(C); - Object *ob = CTX_data_active_object(C); EditMesh *em= NULL; int bit, ctrl= win->eventstate->ctrl, shift= win->eventstate->shift; PointerRNA props_ptr; @@ -1721,7 +2956,6 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) WM_operator_properties_create(&props_ptr, "OBJECT_OT_mode_set"); RNA_enum_set(&props_ptr, "mode", v3d->modeselect); WM_operator_name_call(C, "OBJECT_OT_mode_set", WM_OP_EXEC_REGION_WIN, &props_ptr); - WM_operator_properties_free(&props_ptr); break; case B_AROUND: // XXX handle_view3d_around(); /* copies to other 3d windows */ @@ -1733,7 +2967,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) em->selectmode= SCE_SELECT_VERTEX; ts->selectmode= em->selectmode; EM_selectmode_set(em); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); ED_undo_push(C, "Selectmode Set: Vertex"); } break; @@ -1747,7 +2981,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) } ts->selectmode= em->selectmode; EM_selectmode_set(em); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); ED_undo_push(C, "Selectmode Set: Edge"); } break; @@ -1761,24 +2995,21 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) } ts->selectmode= em->selectmode; EM_selectmode_set(em); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); ED_undo_push(C, "Selectmode Set: Face"); } break; case B_SEL_PATH: ts->particle.selectmode= SCE_SELECT_PATH; - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); ED_undo_push(C, "Selectmode Set: Path"); break; case B_SEL_POINT: ts->particle.selectmode = SCE_SELECT_POINT; - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); ED_undo_push(C, "Selectmode Set: Point"); break; case B_SEL_END: ts->particle.selectmode = SCE_SELECT_END; - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); ED_undo_push(C, "Selectmode Set: End point"); break; @@ -1878,6 +3109,11 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o uiDefPulldownBut(block, view3d_wpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, ""); xco+= xmax; } + else if (ob && ob->mode & OB_MODE_VERTEX_PAINT) { + xmax= GetButStringLength("Paint"); + uiDefPulldownBut(block, view3d_vpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, ""); + xco+= xmax; + } else if (ob && ob->mode & OB_MODE_TEXTURE_PAINT) { xmax= GetButStringLength("Paint"); uiDefPulldownBut(block, view3d_tpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, ""); @@ -1891,11 +3127,15 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o } } else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) { - /* ported to python */ + xmax= GetButStringLength("Particle"); + uiDefMenuBut(block, view3d_particlemenu, NULL, "Particle", xco,yco, xmax-3, 20, ""); + xco+= xmax; } else { if (ob && (ob->mode & OB_MODE_POSE)) { - /* ported to python */ + xmax= GetButStringLength("Pose"); + uiDefMenuBut(block, view3d_pose_armaturemenu, NULL, "Pose", xco,yco, xmax-3, 20, ""); + xco+= xmax; } } @@ -2186,7 +3426,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiDefIconBut(block, BUT, B_VIEWRENDER, ICON_SCENE, xco,yco,XIC,YIC, NULL, 0, 1.0, 0, 0, "Render this window (Ctrl Click for anim)"); if (ob && (ob->mode & OB_MODE_POSE)) { - xco+= XIC*2; + xco+= XIC; uiBlockBeginAlign(block); uiDefIconButO(block, BUT, "POSE_OT_copy", WM_OP_INVOKE_REGION_WIN, ICON_COPYDOWN, xco,yco,XIC,YIC, NULL); @@ -2202,5 +3442,10 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) } } + + /* do not do view2d totrect set here, it's now a template */ + + uiEndBlock(C, block); + uiDrawBlock(C, block); } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 00b0b5c4fd1..acd1c62bc17 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -156,9 +156,6 @@ void VIEW3D_OT_snap_menu(struct wmOperatorType *ot); ARegion *view3d_has_buttons_region(ScrArea *sa); ARegion *view3d_has_tools_region(ScrArea *sa); -/* draw_volume.c */ -void draw_volume(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct Base *base, struct GPUTexture *tex, int res[3], float dx, struct GPUTexture *tex_shadow); - #endif /* ED_VIEW3D_INTERN_H */ diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 7da2e591b10..112847272e5 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -106,6 +106,9 @@ void view3d_keymap(wmWindowManager *wm) ListBase *keymap= WM_keymap_listbase(wm, "View3D Generic", SPACE_VIEW3D, 0); wmKeymapItem *km; + WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint_toggle", VKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "PAINT_OT_weight_paint_toggle", TABKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "VIEW3D_OT_toolbar", TKEY, KM_PRESS, 0, 0); @@ -131,9 +134,8 @@ void view3d_keymap(wmWindowManager *wm) WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, 0, 0); km = WM_keymap_add_item(keymap, "SKETCH_OT_draw_preview", MOUSEMOVE, KM_ANY, KM_CTRL, 0); RNA_boolean_set(km->ptr, "snap", 1); - - WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, 0, 0); /* manipulator always on left mouse, not on action mouse*/ - + + WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", ACTIONMOUSE, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "VIEW3D_OT_cursor3d", ACTIONMOUSE, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "VIEW3D_OT_viewrotate", MIDDLEMOUSE, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index a7696d9fe31..7743ede399b 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -549,15 +549,13 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { - struct { ViewContext vc; short (*mcords)[2]; short moves; short select; } *data = userData; - + struct { short (*mcords)[2]; short moves; short select; } *data = userData; + if (lasso_inside(data->mcords, data->moves, x, y)) { if (bp) { bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT); } else { - Curve *cu= data->vc.obedit->data; - - if (cu->drawflag & CU_HIDE_HANDLES) { + if (G.f & G_HIDDENHANDLES) { /* can only be beztindex==0 here since handles are hidden */ bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT); } else { @@ -575,10 +573,9 @@ static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp static void do_lasso_select_curve(ViewContext *vc, short mcords[][2], short moves, short select) { - struct { ViewContext vc; short (*mcords)[2]; short moves; short select; } data; + struct { short (*mcords)[2]; short moves; short select; } data; /* set vc->editnurb */ - data.vc = *vc; data.mcords = mcords; data.moves = moves; data.select = select; @@ -759,7 +756,6 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op) void VIEW3D_OT_select_lasso(wmOperatorType *ot) { ot->name= "Lasso Select"; - ot->description= "Select items using lasso selection."; ot->idname= "VIEW3D_OT_select_lasso"; ot->invoke= WM_gesture_lasso_invoke; @@ -1199,9 +1195,7 @@ static void do_nurbs_box_select__doSelect(void *userData, Nurb *nu, BPoint *bp, if (bp) { bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT); } else { - Curve *cu= data->vc.obedit->data; - - if (cu->drawflag & CU_HIDE_HANDLES) { + if (G.f & G_HIDDENHANDLES) { /* can only be beztindex==0 here since handles are hidden */ bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT); } else { @@ -1220,7 +1214,7 @@ static void do_nurbs_box_select(ViewContext *vc, rcti *rect, int select) { struct { ViewContext vc; rcti *rect; int select; } data; - data.vc = *vc; + data.vc= *vc; data.rect = rect; data.select = select; @@ -1365,7 +1359,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) vc.em= me->edit_mesh; do_mesh_box_select(&vc, &rect, (val==LEFTMOUSE)); // if (EM_texFaceCheck()) - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); } else if(ELEM(obedit->type, OB_CURVE, OB_SURF)) { @@ -1540,7 +1534,6 @@ void VIEW3D_OT_select_border(wmOperatorType *ot) { /* identifiers */ ot->name= "Border Select"; - ot->description= "Select items using border selection."; ot->idname= "VIEW3D_OT_select_border"; /* api callbacks */ @@ -1600,7 +1593,6 @@ void VIEW3D_OT_select(wmOperatorType *ot) { /* identifiers */ ot->name= "Activate/Select"; - ot->description= "Activate/select item(s)."; ot->idname= "VIEW3D_OT_select"; /* api callbacks */ @@ -1810,7 +1802,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) if(CTX_data_edit_object(C)) { obedit_circle_select(&vc, selecting, mval, (float)radius); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obact); } else return PE_circle_select(C, selecting, mval, (float)radius); @@ -1839,7 +1831,6 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) void VIEW3D_OT_select_circle(wmOperatorType *ot) { ot->name= "Circle Select"; - ot->description= "Select items using circle selection."; ot->idname= "VIEW3D_OT_select_circle"; ot->invoke= WM_gesture_circle_invoke; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index b4b54cd1d88..335bc2c9e56 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -106,7 +106,7 @@ static void special_transvert_update(Scene *scene, Object *obedit) if(obedit) { - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); if(obedit->type==OB_MESH) { Mesh *me= obedit->data; @@ -302,7 +302,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) int totmalloc= 0; for(nu= cu->editnurb->first; nu; nu= nu->next) { - if(nu->type == CU_BEZIER) + if((nu->type & 7)==CU_BEZIER) totmalloc += 3*nu->pntsu; else totmalloc += nu->pntsu*nu->pntsv; @@ -311,7 +311,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) nu= cu->editnurb->first; while(nu) { - if(nu->type == CU_BEZIER) { + if((nu->type & 7)==CU_BEZIER) { a= nu->pntsu; bezt= nu->bezt; while(a--) { @@ -514,7 +514,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *op) /* auto-keyframing */ // XXX autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0); - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } else { ob->recalc |= OB_RECALC_OB; @@ -555,7 +555,6 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) /* identifiers */ ot->name= "Snap Selection to Grid"; - ot->description= "Snap selected item(s) to nearest grid node."; ot->idname= "VIEW3D_OT_snap_selected_to_grid"; /* api callbacks */ @@ -641,7 +640,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op) /* auto-keyframing */ // XXX autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0); - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } else { ob->recalc |= OB_RECALC_OB; @@ -681,7 +680,6 @@ void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot) /* identifiers */ ot->name= "Snap Selection to Cursor"; - ot->description= "Snap selected item(s) to cursor."; ot->idname= "VIEW3D_OT_snap_selected_to_cursor"; /* api callbacks */ @@ -717,7 +715,6 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot) /* identifiers */ ot->name= "Snap Cursor to Grid"; - ot->description= "Snap cursor to nearest grid node."; ot->idname= "VIEW3D_OT_snap_cursor_to_grid"; /* api callbacks */ @@ -824,7 +821,6 @@ void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot) /* identifiers */ ot->name= "Snap Cursor to Selected"; - ot->description= "Snap cursor to center of selected item(s)."; ot->idname= "VIEW3D_OT_snap_cursor_to_selected"; /* api callbacks */ @@ -874,7 +870,6 @@ void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot) /* identifiers */ ot->name= "Snap Cursor to Active"; - ot->description= "Snap cursor to active item."; ot->idname= "VIEW3D_OT_snap_cursor_to_active"; /* api callbacks */ @@ -1033,7 +1028,7 @@ static int snap_selected_to_center(bContext *C, wmOperator *op) /* auto-keyframing */ ob->pose->flag |= POSE_DO_UNLOCK; // XXX autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0); - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } else { ob->recalc |= OB_RECALC_OB; @@ -1074,7 +1069,6 @@ void VIEW3D_OT_snap_selected_to_center(wmOperatorType *ot) /* identifiers */ ot->name= "Snap Selection to Center"; - ot->description= "Snap selected items to selections geometric center."; ot->idname= "VIEW3D_OT_snap_selected_to_center"; /* api callbacks */ @@ -1141,7 +1135,6 @@ void VIEW3D_OT_snap_menu(wmOperatorType *ot) { /* identifiers */ ot->name= "Snap Menu"; - ot->description= "Display snap menu."; ot->idname= "VIEW3D_OT_snap_menu"; /* api callbacks */ diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 58248f675da..32378a915bd 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -270,7 +270,7 @@ static void view3d_panel_tool_shelf(const bContext *C, Panel *pa) for(ct= st->toolshelf.first; ct; ct= ct->next) { if(0==strncmp(context, ct->context, OP_MAX_TYPENAME)) { col= uiLayoutColumn(pa->layout, 1); - uiItemFullO(col, NULL, 0, ct->opname, NULL, WM_OP_INVOKE_REGION_WIN, 0); + uiItemFullO(col, NULL, 0, ct->opname, NULL, WM_OP_INVOKE_REGION_WIN); } } } @@ -322,7 +322,6 @@ static int view3d_toolbar(bContext *C, wmOperator *op) void VIEW3D_OT_toolbar(wmOperatorType *ot) { ot->name= "Toolbar"; - ot->description= "Toggles toolbar display."; ot->idname= "VIEW3D_OT_toolbar"; ot->exec= view3d_toolbar; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 808d1635b37..58b7a70a128 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -63,7 +63,6 @@ #include "RE_pipeline.h" // make_stars #include "BIF_gl.h" -#include "BIF_glutil.h" #include "WM_api.h" #include "WM_types.h" @@ -81,10 +80,6 @@ #include "PIL_time.h" /* smoothview */ -#if GAMEBLENDER == 1 -#include "SYS_System.h" -#endif - #include "view3d_intern.h" // own include /* use this call when executing an operator, @@ -415,7 +410,6 @@ void VIEW3D_OT_setcameratoview(wmOperatorType *ot) /* identifiers */ ot->name= "Align Camera To View"; - ot->description= "Set camera view to active view."; ot->idname= "VIEW3D_OT_camera_to_view"; /* api callbacks */ @@ -487,10 +481,7 @@ void initgrabz(RegionView3D *rv3d, float x, float y, float z) /* Negative zfac means x, y, z was behind the camera (in perspective). * This gives flipped directions, so revert back to ok default case. */ - // NOTE: I've changed this to flip zfac to be positive again for now so that GPencil draws ok - // -- Aligorith, 2009Aug31 - //if (rv3d->zfac < 0.0f) rv3d->zfac = 1.0f; - if (rv3d->zfac < 0.0f) rv3d->zfac= -rv3d->zfac; + if (rv3d->zfac < 0.0f) rv3d->zfac = 1.0f; } /* always call initgrabz */ @@ -552,18 +543,6 @@ void view3d_get_object_project_mat(RegionView3D *rv3d, Object *ob, float pmat[4] Mat4MulMat4(pmat, vmat, rv3d->winmat); } -/* Uses window coordinates (x,y) and depth component z to find a point in - modelspace */ -void view3d_unproject(bglMats *mats, float out[3], const short x, const short y, const float z) -{ - double ux, uy, uz; - - gluUnProject(x,y,z, mats->modelview, mats->projection, - (GLint *)mats->viewport, &ux, &uy, &uz ); - out[0] = ux; - out[1] = uy; - out[2] = uz; -} /* use above call to get projecting mat */ void view3d_project_float(ARegion *ar, float *vec, float *adr, float mat[4][4]) @@ -1396,7 +1375,6 @@ void VIEW3D_OT_localview(wmOperatorType *ot) /* identifiers */ ot->name= "Local View"; - ot->description= "Toggle display of selected object(s) seperately and centered in view."; ot->idname= "VIEW3D_OT_localview"; /* api callbacks */ @@ -1448,66 +1426,11 @@ static void RestoreState(bContext *C) glPopAttrib(); } -/* was space_set_commmandline_options in 2.4x */ -void game_set_commmandline_options(GameData *gm) -{ - SYS_SystemHandle syshandle; - int test; - - if ( (syshandle = SYS_GetSystem()) ) { - /* User defined settings */ - test= (U.gameflags & USER_DISABLE_SOUND); - /* if user already disabled audio at the command-line, don't re-enable it */ - if (test) - SYS_WriteCommandLineInt(syshandle, "noaudio", test); - - test= (U.gameflags & USER_DISABLE_MIPMAP); - GPU_set_mipmap(!test); - SYS_WriteCommandLineInt(syshandle, "nomipmap", test); - - /* File specific settings: */ - /* Only test the first one. These two are switched - * simultaneously. */ - test= (gm->flag & GAME_SHOW_FRAMERATE); - SYS_WriteCommandLineInt(syshandle, "show_framerate", test); - SYS_WriteCommandLineInt(syshandle, "show_profile", test); - - test = (gm->flag & GAME_SHOW_FRAMERATE); - SYS_WriteCommandLineInt(syshandle, "show_properties", test); - - test= (gm->flag & GAME_SHOW_PHYSICS); - SYS_WriteCommandLineInt(syshandle, "show_physics", test); - - test= (gm->flag & GAME_ENABLE_ALL_FRAMES); - SYS_WriteCommandLineInt(syshandle, "fixedtime", test); - -// a= (G.fileflags & G_FILE_GAME_TO_IPO); -// SYS_WriteCommandLineInt(syshandle, "game2ipo", a); - - test= (gm->flag & GAME_IGNORE_DEPRECATION_WARNINGS); - SYS_WriteCommandLineInt(syshandle, "ignore_deprecation_warnings", test); - - test= (gm->matmode == GAME_MAT_MULTITEX); - SYS_WriteCommandLineInt(syshandle, "blender_material", test); - test= (gm->matmode == GAME_MAT_GLSL); - SYS_WriteCommandLineInt(syshandle, "blender_glsl_material", test); - test= (gm->flag & GAME_DISPLAY_LISTS); - SYS_WriteCommandLineInt(syshandle, "displaylists", test); - - - } -} - /* maybe we need this defined somewhere else */ extern void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int always_use_expand_framing); #endif // GAMEBLENDER == 1 -int game_engine_poll(bContext *C) -{ - return CTX_data_mode_enum(C)==CTX_MODE_OBJECT ? 1:0; -} - static int game_engine_exec(bContext *C, wmOperator *unused) { #if GAMEBLENDER == 1 @@ -1539,8 +1462,6 @@ static int game_engine_exec(bContext *C, wmOperator *unused) view3d_operator_needs_opengl(C); - game_set_commmandline_options(&startscene->gm); - SaveState(C); StartKetsjiShell(C, ar, 1); RestoreState(C); @@ -1564,13 +1485,12 @@ void VIEW3D_OT_game_start(wmOperatorType *ot) /* identifiers */ ot->name= "Start Game Engine"; - ot->description= "Start game engine."; ot->idname= "VIEW3D_OT_game_start"; /* api callbacks */ ot->exec= game_engine_exec; - ot->poll= game_engine_poll; + //ot->poll= ED_operator_view3d_active; } /* ************************************** */ |