diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-24 08:35:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-24 08:35:21 +0400 |
commit | 671cb93f1b38b28fbc349d6a6646f8bea83ebccd (patch) | |
tree | 8921ee06a67273f2a3d6b38cf2dc459aca944273 /source | |
parent | 94b8a81c17e835f0c5185e5396b06ddcb2f684ce (diff) | |
parent | 1e00590f1c2f8d98ed52f8e12d70723165edc9d3 (diff) |
svn merge -r36801:36840 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source')
63 files changed, 431 insertions, 313 deletions
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 20e5bc27146..bf80b033fbd 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -91,12 +91,12 @@ void txt_backspace_word (struct Text *text); int txt_add_char (struct Text *text, char add); int txt_add_raw_char (struct Text *text, char add); int txt_replace_char (struct Text *text, char add); -void txt_export_to_object (struct Text *text); +void txt_export_to_object(struct Text *text); void txt_export_to_objects(struct Text *text); -void unindent (struct Text *text); -void comment (struct Text *text); -void indent (struct Text *text); -void uncomment (struct Text *text); +void txt_unindent (struct Text *text); +void txt_comment (struct Text *text); +void txt_indent (struct Text *text); +void txt_uncomment (struct Text *text); int setcurr_tab_spaces (struct Text *text, int space); void txt_add_marker (struct Text *text, struct TextLine *line, int start, int end, const unsigned char color[4], int group, int flags); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index f64d49f249a..c681e9d5b5c 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1203,7 +1203,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p float tmat[4][4], mat[4][4], pamat[4][4], vec[3], size=0.0; float (*obmat)[4], (*oldobmat)[4]; int a, b, counter, hair = 0; - int totpart, totchild, totgroup=0, pa_num; + int totpart, totchild, totgroup=0 /*, pa_num */; int no_draw_flag = PARS_UNEXIST; @@ -1320,7 +1320,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p if(pa->flag & no_draw_flag) continue; - pa_num = pa->num; + /* pa_num = pa->num; */ /* UNUSED */ pa_time = pa->time; size = pa->size; } @@ -1328,7 +1328,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p /* handle child particle */ cpa = &psys->child[a - totpart]; - pa_num = a; + /* pa_num = a; */ /* UNUSED */ pa_time = psys->particles[cpa->parent].time; size = psys_get_child_size(psys, cpa, ctime, NULL); } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 6813d5d18a6..472d7d77b80 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1189,7 +1189,7 @@ DagNodeQueue * graph_dfs(void) int skip = 0; int minheight; int maxpos=0; - int is_cycle = 0; + /* int is_cycle = 0; */ /* UNUSED */ /* *fprintf(stderr,"starting DFS \n ------------\n"); */ @@ -1245,7 +1245,7 @@ DagNodeQueue * graph_dfs(void) } else { if (itA->node->color == DAG_GRAY) { // back edge fprintf(stderr,"dfs back edge :%15s %15s \n",((ID *) node->ob)->name, ((ID *) itA->node->ob)->name); - is_cycle = 1; + /* is_cycle = 1; */ /* UNUSED */ } else if (itA->node->color == DAG_BLACK) { ; /* already processed node but we may want later to change distance either to shorter to longer. diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index b65392a9a47..c6504ad09c7 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -332,19 +332,12 @@ void fastshade_free_render(void) } } -static int fastshade_customdata_layer_num(int n, int active) -{ - /* make the active layer the first */ - if (n == active) return 0; - else if (n < active) return n+1; - else return n; -} static void fastshade_customdata(CustomData *fdata, int a, int j, Material *ma) { CustomDataLayer *layer; MTFace *mtface; - int index, n, needuv= ma->texco & TEXCO_UV; + int index, needuv= ma->texco & TEXCO_UV; char *vertcol; shi.totuv= 0; @@ -354,7 +347,6 @@ static void fastshade_customdata(CustomData *fdata, int a, int j, Material *ma) layer= &fdata->layers[index]; if(needuv && layer->type == CD_MTFACE && shi.totuv < MAX_MTFACE) { - n= fastshade_customdata_layer_num(shi.totuv, layer->active_rnd); mtface= &((MTFace*)layer->data)[a]; shi.uv[shi.totuv].uv[0]= 2.0f*mtface->uv[j][0]-1.0f; @@ -365,7 +357,6 @@ static void fastshade_customdata(CustomData *fdata, int a, int j, Material *ma) shi.totuv++; } else if(layer->type == CD_MCOL && shi.totcol < MAX_MCOL) { - n= fastshade_customdata_layer_num(shi.totcol, layer->active_rnd); vertcol= (char*)&((MCol*)layer->data)[a*4 + j]; shi.col[shi.totcol].col[0]= ((float)vertcol[3])/255.0f; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 9b3f8713ff0..39f6d1237e5 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1649,12 +1649,6 @@ void object_make_proxy(Object *ob, Object *target, Object *gob) /* there is also a timing calculation in drawobject() */ -static int no_speed_curve= 0; - -void disable_speed_curve(int val) -{ - no_speed_curve= val; -} // XXX THIS CRUFT NEEDS SERIOUS RECODING ASAP! /* ob can be NULL */ diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index b603c1ec54b..d02661075fc 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3059,7 +3059,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf ParticleKey result; float birthtime = 0.0f, dietime = 0.0f; - float t, time = 0.0f, keytime = 0.0f, frs_sec; + float t, time = 0.0f, keytime = 0.0f /*, frs_sec */; float hairmat[4][4], rotmat[3][3], prev_tangent[3] = {0.0f, 0.0f, 0.0f}; int k, i; int steps = (int)pow(2.0, (double)pset->draw_step); @@ -3080,7 +3080,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf recalc_set = 1; } - frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f; + /* frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f; */ /* UNUSED */ if(pset->brushtype == PE_BRUSH_WEIGHT) { ;/* use weight painting colors now... */ diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index e6ff5ab4bd4..d742e32c9e3 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -890,7 +890,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch if(ctx->tree){ KDTreeNearest ptn[10]; int w,maxw;//, do_seams; - float maxd,mind,/*dd,*/totw= 0.0f; + float maxd /*, mind,dd */, totw= 0.0f; int parent[10]; float pweight[10]; @@ -899,7 +899,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch maxw = BLI_kdtree_find_n_nearest(ctx->tree,4,orco1,NULL,ptn); maxd=ptn[maxw-1].dist; - mind=ptn[0].dist; + /* mind=ptn[0].dist; */ /* UNUSED */ /* the weights here could be done better */ for(w=0; w<maxw; w++){ diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index ce45407a75e..85a4b4b7032 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -640,7 +640,7 @@ static void add_mesh_quad_diag_springs(Object *ob) { Mesh *me= ob->data; MFace *mface= me->mface; - BodyPoint *bp; + /*BodyPoint *bp;*/ /*UNUSED*/ BodySpring *bs, *bs_new; int a ; @@ -661,7 +661,7 @@ static void add_mesh_quad_diag_springs(Object *ob) /* fill the tail */ a = 0; bs = bs_new+ob->soft->totspring; - bp= ob->soft->bpoint; + /*bp= ob->soft->bpoint; */ /*UNUSED*/ if(mface ) { for(a=me->totface; a>0; a--, mface++) { if(mface->v4) { @@ -1042,7 +1042,10 @@ static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int GHash *hash; GHashIterator *ihash; float aabbmin[3],aabbmax[3]; - int a, deflected=0; + int deflected=0; +#if 0 + int a; +#endif if ((sb == NULL) || (sb->scratch ==NULL)) return 0; VECCOPY(aabbmin,sb->scratch->aabbmin); @@ -1056,17 +1059,20 @@ static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int ob = BLI_ghashIterator_getKey (ihash); /* only with deflecting set */ if(ob->pd && ob->pd->deflect) { +#if 0 /* UNUSED */ MFace *mface= NULL; MVert *mvert= NULL; MVert *mprevvert= NULL; ccdf_minmax *mima= NULL; +#endif if(ccdm){ +#if 0 /* UNUSED */ mface= ccdm->mface; mvert= ccdm->mvert; mprevvert= ccdm->mprevvert; mima= ccdm->mima; a = ccdm->totface; - +#endif if ((aabbmax[0] < ccdm->bbmin[0]) || (aabbmax[1] < ccdm->bbmin[1]) || (aabbmax[2] < ccdm->bbmin[2]) || @@ -2095,19 +2101,25 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN float dir[3],dvel[3]; float distance,forcefactor,kd,absvel,projvel,kw; +#if 0 /* UNUSED */ int ia,ic; +#endif /* prepare depending on which side of the spring we are on */ if (bpi == bs->v1){ bp1 = &sb->bpoint[bs->v1]; bp2 = &sb->bpoint[bs->v2]; +#if 0 /* UNUSED */ ia =3*bs->v1; ic =3*bs->v2; +#endif } else if (bpi == bs->v2){ bp1 = &sb->bpoint[bs->v2]; bp2 = &sb->bpoint[bs->v1]; +#if 0 /* UNUSED */ ia =3*bs->v2; ic =3*bs->v1; +#endif } else{ /* TODO make this debug option */ @@ -2454,23 +2466,23 @@ static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, fl * this will ruin adaptive stepsize AKA heun! (BM) */ SoftBody *sb= ob->soft; /* is supposed to be there */ - BodyPoint *bproot; + /*BodyPoint *bproot;*/ /* UNUSED */ ListBase *do_effector = NULL; - float gravity; + /* float gravity; */ /* UNUSED */ /* float iks; */ float fieldfactor = -1.0f, windfactor = 0.25; - int do_deflector,do_selfcollision,do_springcollision,do_aero; + int do_deflector /*,do_selfcollision*/ ,do_springcollision,do_aero; - gravity = sb->grav * sb_grav_force_scale(ob); + /* gravity = sb->grav * sb_grav_force_scale(ob); */ /* UNUSED */ /* check conditions for various options */ do_deflector= query_external_colliders(scene, ob); - do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF)); + /* do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF)); */ /* UNUSED */ do_springcollision=do_deflector && (ob->softflag & OB_SB_EDGES) &&(ob->softflag & OB_SB_EDGECOLL); do_aero=((sb->aeroedge)&& (ob->softflag & OB_SB_EDGES)); /* iks = 1.0f/(1.0f-sb->inspring)-1.0f; */ /* inner spring constants function */ /* UNUSED */ - bproot= sb->bpoint; /* need this for proper spring addressing */ + /* bproot= sb->bpoint; */ /* need this for proper spring addressing */ /* UNUSED */ if (do_springcollision || do_aero) sb_sfesf_threads_run(scene, ob, timenow,sb->totspring,NULL); @@ -2516,7 +2528,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa */ SoftBody *sb= ob->soft; /* is supposed to be there */ BodyPoint *bp; - BodyPoint *bproot; + /* BodyPoint *bproot; */ /* UNUSED */ BodySpring *bs; ListBase *do_effector = NULL; float iks, ks, kd, gravity[3] = {0.0f,0.0f,0.0f}; @@ -2547,7 +2559,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa do_aero=((sb->aeroedge)&& (ob->softflag & OB_SB_EDGES)); iks = 1.0f/(1.0f-sb->inspring)-1.0f ;/* inner spring constants function */ - bproot= sb->bpoint; /* need this for proper spring addressing */ + /* bproot= sb->bpoint; */ /* need this for proper spring addressing */ /* UNUSED */ if (do_springcollision || do_aero) scan_for_ext_spring_forces(scene, ob, timenow); /* after spring scan because it uses Effoctors too */ diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 512914e2c52..40eb86f25be 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1894,13 +1894,13 @@ void txt_do_undo(Text *text) if (op==UNDO_INDENT) { - unindent(text); + txt_unindent(text); } else if (op== UNDO_UNINDENT) { - indent(text); + txt_indent(text); } else if (op == UNDO_COMMENT) { - uncomment(text); + txt_uncomment(text); } else if (op == UNDO_UNCOMMENT) { - comment(text); + txt_comment(text); } text->undo_pos--; @@ -2110,13 +2110,13 @@ void txt_do_redo(Text *text) } if (op==UNDO_INDENT) { - indent(text); + txt_indent(text); } else if (op== UNDO_UNINDENT) { - unindent(text); + txt_unindent(text); } else if (op == UNDO_COMMENT) { - comment(text); + txt_comment(text); } else if (op == UNDO_UNCOMMENT) { - uncomment(text); + txt_uncomment(text); } break; default: @@ -2501,7 +2501,7 @@ int txt_replace_char (Text *text, char add) return 1; } -void indent(Text *text) +void txt_indent(Text *text) { int len, num; char *tmp; @@ -2564,7 +2564,7 @@ void indent(Text *text) } } -void unindent(Text *text) +void txt_unindent(Text *text) { int num = 0; const char *remove = "\t"; @@ -2622,7 +2622,7 @@ void unindent(Text *text) } } -void comment(Text *text) +void txt_comment(Text *text) { int len, num; char *tmp; @@ -2674,7 +2674,7 @@ void comment(Text *text) } } -void uncomment(Text *text) +void txt_uncomment(Text *text) { int num = 0; char remove = '#'; @@ -2751,19 +2751,19 @@ int setcurr_tab_spaces (Text *text, int space) * 2) within an identifier * 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414] */ - int a, indent = 0; + int a, is_indent = 0; for(a=0; (a < text->curc) && (text->curl->line[a] != '\0'); a++) { char ch= text->curl->line[a]; if (ch=='#') { break; } else if (ch==':') { - indent = 1; + is_indent = 1; } else if (ch==']' || ch=='}' || ch=='"' || ch=='\'') { - indent = 0; + is_indent = 0; } } - if (indent) { + if (is_indent) { i += space; } } diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index dd4ae781832..360cd1ea9ab 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -86,7 +86,7 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check); #ifdef WIN32 #define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s" #define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s" -#elif __APPLE__ +#elif defined(__APPLE__) #define BLENDER_USER_FORMAT "%s/Blender/%s" #define BLENDER_SYSTEM_FORMAT "%s/Blender/%s" #else diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index f8a85c8ba76..527692348e7 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -1687,13 +1687,13 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node) { if(node->totnode == 0) { - +#if 0 /*UNUSED*/ //Calculate the node min-coords (if the node was a point then this is the point coordinates) float co[3]; co[0] = node->bv[0]; co[1] = node->bv[2]; co[2] = node->bv[4]; - +#endif } else { diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c index 0e122a23faa..8ad93495f6d 100644 --- a/source/blender/blenlib/intern/math_base.c +++ b/source/blender/blenlib/intern/math_base.c @@ -34,7 +34,7 @@ #include "BLI_math.h" /* WARNING: MSVC compiling hack for double_round() */ -#if (WIN32 || WIN64) && !(FREE_WINDOWS) +#if (defined(WIN32) || defined(WIN64)) && !(defined(FREE_WINDOWS)) /* from python 3.1 pymath.c */ double copysign(double x, double y) diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index e9a0ddd4825..301fa34fe7e 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -1437,7 +1437,7 @@ int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data) { float (*planes)[4] = data; int i, axis; - float vmin[3], vmax[3], bb_min[3], bb_max[3]; + float vmin[3] /*, vmax[3]*/, bb_min[3], bb_max[3]; BLI_pbvh_node_get_BB(node, bb_min, bb_max); @@ -1445,11 +1445,11 @@ int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data) for(axis = 0; axis < 3; ++axis) { if(planes[i][axis] > 0) { vmin[axis] = bb_min[axis]; - vmax[axis] = bb_max[axis]; + /*vmax[axis] = bb_max[axis];*/ /*UNUSED*/ } else { vmin[axis] = bb_max[axis]; - vmax[axis] = bb_min[axis]; + /*vmax[axis] = bb_min[axis];*/ /*UNUSED*/ } } diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index cf65539bd68..17b07b49309 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -241,7 +241,7 @@ void BLI_copy_rcti_rctf(rcti *tar, const rctf *src) void print_rctf(const char *str, rctf *rect) { - printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str, rect->xmin, rect->xmax, rect->ymin, rect->xmax, rect->xmax - rect->xmin, rect->ymax - rect->ymin); + printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin); } void print_rcti(const char *str, rcti *rect) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 752c0fc6883..fcc9c676da8 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2117,7 +2117,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) } { - int has_old_groups=0; + /*int has_old_groups=0;*/ /*UNUSED*/ /* XXX this should actually be part of do_versions, but since we need * finished library linking, it is not possible there. Instead in do_versions * we have set the NTREE_DO_VERSIONS flag, so at this point we can do the @@ -2127,7 +2127,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) if (ntree->flag & NTREE_DO_VERSIONS) { /* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */ nodeGroupExposeAllSockets(ntree); - has_old_groups = 1; + /*has_old_groups = 1;*/ /*UNUSED*/ } } /* now verify all types in material trees, groups are set OK now */ @@ -4204,7 +4204,6 @@ static void direct_link_object(FileData *fd, Object *ob) bSensor *sens; bController *cont; bActuator *act; - int a; /* weak weak... this was only meant as draw flag, now is used in give_base_to_objects too */ ob->flag &= ~OB_FROMGROUP; @@ -4304,6 +4303,7 @@ static void direct_link_object(FileData *fd, Object *ob) sb->keys= newdataadr(fd, sb->keys); test_pointer_array(fd, (void **)&sb->keys); if(sb->keys) { + int a; for(a=0; a<sb->totkey; a++) { sb->keys[a]= newdataadr(fd, sb->keys[a]); } @@ -8444,7 +8444,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ArmatureModifierData *amd = (ArmatureModifierData*) md; if(amd->object && amd->deformflag==0) { Object *oba= newlibadr(fd, lib, amd->object); - bArmature *arm= newlibadr(fd, lib, oba->data); + arm= newlibadr(fd, lib, oba->data); amd->deformflag= arm->deformflag; } } @@ -8591,7 +8591,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) int a; for(a=0; a<MAX_MTEX; a++) { if(ma->mtex[a] && ma->mtex[a]->tex) { - Tex *tex= newlibadr(fd, lib, ma->mtex[a]->tex); + tex= newlibadr(fd, lib, ma->mtex[a]->tex); if(tex && tex->type==TEX_STUCCI) ma->mtex[a]->mapto &= ~(MAP_COL|MAP_SPEC|MAP_REF); } @@ -8783,7 +8783,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* now, subversion control! */ if(main->subversionfile < 3) { - bScreen *sc; Image *ima; Tex *tex; @@ -10199,7 +10198,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ToolSettings *ts; //PTCacheID *pid; //ListBase pidlist; - int a; for(ob = main->object.first; ob; ob = ob->id.next) { //BKE_ptcache_ids_from_object(&pidlist, ob); @@ -10238,6 +10236,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } for(ma = main->mat.first; ma; ma = ma->id.next) { + int a; if(ma->mode & MA_WIRE) { ma->material_type= MA_TYPE_WIRE; ma->mode &= ~MA_WIRE; @@ -12782,10 +12781,11 @@ static int object_in_any_scene(Main *mainvar, Object *ob) } /* when *lib set, it also does objects that were in the appended group */ -static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, int is_group_append) +static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const short idcode, const short is_link) { Object *ob; Base *base; + const short is_group_append= (is_link==FALSE && idcode==ID_GR); /* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */ for(ob= mainvar->object.first; ob; ob= ob->id.next) { @@ -12804,16 +12804,20 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, int is if(ob->id.us==0) { do_it= 1; } - else if (lib==NULL) { /* appending */ - if(object_in_any_scene(mainvar, ob)==0) { - /* when appending, make sure any indirectly loaded objects - * get a base else they cant be accessed at all [#27437] */ - do_it= 1; + else if(idcode==ID_GR) { + if(ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) { + if((ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) { + do_it= 1; + } } } - else if(ob->id.us==1 && lib) { - if(ob->id.lib==lib && (ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) { - do_it= 1; + else { + /* when appending, make sure any indirectly loaded objects + * get a base else they cant be accessed at all [#27437] */ + if(ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) { + if(object_in_any_scene(mainvar, ob)==0) { + do_it= 1; + } } } @@ -13069,21 +13073,16 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in /* give a base to loose objects. If group append, do it for objects too */ if(scene) { + const short is_link= (flag & FILE_LINK) != 0; if(idcode==ID_SCE) { /* dont instance anything when linking in scenes, assume the scene its self instances the data */ } - else if(idcode==ID_GR) { - if (flag & FILE_LINK) { - give_base_to_objects(mainvar, scene, NULL, 0); - } else { - give_base_to_objects(mainvar, scene, curlib, 1); - } + else { + give_base_to_objects(mainvar, scene, curlib, idcode, is_link); if (flag & FILE_GROUP_INSTANCE) { give_base_to_groups(mainvar, scene); } - } else { - give_base_to_objects(mainvar, scene, NULL, 0); } } else { diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 348405697e3..de0d47ea85c 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2132,8 +2132,8 @@ static void write_screens(WriteData *wd, ListBase *scrbase) writestruct(wd, DATA, "SpaceText", 1, sl); } else if(sl->spacetype==SPACE_SCRIPT) { - SpaceScript *sc = (SpaceScript*)sl; - sc->but_refs = NULL; + SpaceScript *scr = (SpaceScript*)sl; + scr->but_refs = NULL; writestruct(wd, DATA, "SpaceScript", 1, sl); } else if(sl->spacetype==SPACE_ACTION) { diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index c4108e0ce33..00e11d8b1a4 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -372,7 +372,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree, blocks->root= (DLRBT_Node *)new_ab; } else { - ActKeyBlock *ab, *abp=NULL, *abn=NULL; + ActKeyBlock *ab, *abn=NULL; /* try to find a keyblock that starts on the previous beztriple, and add a new one if none start there * Note: we can't search from end to try to optimise this as it causes errors there's @@ -382,7 +382,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree, // A|--------------|A ______________ B|--------------|B // A|------------------------------------------------|A // A|----|A|---|A|-----------------------------------|A - for (ab= blocks->root; ab; abp= ab, ab= abn) { + for (ab= blocks->root; ab; ab= abn) { /* check if this is a match, or whether we go left or right */ if (ab->start == prev->vec[1][0]) { /* set selection status and 'touched' status */ diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index fbb7915ebea..28d53ddd9ca 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2356,6 +2356,7 @@ EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name) void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) { Object *obedit= scene->obedit; // XXX get from context + bArmature *arm= obedit->data; float obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3]; EditBone *bone; @@ -2374,7 +2375,9 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) ED_armature_deselect_all(obedit, 0); /* Create a bone */ - bone= ED_armature_edit_bone_add(obedit->data, "Bone"); + bone= ED_armature_edit_bone_add(arm, "Bone"); + + arm->act_edbone= bone; copy_v3_v3(bone->head, curs); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 719362d82c5..8176aa5893b 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1169,7 +1169,7 @@ void POSE_OT_paste (wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "flipped", 0, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose"); - RNA_def_boolean(ot->srna, "selected_mask", 0, "On Selected Only", "Only paste the stored post on to selected bones in the current pose"); + RNA_def_boolean(ot->srna, "selected_mask", 0, "On Selected Only", "Only paste the stored pose on to selected bones in the current pose"); } /* ********************************************** */ diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 0b582acf589..284bbb2f3de 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -780,7 +780,7 @@ static void calc_shapeKeys(Object *obedit) /* are there keys? */ if(cu->key) { - int a, i, j; + int a, i; EditNurb *editnurb= cu->editnurb; KeyBlock *currkey; KeyBlock *actkey= BLI_findlink(&cu->key->block, editnurb->shapenr-1); @@ -804,7 +804,6 @@ static void calc_shapeKeys(Object *obedit) } if(act_is_basis) { /* active key is a base */ - int j; int totvec= 0; /* Calculate needed memory to store offset */ @@ -831,6 +830,7 @@ static void calc_shapeKeys(Object *obedit) oldbezt= getKeyIndexOrig_bezt(editnurb, bezt); if (oldbezt) { + int j; for (j= 0; j < 3; ++j) { VECSUB(ofs[i], bezt->vec[j], oldbezt->vec[j]); i++; @@ -878,6 +878,7 @@ static void calc_shapeKeys(Object *obedit) bezt= nu->bezt; a= nu->pntsu; while(a--) { + int j; oldbezt= getKeyIndexOrig_bezt(editnurb, bezt); for (j= 0; j < 3; ++j, ++i) { @@ -932,6 +933,7 @@ static void calc_shapeKeys(Object *obedit) while(a--) { index= getKeyIndexOrig_keyIndex(editnurb, bezt); if (index >= 0) { + int j; curofp= ofp + index; for (j= 0; j < 3; ++j, ++i) { @@ -953,6 +955,7 @@ static void calc_shapeKeys(Object *obedit) fp+= 3; /* alphas */ } else { + int j; for (j= 0; j < 3; ++j, ++i) { VECCOPY(fp, bezt->vec[j]); fp+= 3; diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index b93e4b07302..a275a5f908a 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -790,7 +790,7 @@ void draw_gpencil_view3d_ext (Scene *scene, View3D *v3d, ARegion *ar, short only * deal with the camera border, otherwise map the coords to the camera border. */ if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) { rctf rectf; - view3d_calc_camera_border(scene, ar, rv3d, v3d, &rectf, -1); /* negative shift */ + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, -1); /* negative shift */ BLI_copy_rcti_rctf(&rect, &rectf); } else { diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 83dec47bf8b..27f2598d515 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -453,7 +453,7 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect) /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { - view3d_calc_camera_border(scene, ar, NULL, v3d, subrect, -1); /* negative shift */ + ED_view3d_calc_camera_border(scene, ar, v3d, NULL, subrect, -1); /* negative shift */ return 1; } } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index eafdfc9881e..dd27810015b 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1130,7 +1130,7 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode) /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { - view3d_calc_camera_border(p->scene, p->ar, NULL, v3d, &p->subrect_data, -1); /* negative shift */ + ED_view3d_calc_camera_border(p->scene, p->ar, v3d, NULL, &p->subrect_data, -1); /* negative shift */ p->subrect= &p->subrect_data; } } diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index afb70491a12..236502e5005 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -150,17 +150,56 @@ void ED_view3d_win_to_ray(struct ARegion *ar, struct View3D *v3d, const float mv */ void ED_view3d_global_to_vector(struct RegionView3D *rv3d, const float coord[3], float vec[3]); +/** + * Calculate the view transformation matrix from RegionView3D input. + * The resulting matrix is equivilent to RegionView3D.viewinv + * @param mat The view 4x4 transformation matrix to calculate. + * @param ofs The view offset, normally from RegionView3D.ofs. + * @param quat The view rotation, quaternion normally from RegionView3D.viewquat. + * @param dist The view distance from ofs, normally from RegionView3D.dist. + */ +void ED_view3d_to_m4(float mat[][4], const float ofs[3], const float quat[4], const float dist); + +/** + * Set the view transformation from a 4x4 matrix. + * @param mat The view 4x4 transformation matrix to assign. + * @param ofs The view offset, normally from RegionView3D.ofs. + * @param quat The view rotation, quaternion normally from RegionView3D.viewquat. + * @param dist The view distance from ofs, normally from RegionView3D.dist. + */ +void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist); + +/** + * Set the RegionView3D members from an objects transformation and optionally lens. + * @param ob The object to set the view to. + * @param ofs The view offset to be set, normally from RegionView3D.ofs. + * @param quat The view rotation to be set, quaternion normally from RegionView3D.viewquat. + * @param dist The view distance from ofs to be set, normally from RegionView3D.dist. + */ +void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens); + +/** + * Set the object transformation from RegionView3D members. + * @param ob The object which has the transformation assigned. + * @param ofs The view offset, normally from RegionView3D.ofs. + * @param quat The view rotation, quaternion normally from RegionView3D.viewquat. + * @param dist The view distance from ofs, normally from RegionView3D.dist. + */ +void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist); + +//#if 0 /* UNUSED */ void view3d_unproject(struct bglMats *mats, float out[3], const short x, const short y, const float z); +//#endif /* Depth buffer */ -void view3d_update_depths(struct ARegion *ar); -float read_cached_depth(struct ViewContext *vc, int x, int y); -void request_depth_update(struct RegionView3D *rv3d); +void ED_view3d_depth_update(struct ARegion *ar); +float ED_view3d_depth_read_cached(struct ViewContext *vc, int x, int y); +void ED_view3d_depth_tag_update(struct RegionView3D *rv3d); /* Projection */ #define IS_CLIPPED 12000 -void view3d_calculate_clipping(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, struct rcti *rect); +void ED_view3d_calc_clipping(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, struct rcti *rect); void project_short(struct ARegion *ar, const float vec[3], short adr[2]); void project_short_noclip(struct ARegion *ar, const float vec[3], short adr[2]); @@ -171,13 +210,13 @@ void project_int_noclip(struct ARegion *ar, const float vec[3], int adr[2]); void project_float(struct ARegion *ar, const float vec[3], float adr[2]); void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]); -void get_object_clip_range(struct Object *ob, float *lens, float *clipsta, float *clipend); -int get_view3d_cliprange(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend); -int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize); -void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); -void view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]); -void view3d_project_float_v3(struct ARegion *a, float *vec, float *adr, float mat[4][4]); -void view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, struct View3D *v3d, struct rctf *viewborder_r, short do_shift); +void ED_view3d_ob_clip_range_get(struct Object *ob, float *lens, float *clipsta, float *clipend); +int ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend); +int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize); +void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); +void ED_view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]); +void ED_view3d_project_float_v3(struct ARegion *a, float *vec, float *adr, float mat[4][4]); +void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short do_shift); /* drawobject.c iterators */ void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, int x, int y, int index), void *userData, int clipVerts); @@ -187,9 +226,9 @@ void nurbs_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData void lattice_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BPoint *bp, int x, int y), void *userData); void ED_view3d_local_clipping(struct RegionView3D *rv3d, float mat[][4]); -int view3d_test_clipping(struct RegionView3D *rv3d, const float vec[3], const int local); -void view3d_align_axis_to_vector(struct View3D *v3d, struct RegionView3D *rv3d, int axisidx, float vec[3]); -float view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]); +int ED_view3d_test_clipping(struct RegionView3D *rv3d, const float vec[3], const int local); +void ED_view3d_align_axis_to_vector(struct View3D *v3d, struct RegionView3D *rv3d, int axisidx, float vec[3]); +float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]); void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]); @@ -248,14 +287,8 @@ int ED_view3d_lock(struct RegionView3D *rv3d); unsigned int ED_view3d_datamask(struct Scene *scene, struct View3D *v3d); unsigned int ED_viewedit_datamask(struct bScreen *screen); - -/* assigning view matrix */ -void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist); - -void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens); -void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist); - /* camera lock functions */ +int ED_view3d_camera_lock_check(struct View3D *v3d, struct RegionView3D *rv3d); /* copy the camera to the view before starting a view transformation */ void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d); /* copy the view to the camera */ diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index 5b9620cd2f8..8ba0d33a069 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -476,7 +476,7 @@ static void findnearestedge__doClosest(void *userData, BMEdge *eed, int x0, int vec[2]= eed->v1->co[2] + labda*(eed->v2->co[2] - eed->v1->co[2]); mul_m4_v3(data->vc.obedit->obmat, vec); - if(view3d_test_clipping(data->vc.rv3d, vec, 1)==0) { + if(ED_view3d_test_clipping(data->vc.rv3d, vec, 1)==0) { data->dist = distance; data->closest = eed; } diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index f54c7c4e012..13eb7517e31 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -2661,8 +2661,8 @@ static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *c { float vec1[3], vec2[3], mvalf[2]; - view3d_project_float(ar, co1, vec1, mat); - view3d_project_float(ar, co2, vec2, mat); + ED_view3d_project_float(ar, co1, vec1, mat); + ED_view3d_project_float(ar, co2, vec2, mat); mvalf[0]= (float)mval[0]; mvalf[1]= (float)mval[1]; @@ -2688,7 +2688,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1], 0.0f}; float dist = FLT_MAX, d; - view3d_get_object_project_mat(rv3d, obedit, projectMat); + ED_view3d_ob_project_mat_get(rv3d, obedit, projectMat); BM_ITER(e, &iter, em->bm, BM_EDGES_OF_MESH, NULL) { if (BM_TestHFlag(e, BM_SELECT)) @@ -2802,7 +2802,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) add_v3_v3v3(mid, mid, vec); /*yay we have our comparison point, now project it*/ - view3d_project_float(ar, mid, mid, projectMat); + ED_view3d_project_float(ar, mid, mid, projectMat); vec[0] = fmval[0] - mid[0]; vec[1] = fmval[1] - mid[1]; diff --git a/source/blender/editors/mesh/knifetool.c b/source/blender/editors/mesh/knifetool.c index 7184d99ff3b..be36cb4a69b 100755 --- a/source/blender/editors/mesh/knifetool.c +++ b/source/blender/editors/mesh/knifetool.c @@ -193,8 +193,10 @@ static void knife_project_v3(knifetool_opdata *kcd, float co[3], float sco[3]) sco[0] = (float)(kcd->ar->winx/2.0f)+(kcd->ar->winx/2.0f)*sco[0]; sco[1] = (float)(kcd->ar->winy/2.0f)+(kcd->ar->winy/2.0f)*sco[1]; - } else - view3d_project_float(kcd->ar, co, sco, kcd->projmat); + } + else { + ED_view3d_project_float(kcd->ar, co, sco, kcd->projmat); + } } static KnifeEdge *new_knife_edge(knifetool_opdata *kcd) @@ -1064,7 +1066,7 @@ static int knife_sample_screen_density(knifetool_opdata *kcd, float radius) copy_v3_v3(vec, kfv->co); mul_m4_v3(kcd->vc.obedit->obmat, vec); - if(view3d_test_clipping(kcd->vc.rv3d, vec, 1)==0) { + if(ED_view3d_test_clipping(kcd->vc.rv3d, vec, 1)==0) { c++; } } else { @@ -1135,7 +1137,7 @@ static KnifeEdge *knife_find_closest_edge(knifetool_opdata *kcd, float p[3], BMF vec[2]= kfe->v1->co[2] + labda*(kfe->v2->co[2] - kfe->v1->co[2]); mul_m4_v3(kcd->vc.obedit->obmat, vec); - if(view3d_test_clipping(kcd->vc.rv3d, vec, 1)==0) { + if(ED_view3d_test_clipping(kcd->vc.rv3d, vec, 1)==0) { cure = kfe; curdis = dis; } @@ -1222,7 +1224,7 @@ static KnifeVert *knife_find_closest_vert(knifetool_opdata *kcd, float p[3], BMF copy_v3_v3(vec, kfv->co); mul_m4_v3(kcd->vc.obedit->obmat, vec); - if(view3d_test_clipping(kcd->vc.rv3d, vec, 1)==0) { + if(ED_view3d_test_clipping(kcd->vc.rv3d, vec, 1)==0) { curv = kfv; curdis = dis; } @@ -1627,7 +1629,7 @@ static void knifetool_finish(bContext *C, wmOperator *op) /*copied from paint_image.c*/ static int project_knife_view_clip(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend) { - int orth= get_view3d_cliprange(v3d, rv3d, clipsta, clipend); + int orth= ED_view3d_clip_range_get(v3d, rv3d, clipsta, clipend); if (orth) { /* only needed for ortho */ float fac = 2.0f / ((*clipend) - (*clipsta)); @@ -1646,7 +1648,7 @@ static void knife_recalc_projmat(knifetool_opdata *kcd) return; invert_m4_m4(kcd->ob->imat, kcd->ob->obmat); - view3d_get_object_project_mat(ar->regiondata, kcd->ob, kcd->projmat); + ED_view3d_ob_project_mat_get(ar->regiondata, kcd->ob, kcd->projmat); //mul_m4_m4m4(kcd->projmat, kcd->vc.rv3d->viewmat, kcd->vc.rv3d->winmat); kcd->is_ortho = project_knife_view_clip(kcd->vc.v3d, kcd->vc.rv3d, diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 57ea7e761c0..ec102701b1b 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1542,11 +1542,12 @@ static void single_mat_users(Scene *scene, int flag, int do_textures) if(do_textures) { for(b=0; b<MAX_MTEX; b++) { - if(ma->mtex[b] && ma->mtex[b]->tex) { - tex= ma->mtex[b]->tex; + if(ma->mtex[b] && (tex= ma->mtex[b]->tex)) { if(tex->id.us>1) { - ma->mtex[b]->tex= copy_texture(tex); tex->id.us--; + tex= copy_texture(tex); + BKE_copy_animdata_id_action(&tex->id); + ma->mtex[b]->tex= tex; } } } @@ -1817,11 +1818,12 @@ static int make_single_user_exec(bContext *C, wmOperator *op) single_obdata_users(bmain, scene, flag); if(RNA_boolean_get(op->ptr, "material")) - single_mat_users(scene, flag, FALSE); + single_mat_users(scene, flag, RNA_boolean_get(op->ptr, "texture")); +#if 0 /* can't do this separate from materials */ if(RNA_boolean_get(op->ptr, "texture")) single_mat_users(scene, flag, TRUE); - +#endif if(RNA_boolean_get(op->ptr, "animation")) single_object_action_users(scene, flag); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 1ce702b0a69..1479a092381 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -385,7 +385,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data) /* we may need to force an update here by setting the rv3d as dirty * for now it seems ok, but take care!: * rv3d->depths->dirty = 1; */ - view3d_update_depths(data->vc.ar); + ED_view3d_depth_update(data->vc.ar); } } } @@ -3461,7 +3461,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) ParticleBrushData *brush= &pset->brush[pset->brushtype]; ARegion *ar= CTX_wm_region(C); float vec[3], mousef[2]; - int mval[2], mvalo[2]; + int mval[2]; int flip, mouse[2], dx, dy, removed= 0, added=0, selected= 0; int lock_root = pset->flag & PE_LOCK_FIRST; @@ -3484,8 +3484,6 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) mval[0]= mouse[0]; mval[1]= mouse[1]; - mvalo[0]= bedit->lastmouse[0]; - mvalo[1]= bedit->lastmouse[1]; /* disable locking temporatily for disconnected hair */ if(edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 0a279e412f6..98463ce955f 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -149,7 +149,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) rctf viewplane; float clipsta, clipend; - int is_ortho= get_view3d_viewplane(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL); + int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL); if(is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend); else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend); } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index e942cfc8b1f..9bc2b1a402c 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1595,12 +1595,12 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa) if(sa && sa->full) { ScrArea *old; - short fulltype; + /*short fulltype;*/ /*UNUSED*/ sc= sa->full; /* the old screen to restore */ oldscreen= win->screen; /* the one disappearing */ - fulltype = sc->full; + /*fulltype = sc->full;*/ sc->full= 0; /* removed: SCREENAUTOPLAY exception here */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 7706a607e70..0716a22b8cc 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2614,7 +2614,7 @@ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op)) */ if((ar == NULL) || (ar->regiontype != RGN_TYPE_HEADER)) { ScrArea *sa= CTX_wm_area(C); - ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER); + ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER); /* don't do anything if no region */ if(ar == NULL) diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 2080ac3609f..bfd6ba8ac9d 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -766,7 +766,7 @@ static int project_paint_occlude_ptv_clip( if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w); else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w); - if(!view3d_test_clipping(ps->rv3d, wco, 1)) { + if(!ED_view3d_test_clipping(ps->rv3d, wco, 1)) { return 1; } @@ -2349,7 +2349,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i /* a pitty we need to get the worldspace pixel location here */ if(do_clip) { interp_v3_v3v3v3(wco, ps->dm_mvert[ (*(&mf->v1 + i1)) ].co, ps->dm_mvert[ (*(&mf->v1 + i2)) ].co, ps->dm_mvert[ (*(&mf->v1 + i3)) ].co, w); - if(view3d_test_clipping(ps->rv3d, wco, 1)) { + if(ED_view3d_test_clipping(ps->rv3d, wco, 1)) { continue; /* Watch out that no code below this needs to run */ } } @@ -2572,7 +2572,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w); else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w); - if(view3d_test_clipping(ps->rv3d, wco, 1)) { + if(ED_view3d_test_clipping(ps->rv3d, wco, 1)) { continue; /* Watch out that no code below this needs to run */ } } @@ -2814,7 +2814,7 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, static int project_paint_view_clip(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend) { - int orth= get_view3d_cliprange(v3d, rv3d, clipsta, clipend); + int orth= ED_view3d_clip_range_get(v3d, rv3d, clipsta, clipend); if (orth) { /* only needed for ortho */ float fac = 2.0f / ((*clipend) - (*clipsta)); @@ -2956,7 +2956,7 @@ static void project_paint_begin(ProjPaintState *ps) copy_m4_m4(viewmat, ps->rv3d->viewmat); copy_m4_m4(viewinv, ps->rv3d->viewinv); - view3d_get_object_project_mat(ps->rv3d, ps->ob, ps->projectMat); + ED_view3d_ob_project_mat_get(ps->rv3d, ps->ob, ps->projectMat); ps->is_ortho= project_paint_view_clip(ps->v3d, ps->rv3d, &ps->clipsta, &ps->clipend); } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 1da54684b5f..d6d6d2f819b 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -293,7 +293,7 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, return rect->xmin < rect->xmax && rect->ymin < rect->ymax;; } */ - view3d_get_object_project_mat(rv3d, ob, pmat); + ED_view3d_ob_project_mat_get(rv3d, ob, pmat); if(!pbvh) return 0; @@ -313,7 +313,7 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, vec[0] = i ? bb_min[0] : bb_max[0]; vec[1] = j ? bb_min[1] : bb_max[1]; vec[2] = k ? bb_min[2] : bb_max[2]; - view3d_project_float(ar, vec, proj, pmat); + ED_view3d_project_float(ar, vec, proj, pmat); rect->xmin = MIN2(rect->xmin, proj[0]); rect->xmax = MAX2(rect->xmax, proj[0]); rect->ymin = MIN2(rect->ymin, proj[1]); @@ -370,7 +370,7 @@ void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar, rect.ymax -= 2; #endif - view3d_calculate_clipping(&bb, planes, &mats, &rect); + ED_view3d_calc_clipping(&bb, planes, &mats, &rect); mul_m4_fl(planes, -1.0f); /* clear redraw flag from nodes */ diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 9190d5aff54..9b914df1b3c 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -51,6 +51,7 @@ #include "WM_types.h" #include "ED_screen.h" +#include "ED_util.h" #include "RNA_access.h" @@ -131,7 +132,19 @@ static int file_browse_exec(bContext *C, wmOperator *op) RNA_property_update(C, &fbo->ptr, fbo->prop); MEM_freeN(str); + + /* special, annoying exception, filesel on redo panel [#26618] */ + { + wmOperator *redo_op= WM_operator_last_redo(C); + if(redo_op) { + if(fbo->ptr.data == redo_op->ptr->data) { + ED_undo_operator_repeat(C, redo_op); + } + } + } + MEM_freeN(op->customdata); + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index daae0ad6625..da7a95cdbf7 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -822,9 +822,9 @@ static int graphkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEve /* determine which side of the current frame mouse is on */ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL); if (x < CFRA) - RNA_int_set(op->ptr, "mode", GRAPHKEYS_LRSEL_LEFT); + RNA_enum_set(op->ptr, "mode", GRAPHKEYS_LRSEL_LEFT); else - RNA_int_set(op->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT); + RNA_enum_set(op->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT); } /* perform selection */ diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 635e922cd65..2bd6bd624df 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -894,7 +894,7 @@ static int indent_exec(bContext *C, wmOperator *UNUSED(op)) if(txt_has_sel(text)) { txt_order_cursors(text); - indent(text); + txt_indent(text); } else txt_add_char(text, '\t'); @@ -929,7 +929,7 @@ static int unindent_exec(bContext *C, wmOperator *UNUSED(op)) text_drawcache_tag_update(CTX_wm_space_text(C), 0); txt_order_cursors(text); - unindent(text); + txt_unindent(text); text_update_edited(text); @@ -1011,7 +1011,7 @@ static int comment_exec(bContext *C, wmOperator *UNUSED(op)) text_drawcache_tag_update(CTX_wm_space_text(C), 0); txt_order_cursors(text); - comment(text); + txt_comment(text); text_update_edited(text); text_update_cursor_moved(C); @@ -1044,7 +1044,7 @@ static int uncomment_exec(bContext *C, wmOperator *UNUSED(op)) text_drawcache_tag_update(CTX_wm_space_text(C), 0); txt_order_cursors(text); - uncomment(text); + txt_uncomment(text); text_update_edited(text); text_update_cursor_moved(C); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 0ef3a56cb46..076a8ceb52e 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -150,7 +150,7 @@ static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr, int l /* clipplanes in eye space */ if(rv3d->rflag & RV3D_CLIPPING) { - if(view3d_test_clipping(rv3d, vec, local)) + if(ED_view3d_test_clipping(rv3d, vec, local)) return; } @@ -633,7 +633,7 @@ void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]) /* circle for object centers, special_color is for library or ob users */ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3], int selstate, int special_color) { - const float size= view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f; + const float size= ED_view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f; /* using gldepthfunc guarantees that it does write z values, but not checks for it, so centers remain visible independt order of drawing */ if(v3d->zbuf) glDepthFunc(GL_ALWAYS); @@ -1018,7 +1018,7 @@ static void draw_transp_spot_volume(Lamp *la, float x, float z) static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int dt, int flag) { Object *ob= base->object; - const float pixsize= view3d_pixel_size(rv3d, ob->obmat[3]); + const float pixsize= ED_view3d_pixel_size(rv3d, ob->obmat[3]); Lamp *la= ob->data; float vec[3], lvec[3], vvec[3], circrad, x,y,z; float lampsize; @@ -2960,7 +2960,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } else { /* don't create boundbox here with mesh_get_bb(), the derived system will make it, puts deformed bb's OK */ - if(me->totface<=4 || boundbox_clip(rv3d, ob->obmat, (ob->bb)? ob->bb: me->bb)) { + if(me->totface<=4 || ED_view3d_boundbox_clip(rv3d, ob->obmat, (ob->bb)? ob->bb: me->bb)) { glsl = draw_glsl_material(scene, ob, v3d, dt); check_alpha = check_material_alpha(base, me, glsl); @@ -3746,7 +3746,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv case PART_DRAW_CROSS: case PART_DRAW_AXIS: /* lets calculate the scale: */ - pixsize= view3d_pixel_size(rv3d, ob->obmat[3]); + pixsize= ED_view3d_pixel_size(rv3d, ob->obmat[3]); if(part->draw_size==0.0) pixsize *= 2.0f; @@ -5596,7 +5596,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base) hasfaces= displist_has_faces(&ob->disp); } - if (hasfaces && boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { + if (hasfaces && ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { draw_index_wire= 0; if (dm) { draw_mesh_object_outline(v3d, ob, dm); @@ -5649,7 +5649,7 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob) if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) { Curve *cu = ob->data; - if (boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { + if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { if (ob->type==OB_CURVE) draw_index_wire= 0; @@ -6084,7 +6084,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) draw_bounding_volume(scene, ob); } - else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) + else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) empty_object= drawDispList(scene, v3d, rv3d, base, dt); break; @@ -6100,7 +6100,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) draw_bounding_volume(scene, ob); } - else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { + else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { empty_object= drawDispList(scene, v3d, rv3d, base, dt); //XXX old animsys if(cu->path) diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index adce40f58ce..7e9c219fdaa 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -206,7 +206,7 @@ static int test_clipping(const float vec[3], float clip[][4]) /* for 'local' ED_view3d_local_clipping must run first * then all comparisons can be done in localspace */ -int view3d_test_clipping(RegionView3D *rv3d, const float vec[3], const int local) +int ED_view3d_test_clipping(RegionView3D *rv3d, const float vec[3], const int local) { return test_clipping(vec, local ? rv3d->clip_local : rv3d->clip); } @@ -869,7 +869,7 @@ void view3d_viewborder_size_get(Scene *scene, ARegion *ar, float size_r[2]) } } -void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r, short do_shift) +void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short do_shift) { const float zoomfac= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom); float size[2]; @@ -998,7 +998,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) if(v3d->camera->type==OB_CAMERA) ca = v3d->camera->data; - view3d_calc_camera_border(scene, ar, rv3d, v3d, &viewborder, FALSE); + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE); /* the offsets */ x1= viewborder.xmin; y1= viewborder.ymin; @@ -1398,7 +1398,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d) if(rv3d->persp==RV3D_CAMOB) { rctf vb; - view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb, FALSE); + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE); x1= vb.xmin; y1= vb.ymin; @@ -1418,7 +1418,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d) asp= ( (float)ibuf->y)/(float)ibuf->x; vec[0] = vec[1] = vec[2] = 0.0; - view3d_project_float(ar, vec, sco, rv3d->persmat); + ED_view3d_project_float(ar, vec, sco, rv3d->persmat); cx = sco[0]; cy = sco[1]; @@ -1678,7 +1678,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas } if(use_displist) { glMultMatrixf(dob->mat); - if(boundbox_clip(rv3d, dob->mat, &bb)) + if(ED_view3d_boundbox_clip(rv3d, dob->mat, &bb)) glCallList(displist); glLoadMatrixf(rv3d->viewmat); } @@ -1768,7 +1768,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect) } /* note, with nouveau drivers the glReadPixels() is very slow. [#24339] */ -void view3d_update_depths(ARegion *ar) +void ED_view3d_depth_update(ARegion *ar) { RegionView3D *rv3d= ar->regiondata; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 95e845b3462..4aa3a6a36c4 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -82,19 +82,57 @@ /* ********************** view3d_edit: view manipulations ********************* */ +int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d) +{ + return ((v3d->camera) && + (v3d->camera->id.lib == NULL) && + (v3d->flag2 & V3D_LOCK_CAMERA) && + (rv3d->persp==RV3D_CAMOB)); +} + void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d) { - if(v3d->camera && (v3d->flag2 & V3D_LOCK_CAMERA) && (rv3d->persp==RV3D_CAMOB)) { + if(ED_view3d_camera_lock_check(v3d, rv3d)) { ED_view3d_from_object(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL); } } void ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) { - if(v3d->camera && (v3d->flag2 & V3D_LOCK_CAMERA) && (rv3d->persp==RV3D_CAMOB)) { - ED_view3d_to_object(v3d->camera, rv3d->ofs, rv3d->viewquat, rv3d->dist); - DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB); - WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, v3d->camera); + if(ED_view3d_camera_lock_check(v3d, rv3d)) { + Object *root_parent; + + if((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (root_parent= v3d->camera->parent)) { + Object *ob_update; + float view_mat[4][4]; + float diff_mat[4][4]; + float parent_mat[4][4]; + + while(root_parent->parent) { + root_parent= root_parent->parent; + } + + ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); + + invert_m4_m4(v3d->camera->imat, v3d->camera->obmat); + mul_m4_m4m4(diff_mat, v3d->camera->imat, view_mat); + + mul_m4_m4m4(parent_mat, root_parent->obmat, diff_mat); + object_apply_mat4(root_parent, parent_mat, TRUE, FALSE); + + ob_update= v3d->camera; + while(ob_update) { + DAG_id_tag_update(&ob_update->id, OB_RECALC_OB); + WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, ob_update); + ob_update= ob_update->parent; + } + } + else { + ED_view3d_to_object(v3d->camera, rv3d->ofs, rv3d->viewquat, rv3d->dist); + root_parent= v3d->camera; + DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB); + WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, v3d->camera); + } } } @@ -783,7 +821,7 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event) viewrotate_apply(vod, event->x, event->y); } else if (event_code==VIEW_CONFIRM) { - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -811,7 +849,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event) if(rv3d->persp != RV3D_PERSP) { if (U.uiflag & USER_AUTOPERSP) { - if(!((rv3d->persp==RV3D_CAMOB) && (vod->v3d->flag2 & V3D_LOCK_CAMERA))) { + if(!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) { rv3d->persp= RV3D_PERSP; } } @@ -822,7 +860,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event) ED_view3d_from_object(vod->v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL); } - if(!(vod->v3d->flag2 & V3D_LOCK_CAMERA)) { + if(!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) { rv3d->persp= rv3d->lpersp; } } @@ -831,7 +869,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event) if (event->type == MOUSEPAN) { viewrotate_apply(vod, event->prevx, event->prevy); - request_depth_update(rv3d); + ED_view3d_depth_tag_update(rv3d); viewops_data_free(C, op); @@ -840,7 +878,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event) else if (event->type == MOUSEROTATE) { /* MOUSEROTATE performs orbital rotation, so y axis delta is set to 0 */ viewrotate_apply(vod, event->prevx, event->y); - request_depth_update(rv3d); + ED_view3d_depth_tag_update(rv3d); viewops_data_free(C, op); @@ -923,7 +961,7 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf) static void viewmove_apply(ViewOpsData *vod, int x, int y) { - if((vod->rv3d->persp==RV3D_CAMOB) && !(vod->v3d->flag2 & V3D_LOCK_CAMERA)) { + if((vod->rv3d->persp==RV3D_CAMOB) && !ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) { const float zoomfac= BKE_screen_view3d_zoom_to_fac((float)vod->rv3d->camzoom) * 2.0f; vod->rv3d->camdx += (vod->oldx - x)/(vod->ar->winx * zoomfac); vod->rv3d->camdy += (vod->oldy - y)/(vod->ar->winy * zoomfac); @@ -986,7 +1024,7 @@ static int viewmove_modal(bContext *C, wmOperator *op, wmEvent *event) viewmove_apply(vod, event->x, event->y); } else if (event_code==VIEW_CONFIRM) { - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); @@ -1006,7 +1044,7 @@ static int viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event) if (event->type == MOUSEPAN) { viewmove_apply(vod, event->prevx, event->prevy); - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); @@ -1039,6 +1077,7 @@ void VIEW3D_OT_move(wmOperatorType *ot) /* ************************ viewzoom ******************************** */ +/* viewdolly_modal_keymap has an exact copy of this, apply fixes to both */ /* called in transform_ops.c, on each regeneration of keymaps */ void viewzoom_modal_keymap(wmKeyConfig *keyconf) { @@ -1081,22 +1120,14 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my) float tpos[3]; float mval_f[2]; float new_dist; - int vb[2], mouseloc[2]; - - mouseloc[0]= mx - ar->winrct.xmin; - mouseloc[1]= my - ar->winrct.ymin; - - /* find the current window width and height */ - vb[0] = ar->winx; - vb[1] = ar->winy; negate_v3_v3(tpos, rv3d->ofs); /* Project cursor position into 3D space */ initgrabz(rv3d, tpos[0], tpos[1], tpos[2]); - mval_f[0]= (mouseloc[0] - vb[0]) / 2.0f; - mval_f[1]= (mouseloc[1] - vb[1]) / 2.0f; + mval_f[0]= (float)(((mx - ar->winrct.xmin) * 2) - ar->winx) / 2.0f; + mval_f[1]= (float)(((my - ar->winrct.ymin) * 2) - ar->winy) / 2.0f; ED_view3d_win_to_delta(ar, mval_f, dvec); /* Calculate view target position for dolly */ @@ -1224,7 +1255,7 @@ static int viewzoom_modal(bContext *C, wmOperator *op, wmEvent *event) viewzoom_apply(vod, event->x, event->y, U.viewzoom, (U.uiflag & USER_ZOOM_INVERT) != 0); } else if (event_code==VIEW_CONFIRM) { - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -1261,7 +1292,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op) mx= RNA_property_is_set(op->ptr, "mx") ? RNA_int_get(op->ptr, "mx") : ar->winx / 2; my= RNA_property_is_set(op->ptr, "my") ? RNA_int_get(op->ptr, "my") : ar->winy / 2; - use_cam_zoom= (rv3d->persp==RV3D_CAMOB) && !((v3d->flag2 & V3D_LOCK_CAMERA) && rv3d->is_persp); + use_cam_zoom= (rv3d->persp==RV3D_CAMOB) && !(rv3d->is_persp && ED_view3d_camera_lock_check(v3d, rv3d)); if(delta < 0) { /* this min and max is also in viewmove() */ @@ -1286,7 +1317,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op) if(rv3d->viewlock & RV3D_BOXVIEW) view3d_boxview_sync(sa, ar); - request_depth_update(rv3d); + ED_view3d_depth_tag_update(rv3d); ED_view3d_camera_lock_sync(v3d, rv3d); @@ -1297,6 +1328,39 @@ static int viewzoom_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +/* this is an exact copy of viewzoom_modal_keymap */ +/* called in transform_ops.c, on each regeneration of keymaps */ +void viewdolly_modal_keymap(wmKeyConfig *keyconf) +{ + static EnumPropertyItem modal_items[] = { + {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, + + {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"}, + {VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"}, + + {0, NULL, 0, NULL, NULL}}; + + wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Dolly Modal"); + + /* this function is called for each spacetype, only needs to add map once */ + if(keymap) return; + + keymap= WM_modalkeymap_add(keyconf, "View3D Dolly Modal", modal_items); + + /* items for modal map */ + WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM); + WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, VIEW_MODAL_CONFIRM); + + /* disabled mode switching for now, can re-implement better, later on + WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE); + WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE); + WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE); + */ + + /* assign map to operators */ + WM_modalkeymap_assign(keymap, "VIEW3D_OT_dolly"); +} + /* viewdolly_invoke() copied this function, changes here may apply there */ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event) { @@ -1329,7 +1393,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event) vod->origy = vod->oldy = vod->origy + event->x - event->prevx; viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY, FALSE); } - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -1445,7 +1509,7 @@ static int viewdolly_modal(bContext *C, wmOperator *op, wmEvent *event) viewdolly_apply(vod, event->x, event->y, (U.uiflag & USER_ZOOM_INVERT) != 0); } else if (event_code==VIEW_CONFIRM) { - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -1496,7 +1560,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op) if(rv3d->viewlock & RV3D_BOXVIEW) view3d_boxview_sync(sa, ar); - request_depth_update(rv3d); + ED_view3d_depth_tag_update(rv3d); ED_region_tag_redraw(ar); viewops_data_free(C, op); @@ -1543,7 +1607,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event) vod->origy = vod->oldy = vod->origy + event->x - event->prevx; viewdolly_apply(vod, event->prevx, event->prevy, FALSE); } - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -1569,7 +1633,7 @@ static int viewdolly_poll(bContext *C) } else { View3D *v3d= CTX_wm_view3d(C); - if ((rv3d->persp == RV3D_CAMOB) && (v3d->flag2 & V3D_LOCK_CAMERA)) { + if (ED_view3d_camera_lock_check(v3d, rv3d)) { return 1; } } @@ -1608,7 +1672,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in Scene *scene= CTX_data_scene(C); Base *base; float *curs; - const short skip_camera= ((rv3d->persp==RV3D_CAMOB) && (v3d->flag2 & V3D_LOCK_CAMERA)); + const short skip_camera= ED_view3d_camera_lock_check(v3d, rv3d); int center= RNA_boolean_get(op->ptr, "center"); @@ -1669,7 +1733,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in new_dist*= size; } - if ((rv3d->persp==RV3D_CAMOB) && !(v3d->flag2 & V3D_LOCK_CAMERA)) { + if ((rv3d->persp==RV3D_CAMOB) && !ED_view3d_camera_lock_check(v3d, rv3d)) { rv3d->persp= RV3D_PERSP; smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL); } @@ -1713,7 +1777,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a loca Object *obedit= CTX_data_edit_object(C); float size, min[3], max[3], afm[3]; int ok=0, ok_dist=1; - const short skip_camera= ((rv3d->persp==RV3D_CAMOB) && (v3d->flag2 & V3D_LOCK_CAMERA)); + const short skip_camera= ED_view3d_camera_lock_check(v3d, rv3d); /* SMOOTHVIEW */ float new_ofs[3]; @@ -1816,7 +1880,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a loca new_dist*= size; } - if (rv3d->persp==RV3D_CAMOB && !(v3d->flag2 & V3D_LOCK_CAMERA)) { + if (rv3d->persp==RV3D_CAMOB && !ED_view3d_camera_lock_check(v3d, rv3d)) { rv3d->persp= RV3D_PERSP; smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL); } @@ -1940,7 +2004,7 @@ static int render_border_exec(bContext *C, wmOperator *op) rect.ymax= RNA_int_get(op->ptr, "ymax"); /* calculate range */ - view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb, FALSE); + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE); scene->r.border.xmin= ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin); scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin); @@ -2120,7 +2184,7 @@ static int view3d_zoom_border_invoke(bContext *C, wmOperator *op, wmEvent *event RegionView3D *rv3d= CTX_wm_region_view3d(C); /* if in camera view do not exec the operator so we do not conflict with set render border*/ - if ((rv3d->persp != RV3D_CAMOB) || (v3d->flag2 & V3D_LOCK_CAMERA)) + if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) return WM_border_select_invoke(C, op, event); else return OPERATOR_PASS_THROUGH; @@ -2434,7 +2498,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op) orbitdir = RNA_enum_get(op->ptr, "type"); if(rv3d->viewlock==0) { - if((rv3d->persp != RV3D_CAMOB) || (v3d->flag2 & V3D_LOCK_CAMERA)) { + if((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) { if(orbitdir == V3D_VIEW_STEPLEFT || orbitdir == V3D_VIEW_STEPRIGHT) { float si; /* z-axis */ @@ -2740,7 +2804,7 @@ static int view3d_clipping_exec(bContext *C, wmOperator *op) view3d_set_viewcontext(C, &vc); view3d_get_transformation(vc.ar, vc.rv3d, NULL, &mats); /* NULL because we don't want it in object space */ - view3d_calculate_clipping(rv3d->clipbb, rv3d->clip, &mats, &rect); + ED_view3d_calc_clipping(rv3d->clipbb, rv3d->clip, &mats, &rect); return OPERATOR_FINISHED; } @@ -3489,25 +3553,6 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int UNUSED(mode)) } #endif // if 0, unused NDof code -/* give a 4x4 matrix from a perspective view, only needs viewquat, ofs and dist - * basically the same as... - * rv3d->persp= RV3D_PERSP - * setviewmatrixview3d(scene, v3d, rv3d); - * setcameratoview3d(v3d, rv3d, v3d->camera); - * ...but less of a hassle - * */ -void view3d_persp_mat4(RegionView3D *rv3d, float mat[][4]) -{ - float qt[4], dvec[3]; - copy_qt_qt(qt, rv3d->viewquat); - qt[0]= -qt[0]; - quat_to_mat4(mat, qt); - mat[3][2] -= rv3d->dist; - translate_m4(mat, rv3d->ofs[0], rv3d->ofs[1], rv3d->ofs[2]); - mul_v3_v3fl(dvec, mat[2], -rv3d->dist); - sub_v3_v3v3(mat[3], dvec, rv3d->ofs); -} - /* Gets the view trasnformation from a camera * currently dosnt take camzoom into account @@ -3543,6 +3588,16 @@ void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist) } } +void ED_view3d_to_m4(float mat[][4], const float ofs[3], const float quat[4], const float dist) +{ + float iviewquat[4]= {-quat[0], quat[1], quat[2], quat[3]}; + float dvec[3]= {0.0f, 0.0f, dist}; + + quat_to_mat4(mat, iviewquat); + mul_mat3_m4_v3(mat, dvec); + sub_v3_v3v3(mat[3], dvec, ofs); +} + /* object -> view */ void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist, float *lens) @@ -3550,19 +3605,14 @@ void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist, ED_view3d_from_m4(ob->obmat, ofs, quat, dist); if (lens) { - get_object_clip_range(ob, lens, NULL, NULL); + ED_view3d_ob_clip_range_get(ob, lens, NULL, NULL); } } /* view -> object */ void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], const float dist) { - float mat4[4][4]; - float dvec[3]= {0.0f, 0.0f, dist}; - float iviewquat[4]= {-quat[0], quat[1], quat[2], quat[3]}; - - quat_to_mat4(mat4, iviewquat); - mul_mat3_m4_v3(mat4, dvec); - sub_v3_v3v3(mat4[3], dvec, ofs); - object_apply_mat4(ob, mat4, TRUE, TRUE); + float mat[4][4]; + ED_view3d_to_m4(mat, ofs, quat, dist); + object_apply_mat4(ob, mat, TRUE, TRUE); } diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 962bd5c7080..fdee5c6f6d9 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -307,7 +307,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even fly->dist_backup= fly->rv3d->dist; if (fly->rv3d->persp==RV3D_CAMOB) { Object *ob_back; - if((fly->root_parent=fly->v3d->camera->parent)) { + if((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (fly->root_parent=fly->v3d->camera->parent)) { while(fly->root_parent->parent) fly->root_parent= fly->root_parent->parent; ob_back= fly->root_parent; @@ -568,7 +568,7 @@ static int flyApply(bContext *C, FlyInfo *fly) apply_rotation= 1; /* if the user presses shift they can look about without movinf the direction there looking*/ if(fly->root_parent) - view3d_persp_mat4(rv3d, prev_view_mat); + ED_view3d_to_m4(prev_view_mat, fly->rv3d->ofs, fly->rv3d->viewquat, fly->rv3d->dist); /* the dist defines a vector that is infront of the offset to rotate the view about. @@ -797,7 +797,7 @@ static int flyApply(bContext *C, FlyInfo *fly) float parent_mat[4][4]; invert_m4_m4(prev_view_imat, prev_view_mat); - view3d_persp_mat4(rv3d, view_mat); + ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); mul_m4_m4m4(diff_mat, prev_view_imat, view_mat); mul_m4_m4m4(parent_mat, fly->root_parent->obmat, diff_mat); object_apply_mat4(fly->root_parent, parent_mat, TRUE, FALSE); @@ -817,7 +817,7 @@ static int flyApply(bContext *C, FlyInfo *fly) } else { float view_mat[4][4]; - view3d_persp_mat4(rv3d, view_mat); + ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); object_apply_mat4(v3d->camera, view_mat, TRUE, FALSE); id_key= &v3d->camera->id; } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 717e46800b1..cd6bff1ebba 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -91,7 +91,6 @@ void VIEW3D_OT_zoom_border(struct wmOperatorType *ot); void VIEW3D_OT_drawtype(struct wmOperatorType *ot); void view3d_boxview_copy(ScrArea *sa, ARegion *ar); -void view3d_persp_mat4(struct RegionView3D *rv3d, float mat[][4]); /* view3d_fly.c */ void view3d_keymap(struct wmKeyConfig *keyconf); @@ -154,9 +153,7 @@ void VIEW3D_OT_localview(struct wmOperatorType *ot); void VIEW3D_OT_game_start(struct wmOperatorType *ot); -int boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb); - -void centerview(struct ARegion *ar, View3D *v3d); +int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb); void smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens); @@ -167,6 +164,7 @@ void fly_modal_keymap(struct wmKeyConfig *keyconf); void viewrotate_modal_keymap(struct wmKeyConfig *keyconf); void viewmove_modal_keymap(struct wmKeyConfig *keyconf); void viewzoom_modal_keymap(struct wmKeyConfig *keyconf); +void viewdolly_modal_keymap(struct wmKeyConfig *keyconf); /* view3d_buttons.c */ void VIEW3D_OT_properties(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 4942030c516..05ef79a9f29 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -305,5 +305,6 @@ void view3d_keymap(wmKeyConfig *keyconf) viewrotate_modal_keymap(keyconf); viewmove_modal_keymap(keyconf); viewzoom_modal_keymap(keyconf); + viewdolly_modal_keymap(keyconf); } diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 80390f73afa..f06b4678d70 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -69,19 +69,6 @@ /* ******************* view3d space & buttons ************** */ -static wmOperator *view3d_last_operator(const bContext *C) -{ - wmWindowManager *wm= CTX_wm_manager(C); - wmOperator *op; - - /* only for operators that are registered and did an undo push */ - for(op= wm->operators.last; op; op= op->prev) - if((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO)) - break; - - return op; -} - static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOperator *op) { uiLayoutOperatorButs(C, pa->layout, op, NULL, 'V', 0); @@ -89,7 +76,7 @@ static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOper static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa) { - wmOperator *op= view3d_last_operator(C); + wmOperator *op= WM_operator_last_redo(C); if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname)); else BLI_strncpy(pa->drawname, "Operator", sizeof(pa->drawname)); @@ -110,7 +97,7 @@ static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wm static void view3d_panel_operator_redo(const bContext *C, Panel *pa) { - wmOperator *op= view3d_last_operator(C); + wmOperator *op= WM_operator_last_redo(C); uiBlock *block; if(op==NULL) diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index cf04433e94a..848083ad043 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -106,7 +106,7 @@ float *give_cursor(Scene *scene, View3D *v3d) /* Gets the lens and clipping values from a camera of lamp type object */ -void get_object_clip_range(Object *ob, float *lens, float *clipsta, float *clipend) +void ED_view3d_ob_clip_range_get(Object *ob, float *lens, float *clipsta, float *clipend) { if(ob->type==OB_LAMP ) { Lamp *la = ob->data; @@ -463,7 +463,7 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot) /* ********************************** */ -void view3d_calculate_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, rcti *rect) +void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, rcti *rect) { double xs, ys, p[3]; short val; @@ -657,7 +657,7 @@ void ED_view3d_win_to_vector(ARegion *ar, const float mval[2], float out[3]) normalize_v3(out); } -float read_cached_depth(ViewContext *vc, int x, int y) +float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y) { ViewDepths *vd = vc->rv3d->depths; @@ -670,13 +670,13 @@ float read_cached_depth(ViewContext *vc, int x, int y) return 1; } -void request_depth_update(RegionView3D *rv3d) +void ED_view3d_depth_tag_update(RegionView3D *rv3d) { if(rv3d->depths) rv3d->depths->damaged= 1; } -void view3d_get_object_project_mat(RegionView3D *rv3d, Object *ob, float pmat[4][4]) +void ED_view3d_ob_project_mat_get(RegionView3D *rv3d, Object *ob, float pmat[4][4]) { float vmat[4][4]; @@ -698,7 +698,7 @@ void view3d_unproject(bglMats *mats, float out[3], const short x, const short y, } /* use view3d_get_object_project_mat to get projecting mat */ -void view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float mat[4][4]) +void ED_view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float mat[4][4]) { float vec4[4]; @@ -718,7 +718,7 @@ void view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float m } /* use view3d_get_object_project_mat to get projecting mat */ -void view3d_project_float_v3(ARegion *ar, float *vec, float *adr, float mat[4][4]) +void ED_view3d_project_float_v3(ARegion *ar, float *vec, float *adr, float mat[4][4]) { float vec4[4]; @@ -737,7 +737,7 @@ void view3d_project_float_v3(ARegion *ar, float *vec, float *adr, float mat[4][4 } } -int boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb) +int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb) { /* return 1: draw */ @@ -780,7 +780,7 @@ void project_short(ARegion *ar, const float vec[3], short adr[2]) /* clips */ adr[0]= IS_CLIPPED; if(rv3d->rflag & RV3D_CLIPPING) { - if(view3d_test_clipping(rv3d, vec, 0)) + if(ED_view3d_test_clipping(rv3d, vec, 0)) return; } @@ -917,7 +917,7 @@ void project_float_noclip(ARegion *ar, const float vec[3], float adr[2]) } /* copies logic of get_view3d_viewplane(), keep in sync */ -int get_view3d_cliprange(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend) +int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend) { int orth= 0; @@ -952,7 +952,7 @@ int get_view3d_cliprange(View3D *v3d, RegionView3D *rv3d, float *clipsta, float } /* also exposed in previewrender.c */ -int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize) +int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize) { Camera *cam=NULL; float lens, fac, x1, y1, x2, y2; @@ -1085,7 +1085,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for pick float clipsta, clipend, x1, y1, x2, y2; int orth; - orth= get_view3d_viewplane(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL); + orth= ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL); rv3d->is_persp= !orth; // printf("%d %d %f %f %f %f %f %f\n", winx, winy, viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax, clipsta, clipend); @@ -1796,7 +1796,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) if(rv3d->persp==RV3D_CAMOB && startscene->gm.framing.type == SCE_GAMEFRAMING_BARS && startscene->gm.stereoflag != STEREO_DOME) { /* Letterbox */ rctf cam_framef; - view3d_calc_camera_border(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef, FALSE); + ED_view3d_calc_camera_border(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef, FALSE); cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin; cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin; cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin; @@ -1894,7 +1894,7 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f } } -float view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]) +float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]) { return (rv3d->persmat[3][3] + ( rv3d->persmat[0][3]*co[0] + diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 1afa5ead044..8163ccc4cb0 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4390,7 +4390,7 @@ static int createSlideVerts(TransInfo *t) /*ok, let's try to survive this*/ unit_m4(projectMat); } else { - view3d_get_object_project_mat(rv3d, t->obedit, projectMat); + ED_view3d_ob_project_mat_get(rv3d, t->obedit, projectMat); } BLI_smallhash_init(&sld->vhash); @@ -4580,17 +4580,17 @@ static int createSlideVerts(TransInfo *t) j = GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v)); if (tempsv[j].down) { - view3d_project_float_v3(ar, tempsv[j].down->co, vec1, projectMat); + ED_view3d_project_float_v3(ar, tempsv[j].down->co, vec1, projectMat); } else { add_v3_v3v3(vec1, v->co, tempsv[j].downvec); - view3d_project_float_v3(ar, vec1, vec1, projectMat); + ED_view3d_project_float_v3(ar, vec1, vec1, projectMat); } if (tempsv[j].up) { - view3d_project_float_v3(ar, tempsv[j].up->co, vec2, projectMat); + ED_view3d_project_float_v3(ar, tempsv[j].up->co, vec2, projectMat); } else { add_v3_v3v3(vec1, v->co, tempsv[j].upvec); - view3d_project_float_v3(ar, vec2, vec2, projectMat); + ED_view3d_project_float_v3(ar, vec2, vec2, projectMat); } d = dist_to_line_segment_v2(mval, vec1, vec2); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 4a601f37e17..381a5e585dd 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3832,7 +3832,7 @@ void flushTransGraphData(TransInfo *t) /* if int-values only, truncate to integers */ if (td->flag & TD_INTVALUES) - td2d->loc2d[1]= (float)((int)td2d->loc[1]); + td2d->loc2d[1]= floorf(td2d->loc[1] + 0.5f); else td2d->loc2d[1]= td2d->loc[1]; @@ -5070,8 +5070,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t) /* when running transform non-interactively (operator exec), * we need to update the pose otherwise no updates get called during * transform and the auto-ik is not applied. see [#26164] */ - struct Object *ob=t->poseobj; - where_is_pose(t->scene, ob); + struct Object *pose_ob=t->poseobj; + where_is_pose(t->scene, pose_ob); } /* if target-less IK grabbing, we calculate the pchan transforms and clear flag */ diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 71c2d062ee2..31a7194ea02 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1460,7 +1460,7 @@ void BIF_draw_manipulator(const bContext *C) break; } - mul_mat3_m4_fl(rv3d->twmat, view3d_pixel_size(rv3d, rv3d->twmat[3]) * U.tw_size * 5.0f); + mul_mat3_m4_fl(rv3d->twmat, ED_view3d_pixel_size(rv3d, rv3d->twmat[3]) * U.tw_size * 5.0f); } test_manipulator_axis(C); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 23d11e1562f..193113a568e 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -164,11 +164,11 @@ void drawSnapping(const struct bContext *C, TransInfo *t) invert_m4_m4(imat, rv3d->viewmat); for (p = t->tsnap.points.first; p; p = p->next) { - drawcircball(GL_LINE_LOOP, p->co, view3d_pixel_size(rv3d, p->co) * size, imat); + drawcircball(GL_LINE_LOOP, p->co, ED_view3d_pixel_size(rv3d, p->co) * size, imat); } if (t->tsnap.status & POINT_INIT) { - drawcircball(GL_LINE_LOOP, t->tsnap.snapPoint, view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat); + drawcircball(GL_LINE_LOOP, t->tsnap.snapPoint, ED_view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat); } /* draw normal if needed */ @@ -1631,9 +1631,9 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f for(dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next) { - Object *ob = dupli_ob->ob; + Object *dob = dupli_ob->ob; - retval |= snapObject(scene, ar, ob, 0, dupli_ob->mat, ray_start, ray_normal, mval, loc, no, dist, &depth); + retval |= snapObject(scene, ar, dob, 0, dupli_ob->mat, ray_start, ray_normal, mval, loc, no, dist, &depth); } free_object_duplilist(lb); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 1bf70fbd38b..e936f35574d 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -900,7 +900,7 @@ static void do_material_tex(GPUShadeInput *shi) GPUNodeLink *texco_norm, *texco_orco, *texco_object; GPUNodeLink *texco_global, *texco_uv = NULL; GPUNodeLink *newnor, *orn; - char *lastuvname = NULL; + /*char *lastuvname = NULL;*/ /*UNUSED*/ float one = 1.0f, norfac, ofs[3]; int tex_nr, rgbnor, talpha; int init_done = 0, iBumpSpacePrev; @@ -947,7 +947,7 @@ static void do_material_tex(GPUShadeInput *shi) else if(mtex->texco==TEXCO_UV) { if(1) { //!(texco_uv && strcmp(mtex->uvname, lastuvname) == 0)) { GPU_link(mat, "texco_uv", GPU_attribute(CD_MTFACE, mtex->uvname), &texco_uv); - lastuvname = mtex->uvname; + /*lastuvname = mtex->uvname;*/ /*UNUSED*/ } texco= texco_uv; } diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h index 4804d363628..fba0772dd93 100644 --- a/source/blender/imbuf/intern/IMB_anim.h +++ b/source/blender/imbuf/intern/IMB_anim.h @@ -107,7 +107,7 @@ #define SWAP_S(x) (((x << 8) & 0xff00) | ((x >> 8) & 0xff)) /* more endianness... should move to a separate file... */ -#if defined(__sgi) || defined (__sparc) || (__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__hppa__) || defined (__BIG_ENDIAN__) +#if defined(__sgi) || defined (__sparc) || defined (__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__hppa__) || defined (__BIG_ENDIAN__) #define GET_ID GET_BIG_LONG #define LITTLE_LONG SWAP_LONG #else diff --git a/source/blender/imbuf/intern/md5.h b/source/blender/imbuf/intern/md5.h index 5fc1f80216f..79c480d8152 100644 --- a/source/blender/imbuf/intern/md5.h +++ b/source/blender/imbuf/intern/md5.h @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include <stdio.h> -#if defined HAVE_LIMITS_H || _LIBC +#if defined HAVE_LIMITS_H || defined _LIBC # include <limits.h> #endif diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index f334409133f..5d9f350be48 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -532,7 +532,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags) TARGA tga; struct ImBuf * ibuf; int col, count, size; - unsigned int *rect, *cmap= NULL, mincol= 0, maxcol= 0; + unsigned int *rect, *cmap= NULL /*, mincol= 0*/, maxcol= 0; uchar * cp = (uchar *) &col; if (checktarga(&tga,mem) == 0) return(NULL); @@ -550,7 +550,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags) if (tga.mapsize){ /* load color map */ - mincol = tga.maporig; + /*mincol = tga.maporig;*/ /*UNUSED*/ maxcol = tga.mapsize; cmap = MEM_callocN(sizeof(unsigned int)*maxcol, "targa cmap"); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 1d4ee2a30b3..eea764b5423 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -469,7 +469,7 @@ extern UserDef U; /* from blenkernel blender.c */ #define USER_HIDE_DOT (1 << 16) #define USER_SHOW_ROTVIEWICON (1 << 17) #define USER_SHOW_VIEWPORTNAME (1 << 18) -// old flag for #define USER_KEYINSERTNEED (1 << 19) +#define USER_CAM_LOCK_NO_PARENT (1 << 19) #define USER_ZOOM_TO_MOUSEPOS (1 << 20) #define USER_SHOW_FPS (1 << 21) #define USER_MMB_PASTE (1 << 22) diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 07ee084f976..8b841b67e54 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -855,12 +855,13 @@ void dna_write(FILE *file, void *pntr, int size) void printStructLenghts(void) { - int a, unknown= nr_structs, lastunknown, structtype; + int a, unknown= nr_structs, structtype; + /*int lastunknown;*/ /*UNUSED*/ short *structpoin; printf("\n\n*** All detected structs:\n"); while(unknown) { - lastunknown= unknown; + /*lastunknown= unknown;*/ /*UNUSED*/ unknown= 0; /* check all structs... */ diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 6955c7f8fa8..65c7b351622 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1056,8 +1056,8 @@ static void rna_def_field(BlenderRNA *brna) static EnumPropertyItem field_type_items[] = { {0, "NONE", 0, "None", ""}, {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Gives a radial field toward the center of object"}, - {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Gives a constant force along the force object’s local Z axis"}, - {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Gives a spiraling force that twists the force object’s local Z axis"}, + {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Gives a constant force along the force objects local Z axis"}, + {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Gives a spiraling force that twists the force objects local Z axis"}, {PFIELD_MAGNET, "MAGNET", ICON_FORCE_MAGNETIC, "Magnetic", "Forcefield depends on the speed of the particles"}, {PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic", "The source of this force field is the zero point of a harmonic oscillator"}, {PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge", "Spherical forcefield based on the charge of particles, only influences other charge force fields"}, diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index a914d875490..cee6b7e2b1e 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2040,6 +2040,10 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_ZBUF); RNA_def_property_ui_text(prop, "Auto Depth", "Use the depth under the mouse to improve view pan/rotate/zoom functionality"); + prop= RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_CAM_LOCK_NO_PARENT); + RNA_def_property_ui_text(prop, "Camera Parent Lock", "When the camera is locked to the view and in fly mode, transform the parent rather then the camera"); + /* view zoom */ prop= RNA_def_property(srna, "use_zoom_to_mouse", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_TO_MOUSEPOS); diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/generic/mathutils_Matrix.c index 2b9de49bf3f..80f6ddf2d30 100644 --- a/source/blender/python/generic/mathutils_Matrix.c +++ b/source/blender/python/generic/mathutils_Matrix.c @@ -132,12 +132,12 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) const unsigned short row_size= PySequence_Size(arg); /* -1 is an error, size checks will accunt for this */ - if(IN_RANGE_INCL(row_size, 2, 4)) { + if(row_size >= 2 && row_size <= 4) { PyObject *item= PySequence_GetItem(arg, 0); const unsigned short col_size= PySequence_Size(item); Py_XDECREF(item); - if(IN_RANGE_INCL(col_size, 2, 4)) { + if(col_size >= 2 && col_size <= 4) { /* sane row & col size, new matrix and assign as slice */ PyObject *matrix= newMatrixObject(NULL, row_size, col_size, Py_NEW, type); if(Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) { diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 340e3f4ac57..525d3fcba78 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -77,9 +77,9 @@ static PyObject *bpy_script_paths(PyObject *UNUSED(self)) PyObject *ret= PyTuple_New(2); char *path; - path= BLI_get_folder(BLENDER_USER_SCRIPTS, NULL); - PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:"")); path= BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL); + PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:"")); + path= BLI_get_folder(BLENDER_USER_SCRIPTS, NULL); PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:"")); return ret; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index e08e681f494..3f9a3f636d0 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -247,6 +247,8 @@ void WM_operator_properties_gesture_border(struct wmOperatorType *ot, int exten void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor); void WM_operator_properties_select_all(struct wmOperatorType *ot); +wmOperator *WM_operator_last_redo(const struct bContext *C); + /* MOVE THIS SOMEWHERE ELSE */ #define SEL_TOGGLE 0 #define SEL_SELECT 1 diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 440ade914f0..615259bda15 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -661,6 +661,11 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event) event->mval[0]= event->x - ar->winrct.xmin; event->mval[1]= event->y - ar->winrct.ymin; } + else { + /* these values are invalid (avoid odd behavior by relying on old mval values) */ + event->mval[0]= -1; + event->mval[1]= -1; + } } static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, PointerRNA *properties, ReportList *reports, short poll_only) @@ -1776,6 +1781,8 @@ void wm_event_do_handlers(bContext *C) /* MVC demands to not draw in event handlers... but we need to leave it for ogl selecting etc */ wm_window_make_drawable(C, win); + wm_region_mouse_co(C, event); + /* first we do priority handlers, modal + some limited keymaps */ action |= wm_handlers_do(C, event, &win->modalhandlers); @@ -1811,10 +1818,12 @@ void wm_event_do_handlers(bContext *C) if(wm_event_inside_i(event, &ar->winrct)) { CTX_wm_region_set(C, ar); + /* call even on non mouse events, since the */ + wm_region_mouse_co(C, event); + /* does polls for drop regions and checks uibuts */ /* need to be here to make sure region context is true */ if(ELEM(event->type, MOUSEMOVE, EVT_DROP)) { - wm_region_mouse_co(C, event); wm_drags_check_ops(C, event); } @@ -1834,9 +1843,10 @@ void wm_event_do_handlers(bContext *C) CTX_wm_region_set(C, NULL); - if((action & WM_HANDLER_BREAK) == 0) + if((action & WM_HANDLER_BREAK) == 0) { + wm_region_mouse_co(C, event); /* only invalidates event->mval in this case */ action |= wm_handlers_do(C, event, &sa->handlers); - + } CTX_wm_area_set(C, NULL); /* NOTE: do not escape on WM_HANDLER_BREAK, mousemove needs handled for previous area */ @@ -1848,6 +1858,8 @@ void wm_event_do_handlers(bContext *C) CTX_wm_area_set(C, area_event_inside(C, event->x, event->y)); CTX_wm_region_set(C, region_event_inside(C, event->x, event->y)); + wm_region_mouse_co(C, event); + action |= wm_handlers_do(C, event, &win->handlers); /* fileread case */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 745ae0ae47e..fc2c0338bdf 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -882,6 +882,19 @@ int WM_operator_winactive(bContext *C) return 1; } +wmOperator *WM_operator_last_redo(const bContext *C) +{ + wmWindowManager *wm= CTX_wm_manager(C); + wmOperator *op; + + /* only for operators that are registered and did an undo push */ + for(op= wm->operators.last; op; op= op->prev) + if((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO)) + break; + + return op; +} + static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) { wmOperator *op= arg_op; diff --git a/source/creator/creator.c b/source/creator/creator.c index 2b2e30d5756..53f393f2023 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -658,7 +658,7 @@ static int set_image_type(int argc, const char **argv, void *data) else if (!strcmp(imtype,"CINEON")) scene->r.imtype = R_CINEON; else if (!strcmp(imtype,"DPX")) scene->r.imtype = R_DPX; #endif -#if WITH_OPENJPEG +#ifdef WITH_OPENJPEG else if (!strcmp(imtype,"JP2")) scene->r.imtype = R_JP2; #endif else printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n"); |