diff options
author | Joerg Mueller <nexyon@gmail.com> | 2011-08-16 18:11:58 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2011-08-16 18:11:58 +0400 |
commit | 23807d1fb43de44ca7c4db5dc7bd92178f4b6a14 (patch) | |
tree | 6d2e17c8405789363e69df000cf14207110428b2 /source/blender | |
parent | 02d2472baacd8ac091a29392a2bc9ac8693fb5e7 (diff) | |
parent | dddfb5e1738830c325e796a474d0ea14d64654f3 (diff) |
Merging trunk up to r39447.
Diffstat (limited to 'source/blender')
104 files changed, 943 insertions, 752 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 55ade5fe5d9..46b533f33fd 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -526,7 +526,7 @@ void weight_to_rgb(float input, float *fr, float *fg, float *fb); typedef struct DMVertexAttribs { struct { struct MTFace *array; - int emOffset, glIndex; + int emOffset, glIndex, glTexco; } tface[MAX_MTFACE]; struct { @@ -541,7 +541,7 @@ typedef struct DMVertexAttribs { struct { float (*array)[3]; - int emOffset, glIndex; + int emOffset, glIndex, glTexco; } orco; int tottface, totmcol, tottang, totorco; diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 88dad03db1e..162b0de1d5a 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -53,7 +53,7 @@ extern "C" { /* can be left blank, otherwise a,b,c... etc with no quotes */ #define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE release +#define BLENDER_VERSION_CYCLE alpha struct ListBase; struct MemFile; diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 648e67cad8a..28950e4b2eb 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -101,6 +101,7 @@ typedef enum { typedef void (*ObjectWalkFunc)(void *userData, struct Object *ob, struct Object **obpoin); typedef void (*IDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin); +typedef void (*TexWalkFunc)(void *userData, struct Object *ob, struct ModifierData *md, const char *propname); typedef struct ModifierTypeInfo { /* The user visible name for this modifier */ @@ -284,6 +285,16 @@ typedef struct ModifierTypeInfo { */ void (*foreachIDLink)(struct ModifierData *md, struct Object *ob, IDWalkFunc walk, void *userData); + + /* Should call the given walk function for each texture that the + * modifier data stores. This is used for finding all textures in + * the context for the UI. + * + * This function is optional. If it is not present, it will be + * assumed the modifier has no textures. + */ + void (*foreachTexLink)(struct ModifierData *md, struct Object *ob, + TexWalkFunc walk, void *userData); } ModifierTypeInfo; ModifierTypeInfo *modifierType_getInfo (ModifierType type); @@ -315,6 +326,10 @@ void modifiers_foreachObjectLink(struct Object *ob, void modifiers_foreachIDLink(struct Object *ob, IDWalkFunc walk, void *userData); +void modifiers_foreachTexLink(struct Object *ob, + TexWalkFunc walk, + void *userData); + struct ModifierData *modifiers_findByType(struct Object *ob, ModifierType type); struct ModifierData *modifiers_findByName(struct Object *ob, const char *name); void modifiers_clearErrors(struct Object *ob); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 62b8830de20..c84bcaabbd3 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1050,6 +1050,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, glEnd(); } } +#undef PASSATTRIB } static void emDM_drawFacesGLSL(DerivedMesh *dm, @@ -2767,6 +2768,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs, attribs->tface[a].array = tfdata->layers[layer].data; attribs->tface[a].emOffset = tfdata->layers[layer].offset; attribs->tface[a].glIndex = gattribs->layer[b].glindex; + attribs->tface[a].glTexco = gattribs->layer[b].gltexco; } } else if(gattribs->layer[b].type == CD_MCOL) { @@ -2807,6 +2809,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs, attribs->orco.array = vdata->layers[layer].data; attribs->orco.emOffset = vdata->layers[layer].offset; attribs->orco.glIndex = gattribs->layer[b].glindex; + attribs->orco.glTexco = gattribs->layer[b].gltexco; } } } diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 662c872b7f1..12fb11c68b3 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -993,6 +993,50 @@ static void cdDM_drawMappedFacesTex(DerivedMesh *dm, int (*setDrawOptions)(void cdDM_drawFacesTex_common(dm, NULL, setDrawOptions, userData); } +static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int a, int index, int vert, int smoothnormal) +{ + int b; + + /* orco texture coordinates */ + if(attribs->totorco) { + if(attribs->orco.glTexco) + glTexCoord3fv(attribs->orco.array[index]); + else + glVertexAttrib3fvARB(attribs->orco.glIndex, attribs->orco.array[index]); + } + + /* uv texture coordinates */ + for(b = 0; b < attribs->tottface; b++) { + MTFace *tf = &attribs->tface[b].array[a]; + + if(attribs->tface[b].glTexco) + glTexCoord2fv(tf->uv[vert]); + else + glVertexAttrib2fvARB(attribs->tface[b].glIndex, tf->uv[vert]); + } + + /* vertex colors */ + for(b = 0; b < attribs->totmcol; b++) { + MCol *cp = &attribs->mcol[b].array[a*4 + vert]; + GLubyte col[4]; + col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; + glVertexAttrib4ubvARB(attribs->mcol[b].glIndex, col); + } + + /* tangent for normal mapping */ + if(attribs->tottang) { + float *tang = attribs->tang.array[a*4 + vert]; + glVertexAttrib4fvARB(attribs->tang.glIndex, tang); + } + + /* vertex normal */ + if(smoothnormal) + glNormal3sv(mvert[index].no); + + /* vertex coordinate */ + glVertex3fv(mvert[index].co); +} + static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs), int (*setDrawOptions)(void *userData, int index), void *userData) { CDDerivedMesh *cddm = (CDDerivedMesh*) dm; @@ -1083,37 +1127,14 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo } } -#define PASSVERT(index, vert) { \ - if(attribs.totorco) \ - glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]); \ - for(b = 0; b < attribs.tottface; b++) { \ - MTFace *tf = &attribs.tface[b].array[a]; \ - glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \ - } \ - for(b = 0; b < attribs.totmcol; b++) { \ - MCol *cp = &attribs.mcol[b].array[a*4 + vert]; \ - GLubyte col[4]; \ - col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; \ - glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col); \ - } \ - if(attribs.tottang) { \ - float *tang = attribs.tang.array[a*4 + vert]; \ - glVertexAttrib4fvARB(attribs.tang.glIndex, tang); \ - } \ - if(smoothnormal) \ - glNormal3sv(mvert[index].no); \ - glVertex3fv(mvert[index].co); \ - } + cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v1, 0, smoothnormal); + cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v2, 1, smoothnormal); + cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal); - PASSVERT(mface->v1, 0); - PASSVERT(mface->v2, 1); - PASSVERT(mface->v3, 2); if(mface->v4) - PASSVERT(mface->v4, 3) + cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v4, 3, smoothnormal); else - PASSVERT(mface->v3, 2) - -#undef PASSVERT + cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal); } glEnd(); } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 6083151f23f..4802601307a 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -301,6 +301,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node for (fcu= adt->drivers.first; fcu; fcu= fcu->next) { ChannelDriver *driver= fcu->driver; DriverVar *dvar; + int isdata_fcu = isdata || (fcu->rna_path && strstr(fcu->rna_path, "modifiers[")); /* loop over variables to get the target relationships */ for (dvar= driver->variables.first; dvar; dvar= dvar->next) { @@ -320,14 +321,14 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node ( ((dtar->rna_path) && strstr(dtar->rna_path, "pose.bones[")) || ((dtar->flag & DTAR_FLAG_STRUCT_REF) && (dtar->pchan_name[0])) )) { - dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver"); + dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver"); } /* check if ob data */ else if (dtar->rna_path && strstr(dtar->rna_path, "data.")) - dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver"); + dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver"); /* normal */ else - dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Driver"); + dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Driver"); } } } diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 8f57490d057..c2ed6468643 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1369,6 +1369,11 @@ void makeDispListCurveTypes(Scene *scene, Object *ob, int forOrco) Curve *cu= ob->data; ListBase *dispbase; + /* The same check for duplis as in do_makeDispListCurveTypes. + Happens when curve used for constraint/bevel was converted to mesh. + check there is still needed for render displist and orco displists. */ + if(!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return; + freedisplist(&(ob->disp)); dispbase= &(ob->disp); freedisplist(dispbase); diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 2e532222d5b..3916d0ca701 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1003,7 +1003,7 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar) /* get property to read from, and get value as appropriate */ if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) { - if(RNA_property_array_check(&ptr, prop)) { + if(RNA_property_array_check(prop)) { /* array */ if (index < RNA_property_array_length(&ptr, prop)) { switch (RNA_property_type(prop)) { diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 51f1cd61e7c..fe26c0ccd2d 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -195,6 +195,18 @@ void modifiers_foreachIDLink(Object *ob, IDWalkFunc walk, void *userData) } } +void modifiers_foreachTexLink(Object *ob, TexWalkFunc walk, void *userData) +{ + ModifierData *md = ob->modifiers.first; + + for (; md; md=md->next) { + ModifierTypeInfo *mti = modifierType_getInfo(md->type); + + if(mti->foreachTexLink) + mti->foreachTexLink(md, ob, walk, userData); + } +} + void modifier_copyData(ModifierData *md, ModifierData *target) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 463f3bdd5cb..0235724c69c 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1620,7 +1620,7 @@ void BKE_nla_tweakmode_exit (AnimData *adt) /* Baking Tools ------------------------------------------- */ -static void BKE_nla_bake (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag)) +static void UNUSED_FUNCTION(BKE_nla_bake) (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag)) { /* verify that data is valid diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 13469e0b58b..5f1a6c911bc 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3243,7 +3243,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node) int driven, len=1, index; prop = (PropertyRNA *)link; - if (RNA_property_array_check(&ptr, prop)) + if (RNA_property_array_check(prop)) len = RNA_property_array_length(&ptr, prop); for (index=0; index<len; index++) { @@ -3261,7 +3261,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node) RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr); prop = RNA_struct_find_property(&ptr, "default_value"); - if (RNA_property_array_check(&ptr, prop)) + if (RNA_property_array_check(prop)) len = RNA_property_array_length(&ptr, prop); for (index=0; index<len; index++) { diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 93e0c920745..4cec086aad4 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -699,6 +699,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) seq->len = 0; } seq->strip->len = seq->len; + break; case SEQ_SOUND: #ifdef WITH_AUDASPACE if(!seq->sound) diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 036ba34d0c8..493baebd197 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -1005,7 +1005,7 @@ void autotexname(Tex *tex) Tex *give_current_object_texture(Object *ob) { - Material *ma; + Material *ma, *node_ma; Tex *tex= NULL; if(ob==NULL) return NULL; @@ -1015,6 +1015,10 @@ Tex *give_current_object_texture(Object *ob) tex= give_current_lamp_texture(ob->data); } else { ma= give_current_material(ob, ob->actcol); + + if((node_ma=give_node_material(ma))) + ma= node_ma; + tex= give_current_material_texture(ma); } @@ -1080,17 +1084,6 @@ Tex *give_current_material_texture(Material *ma) tex= (Tex *)node->id; ma= NULL; } - else { - node= nodeGetActiveID(ma->nodetree, ID_MA); - if(node) { - ma= (Material*)node->id; - if(ma) { - mtex= ma->mtex[(int)(ma->texact)]; - if(mtex) tex= mtex->tex; - } - } - } - return tex; } if(ma) { @@ -1165,11 +1158,6 @@ void set_current_material_texture(Material *ma, Tex *newtex) id_us_plus(&newtex->id); ma= NULL; } - else { - node= nodeGetActiveID(ma->nodetree, ID_MA); - if(node) - ma= (Material*)node->id; - } } if(ma) { int act= (int)ma->texact; @@ -1198,16 +1186,8 @@ int has_current_material_texture(Material *ma) if(ma && ma->use_nodes && ma->nodetree) { node= nodeGetActiveID(ma->nodetree, ID_TE); - if(node) { + if(node) return 1; - } - else { - node= nodeGetActiveID(ma->nodetree, ID_MA); - if(node) - ma= (Material*)node->id; - else - ma= NULL; - } } return (ma != NULL); diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index dcc71fa1258..e4afc6ad79b 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -53,14 +53,14 @@ typedef void (*GHashValFreeFP) (void *val); typedef struct Entry { struct Entry *next; - + void *key, *val; } Entry; typedef struct GHash { GHashHashFP hashfp; GHashCmpFP cmpfp; - + Entry **buckets; struct BLI_mempool *entrypool; int nbuckets, nentries, cursize; @@ -72,15 +72,15 @@ typedef struct GHashIterator { struct Entry *curEntry; } GHashIterator; -GHash* BLI_ghash_new (GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info); -void BLI_ghash_free (GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp); - -//BM_INLINE void BLI_ghash_insert (GHash *gh, void *key, void *val); -//BM_INLINE int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp); -//BM_INLINE void* BLI_ghash_lookup (GHash *gh, void *key); -//BM_INLINE int BLI_ghash_haskey (GHash *gh, void *key); +/* *** */ -int BLI_ghash_size (GHash *gh); +GHash* BLI_ghash_new (GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info); +void BLI_ghash_free (GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp); +void BLI_ghash_insert(GHash *gh, void *key, void *val); +void * BLI_ghash_lookup(GHash *gh, const void *key); +int BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp); +int BLI_ghash_haskey(GHash *gh, void *key); +int BLI_ghash_size (GHash *gh); /* *** */ @@ -149,127 +149,10 @@ unsigned int BLI_ghashutil_strhash (const void *key); int BLI_ghashutil_strcmp (const void *a, const void *b); unsigned int BLI_ghashutil_inthash (const void *ptr); -int BLI_ghashutil_intcmp(const void *a, const void *b); - -/*begin of macro-inlined functions*/ -extern unsigned int hashsizes[]; - -#if 0 -#define BLI_ghash_insert(gh, _k, _v){\ - unsigned int _hash= (gh)->hashfp(_k)%gh->nbuckets;\ - Entry *_e= BLI_mempool_alloc((gh)->entrypool);\ - _e->key= _k;\ - _e->val= _v;\ - _e->next= (gh)->buckets[_hash];\ - (gh)->buckets[_hash]= _e;\ - if (++(gh)->nentries>(gh)->nbuckets*3) {\ - Entry *_e, **_old= (gh)->buckets;\ - int _i, _nold= (gh)->nbuckets;\ - (gh)->nbuckets= hashsizes[++(gh)->cursize];\ - (gh)->buckets= malloc((gh)->nbuckets*sizeof(*(gh)->buckets));\ - memset((gh)->buckets, 0, (gh)->nbuckets*sizeof(*(gh)->buckets));\ - for (_i=0; _i<_nold; _i++) {\ - for (_e= _old[_i]; _e;) {\ - Entry *_n= _e->next;\ - _hash= (gh)->hashfp(_e->key)%(gh)->nbuckets;\ - _e->next= (gh)->buckets[_hash];\ - (gh)->buckets[_hash]= _e;\ - _e= _n;\ - }\ - }\ - free(_old); } } -#endif - -/*---------inlined functions---------*/ -BM_INLINE void BLI_ghash_insert(GHash *gh, void *key, void *val) { - unsigned int hash= gh->hashfp(key)%gh->nbuckets; - Entry *e= (Entry*) BLI_mempool_alloc(gh->entrypool); - - e->key= key; - e->val= val; - e->next= gh->buckets[hash]; - gh->buckets[hash]= e; - - if (++gh->nentries>(float)gh->nbuckets/2) { - Entry **old= gh->buckets; - int i, nold= gh->nbuckets; - - gh->nbuckets= hashsizes[++gh->cursize]; - gh->buckets= (Entry**)MEM_mallocN(gh->nbuckets*sizeof(*gh->buckets), "buckets"); - memset(gh->buckets, 0, gh->nbuckets*sizeof(*gh->buckets)); - - for (i=0; i<nold; i++) { - for (e= old[i]; e;) { - Entry *n= e->next; - - hash= gh->hashfp(e->key)%gh->nbuckets; - e->next= gh->buckets[hash]; - gh->buckets[hash]= e; - - e= n; - } - } - - MEM_freeN(old); - } -} - -BM_INLINE void* BLI_ghash_lookup(GHash *gh, const void *key) -{ - if(gh) { - unsigned int hash= gh->hashfp(key)%gh->nbuckets; - Entry *e; - - for (e= gh->buckets[hash]; e; e= e->next) - if (gh->cmpfp(key, e->key)==0) - return e->val; - } - return NULL; -} - -BM_INLINE int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp) -{ - unsigned int hash= gh->hashfp(key)%gh->nbuckets; - Entry *e; - Entry *p = NULL; - - for (e= gh->buckets[hash]; e; e= e->next) { - if (gh->cmpfp(key, e->key)==0) { - Entry *n= e->next; - - if (keyfreefp) keyfreefp(e->key); - if (valfreefp) valfreefp(e->val); - BLI_mempool_free(gh->entrypool, e); - - - e= n; - if (p) - p->next = n; - else - gh->buckets[hash] = n; - - --gh->nentries; - return 1; - } - p = e; - } - - return 0; -} - -BM_INLINE int BLI_ghash_haskey(GHash *gh, void *key) { - unsigned int hash= gh->hashfp(key)%gh->nbuckets; - Entry *e; - - for (e= gh->buckets[hash]; e; e= e->next) - if (gh->cmpfp(key, e->key)==0) - return 1; - - return 0; -} +int BLI_ghashutil_intcmp (const void *a, const void *b); #ifdef __cplusplus } #endif -#endif +#endif /* BLI_GHASH_H */ diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 9af55601ff7..28ebb254f2a 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -184,6 +184,12 @@ #endif #ifdef __GNUC__ +# define UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_ ## x +#else +# define UNUSED_FUNCTION(x) UNUSED_ ## x +#endif + +#ifdef __GNUC__ # define WARN_UNUSED __attribute__((warn_unused_result)) #else # define WARN_UNUSED diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index ff08ef4dba9..bfee350037a 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -49,8 +49,6 @@ unsigned int hashsizes[]= { /***/ -/***/ - GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) { GHash *gh= MEM_mallocN(sizeof(*gh), info); gh->hashfp= hashfp; @@ -67,14 +65,96 @@ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) { return gh; } -#ifdef BLI_ghash_insert -#undef BLI_ghash_insert -#endif - int BLI_ghash_size(GHash *gh) { return gh->nentries; } +void BLI_ghash_insert(GHash *gh, void *key, void *val) { + unsigned int hash= gh->hashfp(key)%gh->nbuckets; + Entry *e= (Entry*) BLI_mempool_alloc(gh->entrypool); + + e->key= key; + e->val= val; + e->next= gh->buckets[hash]; + gh->buckets[hash]= e; + + if (++gh->nentries>(float)gh->nbuckets/2) { + Entry **old= gh->buckets; + int i, nold= gh->nbuckets; + + gh->nbuckets= hashsizes[++gh->cursize]; + gh->buckets= (Entry**)MEM_mallocN(gh->nbuckets*sizeof(*gh->buckets), "buckets"); + memset(gh->buckets, 0, gh->nbuckets*sizeof(*gh->buckets)); + + for (i=0; i<nold; i++) { + for (e= old[i]; e;) { + Entry *n= e->next; + + hash= gh->hashfp(e->key)%gh->nbuckets; + e->next= gh->buckets[hash]; + gh->buckets[hash]= e; + + e= n; + } + } + + MEM_freeN(old); + } +} + +void *BLI_ghash_lookup(GHash *gh, const void *key) { + if(gh) { + unsigned int hash= gh->hashfp(key)%gh->nbuckets; + Entry *e; + + for (e= gh->buckets[hash]; e; e= e->next) + if (gh->cmpfp(key, e->key)==0) + return e->val; + } + return NULL; +} + +int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp) +{ + unsigned int hash= gh->hashfp(key)%gh->nbuckets; + Entry *e; + Entry *p = NULL; + + for (e= gh->buckets[hash]; e; e= e->next) { + if (gh->cmpfp(key, e->key)==0) { + Entry *n= e->next; + + if (keyfreefp) keyfreefp(e->key); + if (valfreefp) valfreefp(e->val); + BLI_mempool_free(gh->entrypool, e); + + /* correct but 'e' isnt used before return */ + /* e= n; */ /*UNUSED*/ + if (p) + p->next = n; + else + gh->buckets[hash] = n; + + --gh->nentries; + return 1; + } + p = e; + } + + return 0; +} + +int BLI_ghash_haskey(GHash *gh, void *key) { + unsigned int hash= gh->hashfp(key)%gh->nbuckets; + Entry *e; + + for (e= gh->buckets[hash]; e; e= e->next) + if (gh->cmpfp(key, e->key)==0) + return 1; + + return 0; +} + void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp) { int i; diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index b3ea568abf4..3c15ff52a30 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -1035,7 +1035,7 @@ static short pose_propagate_get_refVal (Object *ob, FCurve *fcu, float *value) /* resolve the property... */ if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) { - if (RNA_property_array_check(&ptr, prop)) { + if (RNA_property_array_check(prop)) { /* array */ if (fcu->array_index < RNA_property_array_length(&ptr, prop)) { found= TRUE; diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index ffe2e334772..04565eab155 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1613,7 +1613,12 @@ static int gpencil_area_exists(bContext *C, ScrArea *satest) static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) { tGPsdata *p= op->customdata; - int estate = OPERATOR_PASS_THROUGH; /* default exit state - not handled, so let others have a share of the pie */ + //int estate = OPERATOR_PASS_THROUGH; /* default exit state - not handled, so let others have a share of the pie */ + /* currently, grease pencil conflicts with such operators as undo and set object mode + which makes behavior of operator totally unpredictable and crash for some cases. + the only way to solve this proper is to ger rid of pointers to data which can + chage stored in operator custom data (sergey) */ + int estate = OPERATOR_RUNNING_MODAL; // if (event->type == NDOF_MOTION) // return OPERATOR_PASS_THROUGH; diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index dfa457c22de..cc4dd6330fb 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -33,12 +33,14 @@ #ifndef ED_NODE_H #define ED_NODE_H +struct ID; +struct Main; struct Material; struct Scene; struct Tex; struct bContext; struct bNode; -struct ID; +struct bNodeTree; struct ScrArea; /* drawnode.c */ @@ -55,6 +57,8 @@ void ED_node_texture_default(struct Tex *tex); void ED_node_link_intersect_test(struct ScrArea *sa, int test); void ED_node_link_insert(struct ScrArea *sa); +void ED_node_set_active(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node); + /* node ops.c */ void ED_operatormacros_node(void); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 8194ad610f7..76a56598e14 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -213,7 +213,7 @@ struct uiBut { BIFIconID icon; char lock; - char dt; + char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied from the block */ char changed; /* could be made into a single flag */ unsigned char unit_type; /* so buttons can support unit systems which are not RNA */ short modifier_key; @@ -306,7 +306,8 @@ struct uiBlock { void *drawextra_arg2; int flag; - char direction, dt; + char direction; + char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */ short auto_open; double auto_open_last; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index df654cf3645..4810b3fdf54 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -367,7 +367,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in unit= UI_UNIT_X*0.75; butw= unit; buth= unit; - + if(ptr->type == &RNA_Armature) { bArmature *arm= (bArmature *)ptr->data; layer_used= arm->layer_used; @@ -379,7 +379,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in for(a=0; a<colbuts; a++) { if(layer_used & (1<<(a+b*colbuts))) icon= ICON_LAYER_USED; else icon= ICON_BLANK1; - + but= uiDefAutoButR(block, ptr, prop, a+b*colbuts, "", icon, x + butw*a, y+buth, butw, buth); if(subtype == PROP_LAYER_MEMBER) uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+b*colbuts)); @@ -387,7 +387,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in for(a=0; a<colbuts; a++) { if(layer_used & (1<<(a+len/2+b*colbuts))) icon= ICON_LAYER_USED; else icon= ICON_BLANK1; - + but= uiDefAutoButR(block, ptr, prop, a+len/2+b*colbuts, "", icon, x + butw*a, y, butw, buth); if(subtype == PROP_LAYER_MEMBER) uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+len/2+b*colbuts)); @@ -422,35 +422,46 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in uiDefButR_prop(block, BUT_NORMAL, 0, name, x, y, UI_UNIT_X*3, UI_UNIT_Y*3, ptr, prop, 0, 0, 0, -1, -1, NULL); } else { - if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) + /* note, this block of code is a bit arbitrary and has just been made + * to work with common cases, but may need to be re-worked */ + + /* special case, boolean array in a menu, this could be used in a more generic way too */ + if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) { uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y); + } + else { + int *boolarr= NULL; - if(!ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) || expand) { - /* layout for known array subtypes */ - char str[3]; + /* even if 'expand' is fale, expanding anyway */ - for(a=0; a<len; a++) { - str[0]= RNA_property_array_item_char(prop, a); + /* layout for known array subtypes */ + char str[3]= {'\0'}; - if(str[0]) { - if (icon_only) { - str[0] = '\0'; - } - else if(type == PROP_BOOLEAN) { - str[1]= '\0'; - } - else { - str[1]= ':'; - str[2]= '\0'; - } + if(!icon_only) { + if(type != PROP_BOOLEAN) { + str[1]= ':'; } + } + + /* show checkboxes for rna on a non-emboss block (menu for eg) */ + if(type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSSN, UI_EMBOSSP)) { + boolarr= MEM_callocN(sizeof(int)*len, "ui_item_array"); + RNA_property_boolean_get_array(ptr, prop, boolarr); + } + for(a=0; a<len; a++) { + if(!icon_only) str[0]= RNA_property_array_item_char(prop, a); + if(boolarr) icon= boolarr[a] ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT; but= uiDefAutoButR(block, ptr, prop, a, str, icon, 0, 0, w, UI_UNIT_Y); if(slider && but->type==NUM) but->type= NUMSLI; if(toggle && but->type==OPTION) but->type= TOG; } + + if(boolarr) { + MEM_freeN(boolarr); + } } } @@ -951,13 +962,14 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index uiBut *but; PropertyType type; char namestr[UI_MAX_NAME_STR]; - int len, w, h, slider, toggle, expand, icon_only, no_bg; + int len, is_array, w, h, slider, toggle, expand, icon_only, no_bg; uiBlockSetCurLayout(block, layout); /* retrieve info */ type= RNA_property_type(prop); - len= RNA_property_array_length(ptr, prop); + is_array= RNA_property_array_check(prop); + len= (is_array) ? RNA_property_array_length(ptr, prop) : 0; /* set name and icon */ if(!name) @@ -967,14 +979,16 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER)) name= ui_item_name_add_colon(name, namestr); - else if(type == PROP_BOOLEAN && len && index == RNA_NO_INDEX) + else if(type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX) name= ui_item_name_add_colon(name, namestr); else if(type == PROP_ENUM && index != RNA_ENUM_VALUE) name= ui_item_name_add_colon(name, namestr); if(layout->root->type == UI_LAYOUT_MENU) { - if(type == PROP_BOOLEAN) - icon= (RNA_property_boolean_get(ptr, prop))? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT; + if(type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) { + if(is_array) icon= (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT; + else icon= (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT; + } else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) { int enum_value= RNA_property_enum_get(ptr, prop); if(RNA_property_flag(prop) & PROP_ENUM_FLAG) { @@ -999,7 +1013,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index uiBlockSetEmboss(block, UI_EMBOSSN); /* array property */ - if(index == RNA_NO_INDEX && len > 0) + if(index == RNA_NO_INDEX && is_array) ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only); /* enum item */ else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) { diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index f7460e77030..8bce27e366b 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1188,7 +1188,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, uiBut *bt; uiSafetyRct *saferct; rctf butrct; - float aspect; + /*float aspect;*/ /*UNUSED*/ int xsize, ysize, xof=0, yof=0, center; short dir1= 0, dir2=0; @@ -1223,7 +1223,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, } } - aspect= (float)(block->maxx - block->minx + 4); + /*aspect= (float)(block->maxx - block->minx + 4);*/ /*UNUSED*/ ui_block_to_window_fl(butregion, but->block, &block->minx, &block->miny); ui_block_to_window_fl(butregion, but->block, &block->maxx, &block->maxy); @@ -1232,7 +1232,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, xsize= block->maxx - block->minx+4; // 4 for shadow ysize= block->maxy - block->miny+4; - aspect/= (float)xsize; + /*aspect/= (float)xsize;*/ /*UNUSED*/ if(but) { int left=0, right=0, top=0, down=0; diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index f660dbb9edd..a3f56192cb5 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -143,7 +143,7 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Proper if(label_align != '\0') { PropertyType type = RNA_property_type(prop); - int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(ptr, prop)); + int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop)); name= RNA_property_ui_name(prop); diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index ec08bfccda3..4377fb03632 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -1449,9 +1449,8 @@ static int mesh_separate_material(wmOperator *op, Main *bmain, Scene *scene, Bas /* select the material */ EM_select_by_material(em, curr_mat); /* and now separate */ - if(0==mesh_separate_selected(op, bmain, scene, editbase)) { - BKE_mesh_end_editmesh(me, em); - return 0; + if(em->totfacesel > 0) { + mesh_separate_selected(op, bmain, scene, editbase); } } diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 9497370a4fa..eb6854d2548 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -1697,7 +1697,7 @@ void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type) /* ctrl+c in mesh editmode */ -static void mesh_copy_menu(EditMesh *em, wmOperator *op) +static void UNUSED_FUNCTION(mesh_copy_menu)(EditMesh *em, wmOperator *op) { EditSelection *ese; int ret; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index bfae101d38e..9ff2923f733 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3895,7 +3895,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot) /* XXX old bevel not ported yet */ -static void bevel_menu(EditMesh *em) +static void UNUSED_FUNCTION(bevel_menu)(EditMesh *em) { BME_Mesh *bm; BME_TransData_Head *td; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 6bc4c30a898..4660d38a208 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -188,7 +188,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode) } RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object", -FLT_MAX, FLT_MAX); - RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -FLT_MAX, FLT_MAX); + RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -M_PI * 2.0f, M_PI * 2.0f); prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", ""); RNA_def_property_flag(prop, PROP_HIDDEN); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index c8d38218533..61734bc51a2 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -721,7 +721,7 @@ static void spot_interactive(Object *ob, int mode) } #endif -static void special_editmenu(Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(special_editmenu)(Scene *scene, View3D *v3d) { // XXX static short numcuts= 2; Object *ob= OBACT; @@ -1343,7 +1343,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) DAG_ids_flush_update(bmain, 0); } -static void copy_attr_menu(Main *bmain, Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v3d) { Object *ob; short event; @@ -1616,7 +1616,7 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot) /* ********************** */ -static void image_aspect(Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d) { /* all selected objects with an image map: scale in image aspect */ Base *base; @@ -1691,7 +1691,7 @@ static int vergbaseco(const void *a1, const void *a2) } -static void auto_timeoffs(Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(auto_timeoffs)(Scene *scene, View3D *v3d) { Base *base, **basesort, **bs; float start, delta; @@ -1732,7 +1732,7 @@ static void auto_timeoffs(Scene *scene, View3D *v3d) } -static void ofs_timeoffs(Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(ofs_timeoffs)(Scene *scene, View3D *v3d) { float offset=0.0f; @@ -1751,7 +1751,7 @@ static void ofs_timeoffs(Scene *scene, View3D *v3d) } -static void rand_timeoffs(Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(rand_timeoffs)(Scene *scene, View3D *v3d) { Base *base; float rand_ofs=0.0f; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index f7c6ff99bde..78f3537bea9 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -246,7 +246,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op, } /* tag for updates */ - ob->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } } CTX_DATA_END; @@ -341,7 +341,8 @@ static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op)) negate_v3_v3(v3, v1); mul_m3_v3(mat, v3); } - ob->recalc |= OB_RECALC_OB; + + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } CTX_DATA_END; @@ -871,7 +872,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) (ob->dup_group==ob_other->dup_group && (ob->transflag|ob_other->transflag) & OB_DUPLIGROUP) ) ) { ob_other->flag |= OB_DONE; - ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA; + DAG_id_tag_update(&ob_other->id, OB_RECALC_OB|OB_RECALC_DATA); copy_v3_v3(centn, cent); mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */ @@ -890,11 +891,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - for (tob= bmain->object.first; tob; tob= tob->id.next) { - if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT)) { - tob->recalc= OB_RECALC_OB|OB_RECALC_DATA; - } - } + for (tob= bmain->object.first; tob; tob= tob->id.next) + if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT)) + DAG_id_tag_update(&tob->id, OB_RECALC_OB|OB_RECALC_DATA); if (tot_change) { DAG_ids_flush_update(bmain, 0); diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 98f42fe97c1..85e1eb016d7 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -24,7 +24,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/editors/render/render_shading.c +/** \file blender/editors/render/render_update.c * \ingroup edrend */ @@ -58,6 +58,7 @@ #include "GPU_material.h" +#include "ED_node.h" #include "ED_render.h" #include "render_intern.h" // own include @@ -115,6 +116,8 @@ static void texture_changed(Main *bmain, Tex *tex) Material *ma; Lamp *la; World *wo; + Scene *scene; + bNode *node; /* icons */ BKE_icon_changed(BKE_icon_getid(&tex->id)); @@ -146,6 +149,16 @@ static void texture_changed(Main *bmain, Tex *tex) BKE_icon_changed(BKE_icon_getid(&wo->id)); } + + /* find compositing nodes */ + for(scene=bmain->scene.first; scene; scene=scene->id.next) { + if(scene->use_nodes && scene->nodetree) { + for(node=scene->nodetree->nodes.first; node; node=node->next) { + if(node->id == &tex->id) + ED_node_changed_update(&scene->id, node); + } + } + } } static void lamp_changed(Main *bmain, Lamp *la) diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 3effea296d7..4707baa279b 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -675,7 +675,12 @@ static int scrollback_append_exec(bContext *C, wmOperator *op) console_scrollback_limit(sc); - console_textview_update_rect(sc, ar); + /* 'ar' can be null depending on the operator that runs + * rendering with invoke default for eg causes this */ + if(ar) { + console_textview_update_rect(sc, ar); + } + ED_area_tag_redraw(CTX_wm_area(C)); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index d4253495e97..4dd97c63d40 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1159,6 +1159,13 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused)) return OPERATOR_FINISHED; } +/* TODO, directory operator is non-functional while a library is loaded + * until this is properly supported just disable it. */ +static int file_directory_poll(bContext *C) +{ + return ED_operator_file_active(C) && filelist_lib(CTX_wm_space_file(C)->files) == NULL; +} + void FILE_OT_directory(struct wmOperatorType *ot) { /* identifiers */ @@ -1169,7 +1176,7 @@ void FILE_OT_directory(struct wmOperatorType *ot) /* api callbacks */ ot->invoke= file_directory_invoke; ot->exec= file_directory_exec; - ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ + ot->poll= file_directory_poll; /* <- important, handler is on window level */ } void FILE_OT_refresh(struct wmOperatorType *ot) diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index e245e19ce96..7382188d62a 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -602,28 +602,6 @@ short filelist_changed(struct FileList* filelist) return filelist->changed; } -static struct ImBuf * filelist_loadimage(struct FileList* filelist, int index) -{ - ImBuf *imb = NULL; - int fidx = 0; - - if ( (index < 0) || (index >= filelist->numfiltered) ) { - return NULL; - } - fidx = filelist->fidx[index]; - imb = filelist->filelist[fidx].image; - if (!imb) - { - if ( (filelist->filelist[fidx].flags & IMAGEFILE) || (filelist->filelist[fidx].flags & MOVIEFILE) ) { - imb = IMB_thumb_read(filelist->filelist[fidx].path, THB_NORMAL); - } - if (imb) { - filelist->filelist[fidx].image = imb; - } - } - return imb; -} - struct ImBuf * filelist_getimage(struct FileList* filelist, int index) { ImBuf* ibuf = NULL; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index df638107bc3..0f87be0f807 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1170,7 +1170,7 @@ static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static void NLA_OT_bake (wmOperatorType *ot) +void NLA_OT_bake (wmOperatorType *ot) { /* identifiers */ ot->name= "Bake Strips"; diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index c719f749582..9cafc46ca53 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -479,72 +479,88 @@ static void snode_tag_changed(SpaceNode *snode, bNode *node) NodeTagIDChanged(snode->nodetree, gnode->id); } -void node_set_active(SpaceNode *snode, bNode *node) +static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) { - nodeSetActive(snode->edittree, node); + bNode *node; + + if(ntree == lookup) + return 1; + + for(node=ntree->nodes.first; node; node=node->next) + if(node->type == NODE_GROUP && node->id) + if(has_nodetree((bNodeTree*)node->id, lookup)) + return 1; + + return 0; +} + +void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node) +{ + nodeSetActive(ntree, node); if(node->type!=NODE_GROUP) { int was_output= (node->flag & NODE_DO_OUTPUT); /* tree specific activate calls */ - if(snode->treetype==NTREE_SHADER) { + if(ntree->type==NTREE_SHADER) { /* when we select a material, active texture is cleared, for buttons */ if(node->id && GS(node->id->name)==ID_MA) - nodeClearActiveID(snode->edittree, ID_TE); + nodeClearActiveID(ntree, ID_TE); if(node->type==SH_NODE_OUTPUT) { bNode *tnode; - for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next) + for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) if( tnode->type==SH_NODE_OUTPUT) tnode->flag &= ~NODE_DO_OUTPUT; node->flag |= NODE_DO_OUTPUT; if(was_output==0) - ED_node_changed_update(snode->id, node); + ED_node_generic_update(bmain, ntree, node); } WM_main_add_notifier(NC_MATERIAL|ND_NODES, node->id); } - else if(snode->treetype==NTREE_COMPOSIT) { - Scene *scene= (Scene*)snode->id; - + else if(ntree->type==NTREE_COMPOSIT) { /* make active viewer, currently only 1 supported... */ if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { bNode *tnode; - for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next) + for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) if( ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) tnode->flag &= ~NODE_DO_OUTPUT; node->flag |= NODE_DO_OUTPUT; - if(was_output==0) { - snode_tag_changed(snode, node); - - ED_node_changed_update(snode->id, node); - } + if(was_output==0) + ED_node_generic_update(bmain, ntree, node); /* addnode() doesnt link this yet... */ node->id= (ID *)BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node"); } else if(node->type==CMP_NODE_R_LAYERS) { - if(node->id==NULL || node->id==(ID *)scene) { - scene->r.actlay= node->custom1; + Scene *scene; + + for(scene=bmain->scene.first; scene; scene=scene->id.next) { + if(scene->nodetree && scene->use_nodes && has_nodetree(scene->nodetree, ntree)) { + if(node->id==NULL || node->id==(ID *)scene) { + scene->r.actlay= node->custom1; + } + } } } else if(node->type==CMP_NODE_COMPOSITE) { bNode *tnode; - for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next) + for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) if( tnode->type==CMP_NODE_COMPOSITE) tnode->flag &= ~NODE_DO_OUTPUT; node->flag |= NODE_DO_OUTPUT; - ED_node_changed_update(snode->id, node); + ED_node_generic_update(bmain, ntree, node); } } - else if(snode->treetype==NTREE_TEXTURE) { + else if(ntree->type==NTREE_TEXTURE) { // XXX #if 0 if(node->id) @@ -1625,7 +1641,7 @@ void NODE_OT_link_viewer(wmOperatorType *ot) /* return 0, nothing done */ -static int node_mouse_groupheader(SpaceNode *snode) +static int UNUSED_FUNCTION(node_mouse_groupheader)(SpaceNode *snode) { bNode *gnode; float mx=0, my=0; @@ -1940,7 +1956,7 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace) } /* can be called from menus too, but they should do own undopush and redraws */ -bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float locy) +bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, int type, float locx, float locy) { bNode *node= NULL, *gnode; @@ -1955,7 +1971,7 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float return NULL; } else { - bNodeTree *ngroup= BLI_findlink(&G.main->nodetree, type-NODE_GROUP_MENU); + bNodeTree *ngroup= BLI_findlink(&bmain->nodetree, type-NODE_GROUP_MENU); if(ngroup) node= nodeAddNodeType(snode->edittree, NODE_GROUP, ngroup, NULL); } @@ -1976,7 +1992,7 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float } node_tree_verify_groups(snode->nodetree); - node_set_active(snode, node); + ED_node_set_active(bmain, snode->edittree, node); if(snode->nodetree->type==NTREE_COMPOSIT) { if(ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE)) @@ -2991,10 +3007,10 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op)) for(node= snode->edittree->nodes.first; node; node= node->next) { if(node->flag & SELECT) { - if(node->inputs.first && node->outputs.first) { + /* Be able to mute in-/output nodes as well. - DingTo + if(node->inputs.first && node->outputs.first) { */ node->flag ^= NODE_MUTED; snode_tag_changed(snode, node); - } } } @@ -3205,6 +3221,7 @@ void NODE_OT_show_cyclic_dependencies(wmOperatorType *ot) static int node_add_file_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -3245,7 +3262,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(C); - node = node_add_node(snode, scene, ntype, snode->mx, snode->my); + node = node_add_node(snode, bmain, scene, ntype, snode->mx, snode->my); if (!node) { BKE_report(op->reports, RPT_WARNING, "Could not add an image node."); diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 4f3991e8ff8..634e49dc515 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -64,6 +64,8 @@ static void do_node_add(bContext *C, void *UNUSED(arg), int event) { + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); SpaceNode *snode= CTX_wm_space_node(C); ScrArea *sa= CTX_wm_area(C); ARegion *ar; @@ -87,7 +89,7 @@ static void do_node_add(bContext *C, void *UNUSED(arg), int event) else node->flag &= ~NODE_TEST; } - node= node_add_node(snode, CTX_data_scene(C), event, snode->mx, snode->my); + node= node_add_node(snode, bmain, scene, event, snode->mx, snode->my); /* select previous selection before autoconnect */ for(node= snode->edittree->nodes.first; node; node= node->next) { diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 9122235f33c..4cfde22b8a0 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -43,6 +43,7 @@ struct wmWindowManager; struct bNode; struct bNodeSocket; struct bNodeLink; +struct Main; /* temp data to pass on to modal */ typedef struct bNodeLinkDrag @@ -97,10 +98,9 @@ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *tre void snode_notify(bContext *C, SpaceNode *snode); void snode_dag_update(bContext *C, SpaceNode *snode); bNode *next_node(bNodeTree *ntree); -bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float locy); +bNode *node_add_node(SpaceNode *snode, struct Main *bmain, Scene *scene, int type, float locx, float locy); void snode_set_context(SpaceNode *snode, Scene *scene); void snode_make_group_editable(SpaceNode *snode, bNode *gnode); -void node_set_active(SpaceNode *snode, bNode *node); void node_deselectall(SpaceNode *snode); int node_select_same_type(SpaceNode *snode); int node_select_same_type_np(SpaceNode *snode, int dir); diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 1abcaccc939..ca673277739 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -37,10 +37,12 @@ #include "DNA_scene_types.h" #include "BKE_context.h" +#include "BKE_main.h" #include "BLI_rect.h" #include "BLI_utildefines.h" +#include "ED_node.h" #include "ED_screen.h" #include "ED_types.h" @@ -70,7 +72,7 @@ static bNode *node_under_mouse(bNodeTree *ntree, int mx, int my) /* ****** Click Select ****** */ -static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const int mval[2], short extend) +static bNode *node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const int mval[2], short extend) { bNode *node; float mx, my; @@ -92,7 +94,7 @@ static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const int mval[2] else node->flag ^= SELECT; - node_set_active(snode, node); + ED_node_set_active(bmain, snode->edittree, node); } return node; @@ -100,6 +102,7 @@ static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const int mval[2] static int node_select_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); int mval[2]; @@ -113,7 +116,7 @@ static int node_select_exec(bContext *C, wmOperator *op) extend = RNA_boolean_get(op->ptr, "extend"); /* perform the select */ - node= node_mouse_select(snode, ar, mval, extend); + node= node_mouse_select(bmain, snode, ar, mval, extend); /* send notifiers */ WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL); diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 23873b1fde7..b701aecafb8 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -658,8 +658,8 @@ int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement { switch(te->idcode) { - case ID_OB: - return tree_element_set_active_object(C, scene, soops, te, set); + /* Note: no ID_OB: objects are handled specially to allow multiple + selection. See do_outliner_item_activate. */ case ID_MA: return tree_element_active_material(C, scene, soops, te, set); case ID_WO: diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 54229a683a3..2fe16b3a85d 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -83,9 +83,8 @@ /* avoid passing multiple args and be more verbose */ #define SEQPROP_STARTFRAME (1<<0) #define SEQPROP_ENDFRAME (1<<1) -#define SEQPROP_FILES (1<<2) -#define SEQPROP_NOPATHS (1<<3) -#define SEQPROP_NOCHAN (1<<4) +#define SEQPROP_NOPATHS (1<<2) +#define SEQPROP_NOCHAN (1<<3) #define SELECT 1 @@ -102,9 +101,6 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag) RNA_def_boolean(ot->srna, "replace_sel", 1, "Replace Selection", "replace the current selection"); RNA_def_boolean(ot->srna, "overlap", 0, "Allow Overlap", "Don't correct overlap on new sequence strips"); - - if(flag & SEQPROP_FILES) - RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", ""); } static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, const char *identifier) @@ -411,8 +407,8 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH); - sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILES); + WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES); + sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME); RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie"); } @@ -466,8 +462,8 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH); - sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILES); + WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES); + sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME); RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory."); } @@ -573,8 +569,8 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH); - sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME|SEQPROP_FILES); + WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILES); + sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME); } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index bc97ff341db..352e9f43648 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -736,7 +736,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline static Sequence *special_seq_update= 0; -static void set_special_seq_update(int val) +static void UNUSED_FUNCTION(set_special_seq_update)(int val) { // int x; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index b9f6b986691..c967d60b001 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -75,10 +75,6 @@ /* own include */ #include "sequencer_intern.h" -static void error(const char *UNUSED(dummy)) {} -static void waitcursor(int UNUSED(val)) {} -static void activate_fileselect(int UNUSED(d1), const char *UNUSED(d2), const char *UNUSED(d3), void *UNUSED(d4)) {} -static int pupmenu(const char *UNUSED(dummy)) {return 0;} static int okee(const char *UNUSED(dummy)) {return 0;} @@ -140,7 +136,7 @@ void seq_rectf(Sequence *seq, rctf *rectf) rectf->ymax= seq->machine+SEQ_STRIP_OFSTOP; } -static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect */ +static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* called from fileselect */ { Editing *ed= seq_give_editing(scene, FALSE); struct SeqEffectHandle sh; @@ -393,207 +389,6 @@ void recurs_sel_seq(Sequence *seqm) } } -int event_to_efftype(int event) -{ - if(event==2) return SEQ_CROSS; - if(event==3) return SEQ_GAMCROSS; - if(event==4) return SEQ_ADD; - if(event==5) return SEQ_SUB; - if(event==6) return SEQ_MUL; - if(event==7) return SEQ_ALPHAOVER; - if(event==8) return SEQ_ALPHAUNDER; - if(event==9) return SEQ_OVERDROP; - if(event==10) return SEQ_PLUGIN; - if(event==13) return SEQ_WIPE; - if(event==14) return SEQ_GLOW; - if(event==15) return SEQ_TRANSFORM; - if(event==16) return SEQ_COLOR; - if(event==17) return SEQ_SPEED; - if(event==18) return SEQ_ADJUSTMENT; - if(event==19) return SEQ_TITLECARD; - return 0; -} - -#if 0 -static void reload_sound_strip(Scene *scene, char *name) -{ - Editing *ed; - Sequence *seq, *seqact; - SpaceFile *sfile; - Sequence *last_seq= seq_active_get(scene); - - ed= scene->ed; - - if(last_seq==0 || last_seq->type!=SEQ_SOUND) return; - seqact= last_seq; /* last_seq changes in alloc_sequence */ - - /* search sfile */ -// sfile= scrarea_find_space_of_type(curarea, SPACE_FILE); - if(sfile==0) return; - - waitcursor(1); - - seq = sfile_to_snd_sequence(sfile, seqact->start, seqact->machine); - printf("seq->type: %i\n", seq->type); - if(seq && seq!=seqact) { - /* i'm not sure about this one, seems to work without it -- sgefant */ - seq_free_strip(seqact->strip); - - seqact->strip= seq->strip; - - seqact->len= seq->len; - calc_sequence(scene, seqact); - - seq->strip= 0; - seq_free_sequence(scene, seq); - BLI_remlink(ed->seqbasep, seq); - - seq= ed->seqbasep->first; - - } - - waitcursor(0); - -} -#endif - -static void reload_image_strip(Scene *scene, char *UNUSED(name)) -{ - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq=NULL, *seqact; - SpaceFile *sfile=NULL; - Sequence *last_seq= seq_active_get(scene); - - - - if(last_seq==NULL || last_seq->type!=SEQ_IMAGE) return; - seqact= last_seq; /* last_seq changes in alloc_sequence */ - - /* search sfile */ -// sfile= scrarea_find_space_of_type(curarea, SPACE_FILE); - if(sfile == NULL) return; - - waitcursor(1); - -// seq= sfile_to_sequence(scene, sfile, seqact->start, seqact->machine, 1); // XXX ADD BACK - if(seq && seq!=seqact) { - seq_free_strip(seqact->strip); - - seqact->strip= seq->strip; - - seqact->len= seq->len; - calc_sequence(scene, seqact); - - seq->strip= NULL; - seq_free_sequence(scene, seq); - BLI_remlink(ed->seqbasep, seq); - - update_changed_seq_and_deps(scene, seqact, 1, 1); - } - waitcursor(0); - -} - - -static void change_sequence(Scene *scene) -{ - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *last_seq= seq_active_get(scene); - Scene *sce; - short event; - - if(last_seq == NULL) return; - - if(last_seq->type & SEQ_EFFECT) { - event = pupmenu("Change Effect%t" - "|Switch A <-> B %x1" - "|Switch B <-> C %x10" - "|Plugin%x11" - "|Recalculate%x12" - "|Cross%x2" - "|Gamma Cross%x3" - "|Add%x4" - "|Sub%x5" - "|Mul%x6" - "|Alpha Over%x7" - "|Alpha Under%x8" - "|Alpha Over Drop%x9" - "|Wipe%x13" - "|Glow%x14" - "|Transform%x15" - "|Color Generator%x16" - "|Speed Control%x17" - "|Adjustment Layer%x18" - "|Title Card%x19"); - if(event > 0) { - if(event==1) { - SWAP(Sequence *,last_seq->seq1,last_seq->seq2); - } - else if(event==10) { - SWAP(Sequence *,last_seq->seq2,last_seq->seq3); - } - else if(event==11) { - activate_fileselect( - FILE_SPECIAL, "Select Plugin", - U.plugseqdir, change_plugin_seq); - } - else if(event==12); - /* recalculate: only new_stripdata */ - else { - /* free previous effect and init new effect */ - struct SeqEffectHandle sh; - - if (get_sequence_effect_num_inputs( - last_seq->type) - < get_sequence_effect_num_inputs( - event_to_efftype(event))) { - error("New effect needs more " - "input strips!"); - } else { - sh = get_sequence_effect(last_seq); - sh.free(last_seq); - - last_seq->type - = event_to_efftype(event); - - sh = get_sequence_effect(last_seq); - sh.init(last_seq); - } - } - - update_changed_seq_and_deps(scene, last_seq, 0, 1); - } - } - else if(last_seq->type == SEQ_IMAGE) { - if(okee("Change images")) { - activate_fileselect(FILE_SPECIAL, - "Select Images", - ed->act_imagedir, - reload_image_strip); - } - } - else if(last_seq->type == SEQ_MOVIE) { - ; - } - else if(last_seq->type == SEQ_SCENE) { - event= pupmenu("Change Scene%t|Update Start and End"); - - if(event==1) { - sce= last_seq->scene; - - last_seq->len= sce->r.efra - sce->r.sfra + 1; - last_seq->sfra= sce->r.sfra; - - /* bad code to change seq->len? update_changed_seq_and_deps() expects the strip->len to be OK */ - new_tstripdata(last_seq); - - update_changed_seq_and_deps(scene, last_seq, 1, 1); - - } - } - -} - int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3, const char **error_str) { Editing *ed = seq_give_editing(scene, FALSE); @@ -964,7 +759,7 @@ static int insert_gap(Scene *scene, int gap, int cfra) return done; } -static void touch_seq_files(Scene *scene) +static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene) { Sequence *seq; Editing *ed= seq_give_editing(scene, FALSE); @@ -976,7 +771,7 @@ static void touch_seq_files(Scene *scene) if(okee("Touch and print selected movies")==0) return; - waitcursor(1); + WM_cursor_wait(1); SEQP_BEGIN(ed, seq) { if(seq->flag & SELECT) { @@ -991,7 +786,7 @@ static void touch_seq_files(Scene *scene) } SEQ_END - waitcursor(0); + WM_cursor_wait(0); } /* @@ -1019,7 +814,7 @@ static void set_filter_seq(Scene *scene) } */ -static void seq_remap_paths(Scene *scene) +static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene) { Sequence *seq, *last_seq = seq_active_get(scene); Editing *ed= seq_give_editing(scene, FALSE); @@ -1060,7 +855,7 @@ static void seq_remap_paths(Scene *scene) } -static void no_gaps(Scene *scene) +static void UNUSED_FUNCTION(no_gaps)(Scene *scene) { Editing *ed= seq_give_editing(scene, FALSE); int cfra, first= 0, done; @@ -1106,6 +901,19 @@ int sequencer_edit_poll(bContext *C) return (seq_give_editing(CTX_data_scene(C), FALSE) != NULL); } +int sequencer_strip_poll(bContext *C) +{ + Editing *ed; + return (((ed= seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && (ed->act_seq != NULL)); +} + +int sequencer_strip_has_path_poll(bContext *C) +{ + Editing *ed; + Sequence *seq; + return (((ed= seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && ((seq= ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq))); +} + int sequencer_view_poll(bContext *C) { SpaceSeq *sseq= CTX_wm_space_seq(C); @@ -1758,6 +1566,58 @@ void SEQUENCER_OT_delete(wmOperatorType *ot) } +/* offset clear operator */ +static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene= CTX_data_scene(C); + Editing *ed= seq_give_editing(scene, FALSE); + Sequence *seq; + + /* for effects, try to find a replacement input */ + for(seq=ed->seqbasep->first; seq; seq=seq->next) { + if((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) { + seq->startofs= seq->endofs= seq->startstill= seq->endstill= 0; + } + } + + /* updates lengths etc */ + seq= ed->seqbasep->first; + while(seq) { + calc_sequence(scene, seq); + seq= seq->next; + } + + for(seq=ed->seqbasep->first; seq; seq=seq->next) { + if((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) { + if(seq_test_overlap(ed->seqbasep, seq)) { + shuffle_seq(ed->seqbasep, seq, scene); + } + } + } + + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; +} + + +void SEQUENCER_OT_offset_clear(wmOperatorType *ot) +{ + + /* identifiers */ + ot->name= "Clear Strip Offset"; + ot->idname= "SEQUENCER_OT_offset_clear"; + ot->description="Clear strip offsets from the start and end frames"; + + /* api callbacks */ + ot->exec= sequencer_offset_clear_exec; + ot->poll= sequencer_edit_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + + /* separate_images operator */ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) { @@ -2833,3 +2693,230 @@ void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot) /* rna */ WM_operator_properties_gesture_border(ot, FALSE); } + + +/* change ops */ + +static EnumPropertyItem prop_change_effect_input_types[] = { + {0, "A_B", 0, "A -> B", ""}, + {1, "B_C", 0, "B -> C", ""}, + {2, "A_C", 0, "A -> C", ""}, + {0, NULL, 0, NULL, NULL} +}; + +static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + Editing *ed= seq_give_editing(scene, FALSE); + Sequence *seq= seq_active_get(scene); + + Sequence **seq_1, **seq_2; + + switch(RNA_enum_get(op->ptr, "swap")) { + case 0: + seq_1= &seq->seq1; + seq_2= &seq->seq2; + break; + case 1: + seq_1= &seq->seq2; + seq_2= &seq->seq3; + break; + default: /* 2 */ + seq_1= &seq->seq1; + seq_2= &seq->seq3; + break; + } + + if(*seq_1 == NULL || *seq_2 == NULL) { + BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, can't swap"); + return OPERATOR_CANCELLED; + } + else { + SWAP(Sequence *, *seq_1, *seq_2); + } + + update_changed_seq_and_deps(scene, seq, 0, 1); + + /* important else we dont get the imbuf cache flushed */ + free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE); + + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; +} + +void SEQUENCER_OT_change_effect_input(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Change Effect Input"; + ot->idname= "SEQUENCER_OT_change_effect_input"; + ot->description=""; + + /* api callbacks */ + ot->exec= sequencer_change_effect_input_exec; + ot->poll= sequencer_effect_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + ot->prop= RNA_def_enum(ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap"); +} + +static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + Editing *ed= seq_give_editing(scene, FALSE); + Sequence *seq= seq_active_get(scene); + const int new_type= RNA_enum_get(op->ptr, "type"); + + /* free previous effect and init new effect */ + struct SeqEffectHandle sh; + + if ((seq->type & SEQ_EFFECT) == 0) { + return OPERATOR_CANCELLED; + } + + /* can someone explain the logic behind only allowing to increse this, + * copied from 2.4x - campbell */ + if (get_sequence_effect_num_inputs(seq->type) < + get_sequence_effect_num_inputs(new_type) + ) { + BKE_report(op->reports, RPT_ERROR, "New effect needs more input strips"); + return OPERATOR_CANCELLED; + } + else { + sh = get_sequence_effect(seq); + sh.free(seq); + + seq->type= new_type; + + sh = get_sequence_effect(seq); + sh.init(seq); + } + + /* update */ + update_changed_seq_and_deps(scene, seq, 0, 1); + + /* important else we dont get the imbuf cache flushed */ + free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE); + + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; +} + +void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Change Effect Type"; + ot->idname= "SEQUENCER_OT_change_effect_type"; + ot->description=""; + + /* api callbacks */ + ot->exec= sequencer_change_effect_type_exec; + ot->poll= sequencer_effect_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + ot->prop= RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type"); +} + +static int sequencer_change_path_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + Editing *ed= seq_give_editing(scene, FALSE); + Sequence *seq= seq_active_get(scene); + + if(seq->type == SEQ_IMAGE) { + char directory[FILE_MAX]; + const int len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); + StripElem *se; + + if(len==0) + return OPERATOR_CANCELLED; + + RNA_string_get(op->ptr, "directory", directory); + BLI_strncpy(seq->strip->dir, directory, sizeof(seq->strip->dir)); + + if(seq->strip->stripdata) { + MEM_freeN(seq->strip->stripdata); + } + seq->strip->stripdata= se= MEM_callocN(len*sizeof(StripElem), "stripelem"); + + RNA_BEGIN(op->ptr, itemptr, "files") { + char *filename= RNA_string_get_alloc(&itemptr, "name", NULL, 0); + BLI_strncpy(se->name, filename, sizeof(se->name)); + MEM_freeN(filename); + se++; + } + RNA_END; + + /* reset these else we wont see all the images */ + seq->anim_startofs= seq->anim_endofs= 0; + + /* correct start/end frames so we dont move + * important not to set seq->len= len; allow the function to handle it */ + reload_sequence_new_file(scene, seq, TRUE); + + calc_sequence(scene, seq); + + /* important else we dont get the imbuf cache flushed */ + free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE); + } + else { + /* lame, set rna filepath */ + PointerRNA seq_ptr; + PropertyRNA *prop; + char filepath[FILE_MAX]; + + RNA_pointer_create(&scene->id, &RNA_Sequence, seq, &seq_ptr); + + RNA_string_get(op->ptr, "filepath", filepath); + prop= RNA_struct_find_property(&seq_ptr, "filepath"); + RNA_property_string_set(&seq_ptr, prop, filepath); + RNA_property_update(C, &seq_ptr, prop); + } + + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; +} + +static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +{ + Scene *scene= CTX_data_scene(C); + Sequence *seq= seq_active_get(scene); + + RNA_string_set(op->ptr, "directory", seq->strip->dir); + + /* set default display depending on seq type */ + if(seq->type == SEQ_IMAGE) { + RNA_boolean_set(op->ptr, "filter_movie", 0); + } + else { + RNA_boolean_set(op->ptr, "filter_image", 0); + } + + WM_event_add_fileselect(C, op); + + return OPERATOR_RUNNING_MODAL; +} + +void SEQUENCER_OT_change_path(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Change Data/Files"; + ot->idname= "SEQUENCER_OT_change_path"; + ot->description=""; + + /* api callbacks */ + ot->exec= sequencer_change_path_exec; + ot->invoke= sequencer_change_path_invoke; + ot->poll= sequencer_strip_has_path_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILEPATH|WM_FILESEL_FILES); +} diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 209b39662aa..7ab76f9b6d7 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -70,6 +70,8 @@ int seq_effect_find_selected(struct Scene *scene, struct Sequence *activeseq, in /* operator helpers */ int sequencer_edit_poll(struct bContext *C); +int sequencer_strip_poll(struct bContext *C); +int sequencer_strip_has_path_poll(struct bContext *C); int sequencer_view_poll(struct bContext *C); /* externs */ @@ -91,6 +93,7 @@ void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot); void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot); void SEQUENCER_OT_duplicate(struct wmOperatorType *ot); void SEQUENCER_OT_delete(struct wmOperatorType *ot); +void SEQUENCER_OT_offset_clear(struct wmOperatorType *ot); void SEQUENCER_OT_images_separate(struct wmOperatorType *ot); void SEQUENCER_OT_meta_toggle(struct wmOperatorType *ot); void SEQUENCER_OT_meta_make(struct wmOperatorType *ot); @@ -108,6 +111,10 @@ void SEQUENCER_OT_view_selected(struct wmOperatorType *ot); void SEQUENCER_OT_view_zoom_ratio(struct wmOperatorType *ot); void SEQUENCER_OT_view_ghost_border(struct wmOperatorType *ot); +void SEQUENCER_OT_change_effect_input(struct wmOperatorType *ot); +void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot); +void SEQUENCER_OT_change_path(struct wmOperatorType *ot); + void SEQUENCER_OT_copy(struct wmOperatorType *ot); void SEQUENCER_OT_paste(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index f5c26cb17d3..df33ce73b9c 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -68,6 +68,7 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_swap_inputs); WM_operatortype_append(SEQUENCER_OT_duplicate); WM_operatortype_append(SEQUENCER_OT_delete); + WM_operatortype_append(SEQUENCER_OT_offset_clear); WM_operatortype_append(SEQUENCER_OT_images_separate); WM_operatortype_append(SEQUENCER_OT_meta_toggle); WM_operatortype_append(SEQUENCER_OT_meta_make); @@ -86,6 +87,10 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_view_zoom_ratio); WM_operatortype_append(SEQUENCER_OT_view_ghost_border); + WM_operatortype_append(SEQUENCER_OT_change_effect_input); + WM_operatortype_append(SEQUENCER_OT_change_effect_type); + WM_operatortype_append(SEQUENCER_OT_change_path); + /* sequencer_select.c */ WM_operatortype_append(SEQUENCER_OT_select_all_toggle); WM_operatortype_append(SEQUENCER_OT_select_inverse); @@ -145,6 +150,8 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_reassign_inputs", RKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_offset_clear", OKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", XKEY, KM_PRESS, 0, 0); @@ -240,6 +247,8 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_select_border", BKEY, KM_PRESS, 0, 0); WM_keymap_add_menu(keymap, "SEQUENCER_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0); + + WM_keymap_add_menu(keymap, "SEQUENCER_MT_change", CKEY, KM_PRESS, 0, 0); kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", OKEY, KM_PRESS, 0, 0); RNA_string_set(kmi->ptr, "data_path", "scene.sequence_editor.overlay_frame"); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 8d5f372f55e..0ac23765167 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -159,7 +159,7 @@ void select_surround_from_last(Scene *scene) #endif -static void select_single_seq(Scene *scene, Sequence *seq, int deselect_all) /* BRING BACK */ +static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int deselect_all) /* BRING BACK */ { Editing *ed= seq_give_editing(scene, FALSE); diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index 6e6f131655b..51b4b838171 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -43,6 +43,7 @@ #include "BKE_text.h" #include "BLI_blenlib.h" +#include "BLI_utildefines.h" #include "WM_types.h" @@ -192,7 +193,7 @@ static void confirm_suggestion(Text *text, int skipleft) // XXX static int doc_scroll= 0; -static short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) +static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned short evnt, short val) { ARegion *ar= NULL; // XXX int qual= 0; // XXX @@ -375,7 +376,7 @@ static short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short ; // XXX redraw_alltext(); #endif -static short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val) +static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned short evnt, short val) { Text *text; TextMarker *marker, *mrk, *nxt; diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index f070bae4e54..71c85483244 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -29,7 +29,6 @@ * \ingroup spview3d */ - #include <string.h> #include <math.h> @@ -70,24 +69,21 @@ #include "view3d_intern.h" // own include -/***/ +/**************************** Face Select Mode *******************************/ - /* Flags for marked edges */ +/* Flags for marked edges */ enum { eEdge_Visible = (1<<0), eEdge_Select = (1<<1), }; - /* Creates a hash of edges to flags indicating - * adjacent tface select/active/etc flags. - */ +/* Creates a hash of edges to flags indicating selected/visible */ static void get_marked_edge_info__orFlags(EdgeHash *eh, int v0, int v1, int flags) { int *flags_p; - if (!BLI_edgehash_haskey(eh, v0, v1)) { + if(!BLI_edgehash_haskey(eh, v0, v1)) BLI_edgehash_insert(eh, v0, v1, NULL); - } flags_p = (int*) BLI_edgehash_lookup_p(eh, v0, v1); *flags_p |= flags; @@ -96,26 +92,25 @@ static void get_marked_edge_info__orFlags(EdgeHash *eh, int v0, int v1, int flag static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me) { EdgeHash *eh = BLI_edgehash_new(); - int i; MFace *mf; + int i; - for (i=0; i<me->totface; i++) { + for(i=0; i<me->totface; i++) { mf = &me->mface[i]; - if (mf->v3) { - if (!(mf->flag&ME_HIDE)) { - unsigned int flags = eEdge_Visible; - if (mf->flag&ME_FACE_SEL) flags |= eEdge_Select; - - get_marked_edge_info__orFlags(eh, mf->v1, mf->v2, flags); - get_marked_edge_info__orFlags(eh, mf->v2, mf->v3, flags); - if (mf->v4) { - get_marked_edge_info__orFlags(eh, mf->v3, mf->v4, flags); - get_marked_edge_info__orFlags(eh, mf->v4, mf->v1, flags); - } else { - get_marked_edge_info__orFlags(eh, mf->v3, mf->v1, flags); - } + if(!(mf->flag & ME_HIDE)) { + unsigned int flags = eEdge_Visible; + if(mf->flag & ME_FACE_SEL) flags |= eEdge_Select; + + get_marked_edge_info__orFlags(eh, mf->v1, mf->v2, flags); + get_marked_edge_info__orFlags(eh, mf->v2, mf->v3, flags); + + if(mf->v4) { + get_marked_edge_info__orFlags(eh, mf->v3, mf->v4, flags); + get_marked_edge_info__orFlags(eh, mf->v4, mf->v1, flags); } + else + get_marked_edge_info__orFlags(eh, mf->v3, mf->v1, flags); } } @@ -123,45 +118,24 @@ static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me) } -static int draw_tfaces3D__setHiddenOpts(void *userData, int index) +static int draw_mesh_face_select__setHiddenOpts(void *userData, int index) { struct { Mesh *me; EdgeHash *eh; } *data = userData; Mesh *me= data->me; MEdge *med = &me->medge[index]; uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2); - if((me->drawflag & ME_DRAWSEAMS) && (med->flag&ME_SEAM)) { - return 0; - } else if(me->drawflag & ME_DRAWEDGES){ - if (me->drawflag & ME_HIDDENEDGES) { + if(me->drawflag & ME_DRAWEDGES) { + if(me->drawflag & ME_HIDDENEDGES) return 1; - } else { - return (flags & eEdge_Visible); - } - } else { - return (flags & eEdge_Select); - } -} - -static int draw_tfaces3D__setSeamOpts(void *userData, int index) -{ - struct { Mesh *me; EdgeHash *eh; } *data = userData; - Mesh *me= data->me; - MEdge *med = &data->me->medge[index]; - uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2); - - if (med->flag & ME_SEAM) { - if (me->drawflag & ME_HIDDENEDGES) { - return 1; - } else { + else return (flags & eEdge_Visible); - } - } else { - return 0; } + else + return (flags & eEdge_Select); } -static int draw_tfaces3D__setSelectOpts(void *userData, int index) +static int draw_mesh_face_select__setSelectOpts(void *userData, int index) { struct { Mesh *me; EdgeHash *eh; } *data = userData; MEdge *med = &data->me->medge[index]; @@ -170,45 +144,19 @@ static int draw_tfaces3D__setSelectOpts(void *userData, int index) return flags & eEdge_Select; } -#if 0 -static int draw_tfaces3D__setActiveOpts(void *userData, int index) -{ - struct { Mesh *me; EdgeHash *eh; } *data = userData; - MEdge *med = &data->me->medge[index]; - uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2); - - if (flags & eEdge_Select) { - return 1; - } else { - return 0; - } -} - -static int draw_tfaces3D__drawFaceOpts(void *userData, int index) -{ - Mesh *me = (Mesh*)userData; - - MFace *mface = &me->mface[index]; - if (!(mface->flag&ME_HIDE) && (mface->flag&ME_FACE_SEL)) - return 2; /* Don't set color */ - else - return 0; -} -#endif - /* draws unselected */ -static int draw_tfaces3D__drawFaceOptsInv(void *userData, int index) +static int draw_mesh_face_select__drawFaceOptsInv(void *userData, int index) { Mesh *me = (Mesh*)userData; MFace *mface = &me->mface[index]; - if (!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL)) + if(!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL)) return 2; /* Don't set color */ else return 0; } -static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short draw_seams) +static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) { struct { Mesh *me; EdgeHash *eh; } data; @@ -222,30 +170,16 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short d /* Draw (Hidden) Edges */ setlinestyle(1); UI_ThemeColor(TH_EDGE_FACESEL); - dm->drawMappedEdges(dm, draw_tfaces3D__setHiddenOpts, &data); + dm->drawMappedEdges(dm, draw_mesh_face_select__setHiddenOpts, &data); setlinestyle(0); - /* Draw Seams */ - if(draw_seams && me->drawflag & ME_DRAWSEAMS) { - UI_ThemeColor(TH_EDGE_SEAM); - glLineWidth(2); - dm->drawMappedEdges(dm, draw_tfaces3D__setSeamOpts, &data); - glLineWidth(1); - } - /* Draw Selected Faces */ if(me->drawflag & ME_DRAWFACES) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -#if 0 - UI_ThemeColor4(TH_FACE_SELECT); - - dm->drawMappedFacesTex(dm, draw_tfaces3D__drawFaceOpts, (void*)me); -#else /* dull unselected faces so as not to get in the way of seeing color */ glColor4ub(96, 96, 96, 64); - dm->drawMappedFacesTex(dm, draw_tfaces3D__drawFaceOptsInv, (void*)me); -#endif + dm->drawMappedFacesTex(dm, draw_mesh_face_select__drawFaceOptsInv, (void*)me); glDisable(GL_BLEND); } @@ -255,7 +189,7 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short d /* Draw Stippled Outline for selected faces */ glColor3ub(255, 255, 255); setlinestyle(1); - dm->drawMappedEdges(dm, draw_tfaces3D__setSelectOpts, &data); + dm->drawMappedEdges(dm, draw_mesh_face_select__setSelectOpts, &data); setlinestyle(0); bglPolygonOffset(rv3d->dist, 0.0); // resets correctly now, even after calling accumulated offsets @@ -263,6 +197,8 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short d BLI_edgehash_free(data.eh, NULL); } +/***************************** Texture Drawing ******************************/ + static Material *give_current_material_or_def(Object *ob, int matnr) { extern Material defmaterial; // render module abuse... @@ -668,18 +604,21 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o if(ob->mode & OB_MODE_EDIT) { dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh); - } else if(faceselect) { + } + else if(faceselect) { if(ob->mode & OB_MODE_WEIGHT_PAINT) dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material); else dm->drawMappedFacesTex(dm, me->mface ? draw_tface_mapped__set_draw : NULL, me); } else { - if( GPU_buffer_legacy(dm) ) + if(GPU_buffer_legacy(dm)) { dm->drawFacesTex(dm, draw_tface__set_draw_legacy); + } else { - if( !CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL) ) + if(!CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL)) add_tface_color_layer(dm); + dm->drawFacesTex(dm, draw_tface__set_draw); } } @@ -692,7 +631,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o /* draw edges and selected faces over textured mesh */ if(!(ob == scene->obedit) && faceselect) - draw_tfaces3D(rv3d, me, dm, ob->mode & OB_MODE_WEIGHT_PAINT); + draw_mesh_face_select(rv3d, me, dm); /* reset from negative scale correction */ glFrontFace(GL_CCW); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 3746428b0c6..75cd250d831 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5524,7 +5524,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base) } } else if(ob->type==OB_ARMATURE) { - if(!(ob->mode & OB_MODE_POSE)) + if(!(ob->mode & OB_MODE_POSE && base == scene->basact)) draw_armature(scene, v3d, ar, base, OB_WIRE, FALSE, TRUE); } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 6e3f6549ba3..7cf95261211 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2769,3 +2769,4 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) v3d->flag |= V3D_INVALID_BACKBUF; } + diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index 8bf923a5679..d0c7f9d494f 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -178,6 +178,7 @@ typedef struct GPUVertexAttribs { struct { int type; int glindex; + int gltexco; char name[32]; } layer[GPU_MAX_ATTRIB]; diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 919b0eb0c29..8b0104fcdca 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -355,7 +355,7 @@ struct anim * IMB_open_anim( const char * name, int ib_flags) { anim = (struct anim*)MEM_callocN(sizeof(struct anim), "anim struct"); if (anim != NULL) { - strcpy(anim->name, name); /* fixme: possible buffer overflow here? */ + BLI_strncpy(anim->name, name, sizeof(anim->name)); anim->ib_flags = ib_flags; } return(anim); diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 1644e653df4..3f391b91c0f 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -371,11 +371,15 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter) float weight[25]; /* build a weights buffer */ - n= 2; - k= 0; + n= 1; + /*k= 0; for(i = -n; i <= n; i++) for(j = -n; j <= n; j++) weight[k++] = sqrt((float) i * i + j * j); + */ + weight[0]=1; weight[1]=2; weight[2]=1; + weight[3]=2; weight[4]=0; weight[5]=2; + weight[6]=1; weight[7]=2; weight[8]=1; /* run passes */ for(r = 0; cannot_early_out == 1 && r < filter; r++) { @@ -393,10 +397,10 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter) float acc[4]={0,0,0,0}; k = 0; - if (check_pixel_assigned(srcbuf, srcmask, filter_make_index(x-1, y, width, height), depth, is_float) || + /*if (check_pixel_assigned(srcbuf, srcmask, filter_make_index(x-1, y, width, height), depth, is_float) || check_pixel_assigned(srcbuf, srcmask, filter_make_index(x+1, y, width, height), depth, is_float) || check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y-1, width, height), depth, is_float) || - check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y+1, width, height), depth, is_float)) { + check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y+1, width, height), depth, is_float))*/ { for(i= -n; i<=n; i++) { for(j=-n; j<=n; j++) { if(i != 0 || j != 0) { diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 3787675f339..053f3b38168 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -712,16 +712,16 @@ typedef struct ShapeKeyModifierData { typedef struct SolidifyModifierData { ModifierData modifier; - char defgrp_name[32]; /* name of vertex group to use */ + char defgrp_name[32]; /* name of vertex group to use */ float offset; /* new surface offset level*/ float offset_fac; /* midpoint of the offset */ + float offset_fac_vg; /* factor for the minimum weight to use when vgroups are used, avoids 0.0 weights giving duplicate geometry */ float crease_inner; float crease_outer; float crease_rim; int flag; short mat_ofs; short mat_ofs_rim; - int pad; } SolidifyModifierData; #define MOD_SOLIDIFY_RIM (1<<0) diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index d6d571635f7..b5b178c6c01 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -656,7 +656,7 @@ int RNA_property_flag(PropertyRNA *prop); void *RNA_property_py_data_get(PropertyRNA *prop); int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop); -int RNA_property_array_check(PointerRNA *ptr, PropertyRNA *prop); +int RNA_property_array_check(PropertyRNA *prop); int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dimension); int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[]); char RNA_property_array_item_char(PropertyRNA *prop, int index); diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index ec213d6a496..f8199074f27 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -281,7 +281,7 @@ typedef struct ParameterList { typedef struct ParameterIterator { struct ParameterList *parms; - PointerRNA funcptr; + /* PointerRNA funcptr; */ /*UNUSED*/ void *data; int size, offset; diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index ac3508b9b4a..127b27f2e18 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -290,7 +290,7 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop) } } -static int rna_ensure_property_array_check(PointerRNA *UNUSED(ptr), PropertyRNA *prop) +static int rna_ensure_property_array_check(PropertyRNA *prop) { if(prop->magic == RNA_MAGIC) { return (prop->getlength || prop->totarraylength) ? 1:0; @@ -767,9 +767,9 @@ int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop) return rna_ensure_property_array_length(ptr, prop); } -int RNA_property_array_check(PointerRNA *ptr, PropertyRNA *prop) +int RNA_property_array_check(PropertyRNA *prop) { - return rna_ensure_property_array_check(ptr, prop); + return rna_ensure_property_array_check(prop); } /* used by BPY to make an array from the python object */ @@ -1507,6 +1507,7 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) == 0); if((idprop=rna_idproperty_check(&prop, ptr))) return IDP_Int(idprop); @@ -1522,6 +1523,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) == 0); /* just incase other values are passed */ if(value) value= 1; @@ -1548,6 +1550,7 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1571,6 +1574,7 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_array(ptr, prop, tmp); @@ -1594,6 +1598,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1627,6 +1632,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_array(ptr, prop, tmp); @@ -1649,6 +1655,7 @@ int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) == 0); return bprop->defaultvalue; } @@ -1658,6 +1665,7 @@ void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(prop->arraydimension == 0) values[0]= bprop->defaultvalue; @@ -1673,6 +1681,7 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_default_array(ptr, prop, tmp); @@ -1696,6 +1705,7 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) == 0); if((idprop=rna_idproperty_check(&prop, ptr))) return IDP_Int(idprop); @@ -1711,6 +1721,7 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) == 0); /* useful to check on bad values but set function should clamp */ /* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */ @@ -1736,6 +1747,7 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1796,6 +1808,7 @@ int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_int_get_array(ptr, prop, tmp); @@ -1819,6 +1832,7 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1852,6 +1866,7 @@ void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, i int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_int_get_array(ptr, prop, tmp); @@ -1880,6 +1895,7 @@ void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *pr IntPropertyRNA *iprop= (IntPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if(prop->arraydimension == 0) values[0]= iprop->defaultvalue; @@ -1916,6 +1932,7 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) == 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(idprop->type == IDP_FLOAT) @@ -1935,6 +1952,7 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) == 0); /* useful to check on bad values but set function should clamp */ /* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */ @@ -1966,6 +1984,7 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val int i; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -2031,6 +2050,7 @@ float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_array(ptr, prop, tmp); @@ -2056,6 +2076,7 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa int i; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) { @@ -2099,6 +2120,7 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_array(ptr, prop, tmp); @@ -2121,6 +2143,7 @@ float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) == 0); return fprop->defaultvalue; } @@ -2130,6 +2153,7 @@ void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA * FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(prop->arraydimension == 0) values[0]= fprop->defaultvalue; @@ -2145,6 +2169,7 @@ float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_default_array(ptr, prop, tmp); @@ -4592,7 +4617,8 @@ int RNA_parameter_list_ret_count(ParameterList *parms) void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter) { - RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); + /* may be useful but unused now */ + /* RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); */ /*UNUSED*/ iter->parms= parms; iter->parm= parms->func->cont.properties.first; diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index ba655915fb6..5c5391b0bba 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2265,6 +2265,13 @@ static void rna_def_modifier_solidify(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Thickness", "Thickness of the shell"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop= RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg"); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_ui_range(prop, 0, 1, 0.1, 3); + RNA_def_property_ui_text(prop, "Vertex Group Factor", "Thickness factor to use for zero vertex group influence"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "offset_fac"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 3371f194e6e..ad323b0aba4 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2027,7 +2027,14 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Input Matrix", "Matrix access to location, rotation and scale (including deltas), before constraints and parenting are applied."); RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); - + + /*parent_inverse*/ + prop= RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX); + RNA_def_property_float_sdna(prop, NULL, "parentinv"); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); + RNA_def_property_ui_text(prop, "Matrix", "Inverse of object's parent matrix at time of parenting"); + RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); + /* collections */ prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Constraint"); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 307cf0e175a..93adf808f83 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1746,6 +1746,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE); RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item"); RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_USER_MODIFIED); diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index a0ee047e319..0b46d950950 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -213,4 +213,5 @@ ModifierTypeInfo modifierType_Armature = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 90954fef1c7..c7fa75478f0 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -826,4 +826,5 @@ ModifierTypeInfo modifierType_Array = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 323ed71dd74..277f404f64d 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -150,4 +150,5 @@ ModifierTypeInfo modifierType_Bevel = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 4b4d0124aae..761f8dd0add 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -197,4 +197,5 @@ ModifierTypeInfo modifierType_Boolean = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index e293be5886d..1c56d81a798 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -299,5 +299,6 @@ ModifierTypeInfo modifierType_Build = { /* dependsOnTime */ dependsOnTime, /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, - /* foreachIDLink */ NULL + /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 14b23ba4972..4061128b5ad 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -632,4 +632,5 @@ ModifierTypeInfo modifierType_Cast = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 1d2a6b2f788..f5493162322 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -229,4 +229,5 @@ ModifierTypeInfo modifierType_Cloth = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 83ba8a12163..f4a9ea62ead 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -267,4 +267,5 @@ ModifierTypeInfo modifierType_Collision = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index ecd10250c00..d928c239eac 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -162,4 +162,5 @@ ModifierTypeInfo modifierType_Curve = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index ba9dbfc31ad..e3c39752bd1 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -218,4 +218,5 @@ ModifierTypeInfo modifierType_Decimate = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index e0482e6b3fc..fb7aeacecc8 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -134,6 +134,12 @@ static void foreachIDLink(ModifierData *md, Object *ob, foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } +static void foreachTexLink(ModifierData *md, Object *ob, + TexWalkFunc walk, void *userData) +{ + walk(userData, ob, md, "texture"); +} + static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { DisplaceModifierData *dmd = (DisplaceModifierData*) md; @@ -283,4 +289,5 @@ ModifierTypeInfo modifierType_Displace = { /* dependsOnNormals */ dependsOnNormals, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ foreachTexLink, }; diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 8d0aea41b5c..db491742265 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -1311,4 +1311,5 @@ ModifierTypeInfo modifierType_EdgeSplit = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 5da2464ef89..3d01661bc79 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -1037,4 +1037,5 @@ ModifierTypeInfo modifierType_Explode = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 354dc33ffe0..cce288b4ad5 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -162,4 +162,5 @@ ModifierTypeInfo modifierType_Fluidsim = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index ea8d602dd7a..785abc7d4d1 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -289,4 +289,5 @@ ModifierTypeInfo modifierType_Hook = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 694f8fb3e52..31c17fb7376 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -156,4 +156,5 @@ ModifierTypeInfo modifierType_Lattice = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 94442d96367..b7cdac9e246 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -407,4 +407,5 @@ ModifierTypeInfo modifierType_Mask = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 3903f2602e4..8a0e64e7ee4 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -463,4 +463,5 @@ ModifierTypeInfo modifierType_MeshDeform = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index b1c765e5c9b..7cde87b20d9 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -363,4 +363,5 @@ ModifierTypeInfo modifierType_Mirror = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 134574ae6c4..48b1112cad2 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -131,4 +131,5 @@ ModifierTypeInfo modifierType_Multires = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c index 48c5b9a4c08..8fed2150a75 100644 --- a/source/blender/modifiers/intern/MOD_none.c +++ b/source/blender/modifiers/intern/MOD_none.c @@ -77,4 +77,5 @@ ModifierTypeInfo modifierType_None = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 46d53e0db15..b0b43e018f7 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -350,4 +350,5 @@ ModifierTypeInfo modifierType_ParticleInstance = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 533bfd203b5..5635ba33d80 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -242,4 +242,5 @@ ModifierTypeInfo modifierType_ParticleSystem = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 17e350482f0..c5fdf465a0a 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -903,4 +903,5 @@ ModifierTypeInfo modifierType_Screw = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index 94d23de6573..6e55466c1e4 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -148,5 +148,6 @@ ModifierTypeInfo modifierType_ShapeKey = { /* dependsOnTime */ NULL, /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, - /* foreachIDLink */ NULL + /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index e1fc4bc969f..ba25df19b3e 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -186,4 +186,5 @@ ModifierTypeInfo modifierType_Shrinkwrap = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 5efd6cd28ec..b2e3c9532b6 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -385,4 +385,5 @@ ModifierTypeInfo modifierType_SimpleDeform = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index b6203bb3c1d..2e156d82ec6 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -189,4 +189,5 @@ ModifierTypeInfo modifierType_Smoke = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ NULL }; diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 28a31b84ea5..16898a80b53 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -270,4 +270,5 @@ ModifierTypeInfo modifierType_Smooth = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c index 25996286735..c475328676b 100644 --- a/source/blender/modifiers/intern/MOD_softbody.c +++ b/source/blender/modifiers/intern/MOD_softbody.c @@ -87,4 +87,5 @@ ModifierTypeInfo modifierType_Softbody = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 390a780e9e6..afe6da8b38a 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -232,8 +232,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, float (*vert_nors)[3]= NULL; - float const ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); - float const ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); + const float ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); + const float ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); + const float offset_fac_vg= smd->offset_fac_vg; + const float offset_fac_vg_inv= 1.0f - smd->offset_fac_vg; /* weights */ MDeformVert *dvert, *dv= NULL; @@ -391,8 +393,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, dv= dvert; for(i=0; i<numVerts; i++, mv++) { if(dv) { - if(defgrp_invert) scalar_short_vgroup = scalar_short * (1.0f - defvert_find_weight(dv, defgrp_index)); - else scalar_short_vgroup = scalar_short * defvert_find_weight(dv, defgrp_index); + if(defgrp_invert) scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index); + else scalar_short_vgroup = defvert_find_weight(dv, defgrp_index); + scalar_short_vgroup= (offset_fac_vg + (scalar_short_vgroup * offset_fac_vg_inv)) * scalar_short; dv++; } VECADDFAC(mv->co, mv->co, mv->no, scalar_short_vgroup); @@ -405,8 +408,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, dv= dvert; for(i=0; i<numVerts; i++, mv++) { if(dv) { - if(defgrp_invert) scalar_short_vgroup = scalar_short * (1.0f - defvert_find_weight(dv, defgrp_index)); - else scalar_short_vgroup = scalar_short * defvert_find_weight(dv, defgrp_index); + if(defgrp_invert) scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index); + else scalar_short_vgroup = defvert_find_weight(dv, defgrp_index); + scalar_short_vgroup= (offset_fac_vg + (scalar_short_vgroup * offset_fac_vg_inv)) * scalar_short; dv++; } VECADDFAC(mv->co, mv->co, mv->no, scalar_short_vgroup); @@ -466,15 +470,21 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* vertex group support */ if(dvert) { + float scalar; + dv= dvert; if(defgrp_invert) { for(i=0; i<numVerts; i++, dv++) { - vert_angles[i] *= (1.0f - defvert_find_weight(dv, defgrp_index)); + scalar= 1.0f - defvert_find_weight(dv, defgrp_index); + scalar= offset_fac_vg + (scalar * offset_fac_vg_inv); + vert_angles[i] *= scalar; } } else { for(i=0; i<numVerts; i++, dv++) { - vert_angles[i] *= defvert_find_weight(dv, defgrp_index); + scalar= defvert_find_weight(dv, defgrp_index); + scalar= offset_fac_vg + (scalar * offset_fac_vg_inv); + vert_angles[i] *= scalar; } } } @@ -689,5 +699,6 @@ ModifierTypeInfo modifierType_Solidify = { /* dependsOnTime */ NULL, /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, - /* foreachIDLink */ NULL + /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index f780721ca07..6c825b213b8 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -152,4 +152,6 @@ ModifierTypeInfo modifierType_Subsurf = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; + diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index 382358b179e..e30b7f2392d 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -192,4 +192,5 @@ ModifierTypeInfo modifierType_Surface = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 922ae8c1e92..912c14adfdd 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -434,4 +434,5 @@ ModifierTypeInfo modifierType_UVProject = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 2c77b486263..c1c3604d598 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -140,6 +140,11 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u walk(userData, ob, (ID **)&wmd->map_object); } +static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void *userData) +{ + walk(userData, ob, md, "texture"); +} + static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UNUSED(scene), Object *UNUSED(ob), DagNode *obNode) { @@ -364,4 +369,5 @@ ModifierTypeInfo modifierType_Warp = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ foreachTexLink, }; diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index ca8161fe364..4b5769ff603 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -126,6 +126,12 @@ static void foreachIDLink(ModifierData *md, Object *ob, foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } +static void foreachTexLink(ModifierData *md, Object *ob, + TexWalkFunc walk, void *userData) +{ + walk(userData, ob, md, "texture"); +} + static void updateDepgraph(ModifierData *md, DagForest *forest, Scene *UNUSED(scene), Object *UNUSED(ob), @@ -466,4 +472,5 @@ ModifierTypeInfo modifierType_Wave = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ foreachTexLink, }; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 4447a0476f4..ba8145c2773 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -856,7 +856,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) if(type==PROP_COLLECTION) { len= pyrna_prop_collection_length(self); } - else if (RNA_property_array_check(&self->ptr, self->prop)) { + else if (RNA_property_array_check(self->prop)) { len= pyrna_prop_array_length((BPy_PropertyArrayRNA *)self); } @@ -1224,7 +1224,7 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) PyObject *ret; int type= RNA_property_type(prop); - if (RNA_property_array_check(ptr, prop)) { + if (RNA_property_array_check(prop)) { return pyrna_py_from_array(ptr, prop); } @@ -1369,7 +1369,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb int type= RNA_property_type(prop); - if (RNA_property_array_check(ptr, prop)) { + if (RNA_property_array_check(prop)) { /* done getting the length */ if(pyrna_py_to_array(ptr, prop, data, value, error_prefix) == -1) { return -1; @@ -4088,7 +4088,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat int type= RNA_property_type(prop); int flag= RNA_property_flag(prop); - if(RNA_property_array_check(ptr, prop)) { + if(RNA_property_array_check(prop)) { int a, len; if (flag & PROP_DYNAMIC) { @@ -5519,7 +5519,7 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop) { BPy_PropertyRNA *pyrna; - if (RNA_property_array_check(ptr, prop) == 0) { + if (RNA_property_array_check(prop) == 0) { PyTypeObject *type; if (RNA_property_type(prop) != PROP_COLLECTION) { diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index 30d83e196ba..8bde1db96ca 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -107,7 +107,7 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi return -1; } - if(RNA_property_array_check(&r_ptr, prop) == 0) { + if(RNA_property_array_check(prop) == 0) { if((*index) == -1) { *index= 0; } diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index a954c07c98d..56c1334ecac 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -37,8 +37,6 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -extern void PyC_LineSpit(void); - #define MAX_DIMENSIONS 4 /* Swizzle axes get packed into a single value that is used as a closure. Each @@ -1161,28 +1159,18 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) } else if (vec1) { if (MatrixObject_Check(v2)) { - extern void PyC_LineSpit(void); - - /* VEC * MATRIX */ - /* this is deprecated!, use the reverse instead */ - float tvec[MAX_DIMENSIONS]; - /* ------ to be removed ------*/ -#ifndef MATH_STANDALONE -#ifdef WITH_ASSERT_ABORT +#if 1 PyErr_SetString(PyExc_ValueError, "(Vector * Matrix) is now removed, reverse the " "order (promoted to an Error for Debug builds)"); return NULL; #else - printf("Warning: (Vector * Matrix) is now deprecated, " - "reverse the multiplication order in the script.\n"); - PyC_LineSpit(); -#endif -#endif /* ifndef MATH_STANDALONE */ -/* ------ to be removed ------*/ + /* VEC * MATRIX */ + /* this is deprecated!, use the reverse instead */ + float tvec[MAX_DIMENSIONS]; if(BaseMath_ReadCallback((MatrixObject *)v2) == -1) return NULL; @@ -1191,9 +1179,18 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) } return newVectorObject(tvec, vec1->size, Py_NEW, Py_TYPE(vec1)); +#endif +/* ------ to be removed ------*/ } else if (QuaternionObject_Check(v2)) { /* VEC * QUAT */ +/* ------ to be removed ------*/ +#if 1 + PyErr_SetString(PyExc_ValueError, + "(Vector * Quat) is now removed, reverse the " + "order (promoted to an Error for Debug builds)"); + return NULL; +#else QuaternionObject *quat2 = (QuaternionObject*)v2; float tvec[3]; @@ -1207,26 +1204,11 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) return NULL; } - -/* ------ to be removed ------*/ -#ifndef MATH_STANDALONE -#ifdef WITH_ASSERT_ABORT - PyErr_SetString(PyExc_ValueError, - "(Vector * Quat) is now removed, reverse the " - "order (promoted to an Error for Debug builds)"); - return NULL; -#else - printf("Warning: (Vector * Quat) is now deprecated, " - "reverse the multiplication order in the script.\n"); - PyC_LineSpit(); -#endif -#endif /* ifndef MATH_STANDALONE */ -/* ------ to be removed ------*/ - - copy_v3_v3(tvec, vec1->vec); mul_qt_v3(quat2->quat, tvec); return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(vec1)); +#endif +/* ------ to be removed ------*/ } else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC * FLOAT */ return vector_mul_float(vec1, scalar); @@ -1260,6 +1242,14 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) /* only support vec*=float and vec*=mat vec*=vec result is a float so that wont work */ if (MatrixObject_Check(v2)) { +/* ------ to be removed ------*/ +#if 1 + PyErr_SetString(PyExc_ValueError, + "(Vector *= Matrix) is now removed, reverse the " + "order (promoted to an Error for Debug builds) " + "and uses the non in-place multiplication."); + return NULL; +#else float rvec[MAX_DIMENSIONS]; if(BaseMath_ReadCallback((MatrixObject *)v2) == -1) return NULL; @@ -1267,28 +1257,21 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) if(column_vector_multiplication(rvec, vec, (MatrixObject*)v2) == -1) return NULL; - -/* ------ to be removed ------*/ -#ifndef MATH_STANDALONE -#ifdef WITH_ASSERT_ABORT - PyErr_SetString(PyExc_ValueError, - "(Vector *= Matrix) is now removed, reverse the " - "order (promoted to an Error for Debug builds) " - "and uses the non in-place multiplication."); - return NULL; -#else - printf("Warning: (Vector *= Matrix) is now deprecated, " - "reverse the (non in-place) multiplication order in the script.\n"); - PyC_LineSpit(); + memcpy(vec->vec, rvec, sizeof(float) * vec->size); #endif -#endif /* ifndef MATH_STANDALONE */ /* ------ to be removed ------*/ - - - memcpy(vec->vec, rvec, sizeof(float) * vec->size); } else if (QuaternionObject_Check(v2)) { /* VEC *= QUAT */ + +/* ------ to be removed ------*/ +#if 1 + PyErr_SetString(PyExc_ValueError, + "(Vector *= Quat) is now removed, reverse the " + "order (promoted to an Error for Debug builds) " + "and uses the non in-place multiplication."); + return NULL; +#else QuaternionObject *quat2 = (QuaternionObject*)v2; if(vec->size != 3) { @@ -1302,25 +1285,9 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) return NULL; } - -/* ------ to be removed ------*/ -#ifndef MATH_STANDALONE -#ifdef WITH_ASSERT_ABORT - PyErr_SetString(PyExc_ValueError, - "(Vector *= Quat) is now removed, reverse the " - "order (promoted to an Error for Debug builds) " - "and uses the non in-place multiplication."); - return NULL; -#else - printf("Warning: (Vector *= Quat) is now deprecated, " - "reverse the (non in-place) multiplication order in the script.\n"); - PyC_LineSpit(); + mul_qt_v3(quat2->quat, vec->vec); #endif -#endif /* ifndef MATH_STANDALONE */ /* ------ to be removed ------*/ - - - mul_qt_v3(quat2->quat, vec->vec); } else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC *= FLOAT */ mul_vn_fl(vec->vec, vec->size, scalar); @@ -1728,6 +1695,21 @@ static int Vector_setLength(VectorObject *self, PyObject *value) return 0; } +/* vector.length_squared */ +static PyObject *Vector_getLengthSquared(VectorObject *self, void *UNUSED(closure)) +{ + double dot = 0.0f; + int i; + + if(BaseMath_ReadCallback(self) == -1) + return NULL; + + for(i = 0; i < self->size; i++){ + dot += (double)(self->vec[i] * self->vec[i]); + } + return PyFloat_FromDouble(dot); +} + /* Get a new Vector according to the provided swizzle. This function has little error checking, as we are in control of the inputs: the closure is set by us in Vector_createSwizzleGetSeter. */ @@ -1851,6 +1833,7 @@ static PyGetSetDef Vector_getseters[] = { {(char *)"z", (getter)Vector_getAxis, (setter)Vector_setAxis, (char *)"Vector Z axis (3D Vectors only).\n\n:type: float", (void *)2}, {(char *)"w", (getter)Vector_getAxis, (setter)Vector_setAxis, (char *)"Vector W axis (4D Vectors only).\n\n:type: float", (void *)3}, {(char *)"length", (getter)Vector_getLength, (setter)Vector_setLength, (char *)"Vector Length.\n\n:type: float", NULL}, + {(char *)"length_squared", (getter)Vector_getLengthSquared, (setter)NULL, (char *)"Vector length squared (v.dot(v)).\n\n:type: float", NULL}, {(char *)"magnitude", (getter)Vector_getLength, (setter)Vector_setLength, (char *)"Vector Length.\n\n:type: float", NULL}, {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL}, {(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL}, diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 34d3adcf15b..d62f411a7c5 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -1679,7 +1679,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int /* not used, test function for ambient occlusion (yaf: pathlight) */ /* main problem; has to be called within shading loop, giving unwanted recursion */ -static int ray_trace_shadow_rad(ShadeInput *ship, ShadeResult *shr) +static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult *shr) { static int counter=0, only_one= 0; extern float hashvectf[]; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index d8c6933a93d..e1b8cefca4b 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -222,6 +222,7 @@ wmOperator *WM_operator_last_redo(const struct bContext *C); #define WM_FILESEL_DIRECTORY (1 << 1) #define WM_FILESEL_FILENAME (1 << 2) #define WM_FILESEL_FILEPATH (1 << 3) +#define WM_FILESEL_FILES (1 << 4) /* operator as a python command (resultuing string must be free'd) */ diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 75638382399..a857577fcc8 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -455,7 +455,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) /* called on startup, (context entirely filled with NULLs) */ /* or called for 'New File' */ /* op can be NULL */ -int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) +int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory) { ListBase wmbase; char tstr[FILE_MAXDIR+FILE_MAXFILE]; @@ -471,7 +471,6 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) } else { tstr[0] = '\0'; from_memory = 1; - BKE_report(reports, RPT_INFO, "Config directory with "STRINGIFY(BLENDER_STARTUP_FILE)" file not found."); } } diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 2fb0a1b2ab9..6887aa4c717 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -106,6 +106,9 @@ static int wm_keymap_item_equals_result(wmKeyMapItem *a, wmKeyMapItem *b) (a->ptr && b->ptr && IDP_EqualsProperties(a->ptr->data, b->ptr->data)))) return 0; + if((a->flag & KMI_INACTIVE) != (b->flag & KMI_INACTIVE)) + return 0; + return (a->propvalue == b->propvalue); } @@ -1009,7 +1012,8 @@ void WM_keyconfig_update(wmWindowManager *wm) addonmap= WM_keymap_list_find(&wm->addonconf->keymaps, km->idname, km->spaceid, km->regionid); /* diff */ - wm_keymap_diff_update(&U.user_keymaps, defaultmap, addonmap, km); + if(defaultmap) + wm_keymap_diff_update(&U.user_keymaps, defaultmap, addonmap, km); } } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 66467b310ee..1beb5b3dda3 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -811,6 +811,9 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, if(flag & WM_FILESEL_FILENAME) RNA_def_string_file_name(ot->srna, "filename", "", FILE_MAX, "File Name", "Name of the file"); + if(flag & WM_FILESEL_FILES) + RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", ""); + if (action == FILE_SAVE) { prop= RNA_def_boolean(ot->srna, "check_existing", 1, "Check Existing", "Check and warn on overwriting existing files"); RNA_def_property_flag(prop, PROP_HIDDEN); @@ -1748,14 +1751,12 @@ static void WM_OT_link_append(wmOperatorType *ot) ot->flag |= OPTYPE_UNDO; - WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_DIRECTORY|WM_FILESEL_FILENAME| WM_FILESEL_RELPATH); + WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_DIRECTORY|WM_FILESEL_FILENAME| WM_FILESEL_RELPATH|WM_FILESEL_FILES); RNA_def_boolean(ot->srna, "link", 1, "Link", "Link the objects or datablocks rather than appending"); RNA_def_boolean(ot->srna, "autoselect", 1, "Select", "Select the linked objects"); RNA_def_boolean(ot->srna, "active_layer", 1, "Active Layer", "Put the linked objects on the active layer"); RNA_def_boolean(ot->srna, "instance_groups", 1, "Instance Groups", "Create instances for each group as a DupliGroup"); - - RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", ""); } /* *************** recover last session **************** */ @@ -2009,8 +2010,6 @@ static void WM_OT_save_mainfile(wmOperatorType *ot) static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - int selected = 0; - if(!RNA_property_is_set(op->ptr, "filepath")) { char filepath[FILE_MAX]; BLI_strncpy(filepath, G.main->name, sizeof(filepath)); diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c index a87001fb1b4..8ea1f2fdd0a 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.c +++ b/source/blender/windowmanager/intern/wm_subwindow.c @@ -378,7 +378,8 @@ unsigned int index_to_framebuffer(int index) void WM_set_framebuffer_index_color(int index) { - cpack(index_to_framebuffer(index)); + const int col= index_to_framebuffer(index); + cpack(col); } int WM_framebuffer_to_index(unsigned int col) |