Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c6
-rw-r--r--source/blender/blenkernel/intern/anim.c4
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c31
-rw-r--r--source/blender/blenkernel/intern/image.c20
-rw-r--r--source/blender/blenkernel/intern/library.c2
-rw-r--r--source/blender/blenkernel/intern/material.c4
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c52
-rw-r--r--source/blender/blenkernel/intern/multires.c1
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c2
-rw-r--r--source/blender/blenkernel/intern/pointcache.c10
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c9
-rw-r--r--source/blender/blenkernel/intern/sequencer.c316
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c6
14 files changed, 280 insertions, 185 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index c84bcaabbd3..ff7f2586767 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -637,7 +637,8 @@ static void emDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *use
}
/* note, material function is ignored for now. */
-static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int UNUSED(useColors), int (*setMaterial)(int, void *attribs))
+static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int UNUSED(useColors), int (*setMaterial)(int, void *attribs),
+ int (*compareDrawOptions)(void *userData, int cur_index, int next_index))
{
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditFace *efa;
@@ -645,6 +646,9 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
(void)setMaterial; /* unused */
+ /* currently unused -- each original face is handled separately */
+ (void)compareDrawOptions;
+
if (emdm->vertexCos) {
EditVert *eve;
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 296eba2fe0f..9ca11db7fce 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -1348,6 +1348,10 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
continue;
if(part->ren_as==PART_DRAW_GR) {
+ /* prevent divide by zero below [#28336] */
+ if(totgroup == 0)
+ continue;
+
/* for groups, pick the object based on settings */
if(part->draw&PART_DRAW_RAND_GR)
b= BLI_rand() % totgroup;
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 12fb11c68b3..5eb97630e83 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -843,7 +843,8 @@ static void cdDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tfa
cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL);
}
-static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs))
+static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs),
+ int (*compareDrawOptions)(void *userData, int cur_index, int next_index))
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
MVert *mv = cddm->mvert;
@@ -958,6 +959,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
MFace *mface= mf + actualFace;
int drawSmooth= (mface->flag & ME_SMOOTH);
int draw = 1;
+ int flush = 0;
if(i != tottri-1)
next_actualFace= dm->drawObject->triangle_to_mface[i+1];
@@ -972,11 +974,28 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
/* Goal is to draw as long of a contiguous triangle
array as possible, so draw when we hit either an
invisible triangle or at the end of the array */
- if(!draw || i == tottri - 1 || mf[actualFace].mat_nr != mf[next_actualFace].mat_nr) {
- if(prevstart != i)
- /* Add one to the length (via `draw')
- if we're drawing at the end of the array */
- glDrawArrays(GL_TRIANGLES,prevstart*3, (i-prevstart+draw)*3);
+
+ /* flush buffer if current triangle isn't drawable or it's last triangle... */
+ flush= !draw || i == tottri - 1;
+
+ /* ... or when material setting is dissferent */
+ flush|= mf[actualFace].mat_nr != mf[next_actualFace].mat_nr;
+
+ if(!flush && compareDrawOptions) {
+ int next_orig= (index==NULL) ? next_actualFace : index[next_actualFace];
+
+ /* also compare draw options and flush buffer if they're different
+ need for face selection highlight in edit mode */
+ flush|= compareDrawOptions(userData, orig, next_orig) == 0;
+ }
+
+ if(flush) {
+ int first= prevstart*3;
+ int count= (i-prevstart+(draw ? 1 : 0))*3; /* Add one to the length if we're drawing at the end of the array */
+
+ if(count)
+ glDrawArrays(GL_TRIANGLES, first, count);
+
prevstart = i + 1;
}
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index ab67d7e3f25..4ce5de78895 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1371,15 +1371,15 @@ void BKE_makepicstring(char *string, const char *base, int frame, int imtype, co
}
/* used by sequencer too */
-struct anim *openanim(char *name, int flags)
+struct anim *openanim(char *name, int flags, int streamindex)
{
struct anim *anim;
struct ImBuf *ibuf;
- anim = IMB_open_anim(name, flags);
+ anim = IMB_open_anim(name, flags, streamindex);
if (anim == NULL) return NULL;
- ibuf = IMB_anim_absolute(anim, 0);
+ ibuf = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE);
if (ibuf == NULL) {
if(BLI_exists(name))
printf("not an anim: %s\n", name);
@@ -1773,20 +1773,26 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
else
BLI_path_abs(str, G.main->name);
- ima->anim = openanim(str, IB_rect);
+ /* FIXME: make several stream accessible in image editor, too*/
+ ima->anim = openanim(str, IB_rect, 0);
/* let's initialize this user */
if(ima->anim && iuser && iuser->frames==0)
- iuser->frames= IMB_anim_get_duration(ima->anim);
+ iuser->frames= IMB_anim_get_duration(ima->anim,
+ IMB_TC_RECORD_RUN);
}
if(ima->anim) {
- int dur = IMB_anim_get_duration(ima->anim);
+ int dur = IMB_anim_get_duration(ima->anim,
+ IMB_TC_RECORD_RUN);
int fra= frame-1;
if(fra<0) fra = 0;
if(fra>(dur-1)) fra= dur-1;
- ibuf = IMB_anim_absolute(ima->anim, fra);
+ ibuf = IMB_makeSingleUser(
+ IMB_anim_absolute(ima->anim, fra,
+ IMB_TC_RECORD_RUN,
+ IMB_PROXY_NONE));
if(ibuf) {
image_initialize_after_load(ima, ibuf);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index c362f3eb2fe..677a2922666 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -715,7 +715,7 @@ void *copy_libblock(void *rt)
assert(idn != NULL);
idn_len= MEM_allocN_len(idn);
- if(idn_len - sizeof(ID) > 0) {
+ if((int)idn_len - (int)sizeof(ID) > 0) { /* signed to allow neg result */
cp= (char *)id;
cpn= (char *)idn;
memcpy(cpn+sizeof(ID), cp+sizeof(ID), idn_len - sizeof(ID));
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 9c455e84109..29615986191 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -515,7 +515,7 @@ short *give_totcolp_id(ID *id)
return NULL;
}
-void data_delete_material_index_id(ID *id, int index)
+static void data_delete_material_index_id(ID *id, int index)
{
switch(GS(id->name)) {
case ID_ME:
@@ -1365,7 +1365,7 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
}
/* copy/paste buffer, if we had a propper py api that would be better */
-Material matcopybuf;
+static Material matcopybuf;
static short matcopied= 0;
void clear_matcopybuf(void)
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 34618a19ae9..9c916d517c5 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -80,7 +80,7 @@ static void edge_store_from_mface_quad(EdgeUUID es[4], MFace *mf)
edge_store_assign(es[3].verts, mf->v4, mf->v1);
}
-static void edge_store_from_mface_tri(EdgeUUID es[3], MFace *mf)
+static void edge_store_from_mface_tri(EdgeUUID es[4], MFace *mf)
{
edge_store_assign(es[0].verts, mf->v1, mf->v2);
edge_store_assign(es[1].verts, mf->v2, mf->v3);
@@ -143,30 +143,30 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve
BLI_assert(!(do_fixes && me == NULL));
- PRINT("ED_mesh_validate: verts(%d), edges(%d), faces(%d)\n", totvert, totedge, totface);
+ PRINT("ED_mesh_validate: verts(%u), edges(%u), faces(%u)\n", totvert, totedge, totface);
if(totedge == 0 && totface != 0) {
- PRINT(" locical error, %d faces and 0 edges\n", totface);
+ PRINT(" locical error, %u faces and 0 edges\n", totface);
do_edge_recalc= TRUE;
}
for(i=0, med= medges; i<totedge; i++, med++) {
int remove= FALSE;
if(med->v1 == med->v2) {
- PRINT(" edge %d: has matching verts, both %d\n", i, med->v1);
+ PRINT(" edge %u: has matching verts, both %u\n", i, med->v1);
remove= do_fixes;
}
if(med->v1 >= totvert) {
- PRINT(" edge %d: v1 index out of range, %d\n", i, med->v1);
+ PRINT(" edge %u: v1 index out of range, %u\n", i, med->v1);
remove= do_fixes;
}
if(med->v2 >= totvert) {
- PRINT(" edge %d: v2 index out of range, %d\n", i, med->v2);
+ PRINT(" edge %u: v2 index out of range, %u\n", i, med->v2);
remove= do_fixes;
}
if(BLI_edgehash_haskey(edge_hash, med->v1, med->v2)) {
- PRINT(" edge %d: is a duplicate of, %d\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2)));
+ PRINT(" edge %u: is a duplicate of, %u\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2)));
remove= do_fixes;
}
@@ -187,41 +187,41 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve
do {
fv[fidx]= *(&(mf->v1) + fidx);
if(fv[fidx] >= totvert) {
- PRINT(" face %d: 'v%d' index out of range, %d\n", i, fidx + 1, fv[fidx]);
+ PRINT(" face %u: 'v%d' index out of range, %u\n", i, fidx + 1, fv[fidx]);
remove= do_fixes;
}
} while (fidx--);
if(remove == FALSE) {
if(mf->v4) {
- if(mf->v1 == mf->v2) { PRINT(" face %d: verts invalid, v1/v2 both %d\n", i, mf->v1); remove= do_fixes; }
- if(mf->v1 == mf->v3) { PRINT(" face %d: verts invalid, v1/v3 both %d\n", i, mf->v1); remove= do_fixes; }
- if(mf->v1 == mf->v4) { PRINT(" face %d: verts invalid, v1/v4 both %d\n", i, mf->v1); remove= do_fixes; }
+ if(mf->v1 == mf->v2) { PRINT(" face %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; }
+ if(mf->v1 == mf->v3) { PRINT(" face %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes; }
+ if(mf->v1 == mf->v4) { PRINT(" face %u: verts invalid, v1/v4 both %u\n", i, mf->v1); remove= do_fixes; }
- if(mf->v2 == mf->v3) { PRINT(" face %d: verts invalid, v2/v3 both %d\n", i, mf->v2); remove= do_fixes; }
- if(mf->v2 == mf->v4) { PRINT(" face %d: verts invalid, v2/v4 both %d\n", i, mf->v2); remove= do_fixes; }
+ if(mf->v2 == mf->v3) { PRINT(" face %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes; }
+ if(mf->v2 == mf->v4) { PRINT(" face %u: verts invalid, v2/v4 both %u\n", i, mf->v2); remove= do_fixes; }
- if(mf->v3 == mf->v4) { PRINT(" face %d: verts invalid, v3/v4 both %d\n", i, mf->v3); remove= do_fixes; }
+ if(mf->v3 == mf->v4) { PRINT(" face %u: verts invalid, v3/v4 both %u\n", i, mf->v3); remove= do_fixes; }
}
else {
- if(mf->v1 == mf->v2) { PRINT(" faceT %d: verts invalid, v1/v2 both %d\n", i, mf->v1); remove= do_fixes; }
- if(mf->v1 == mf->v3) { PRINT(" faceT %d: verts invalid, v1/v3 both %d\n", i, mf->v1); remove= do_fixes; }
+ if(mf->v1 == mf->v2) { PRINT(" faceT %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; }
+ if(mf->v1 == mf->v3) { PRINT(" faceT %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes; }
- if(mf->v2 == mf->v3) { PRINT(" faceT %d: verts invalid, v2/v3 both %d\n", i, mf->v2); remove= do_fixes; }
+ if(mf->v2 == mf->v3) { PRINT(" faceT %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes; }
}
if(remove == FALSE) {
if(totedge) {
if(mf->v4) {
- if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %d: edge v1/v2 (%d,%d) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
- if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %d: edge v2/v3 (%d,%d) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
- if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v4)) { PRINT(" face %d: edge v3/v4 (%d,%d) is missing egde data\n", i, mf->v3, mf->v4); do_edge_recalc= TRUE; }
- if(!BLI_edgehash_haskey(edge_hash, mf->v4, mf->v1)) { PRINT(" face %d: edge v4/v1 (%d,%d) is missing egde data\n", i, mf->v4, mf->v1); do_edge_recalc= TRUE; }
+ if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %u: edge v1/v2 (%u,%u) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
+ if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %u: edge v2/v3 (%u,%u) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
+ if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v4)) { PRINT(" face %u: edge v3/v4 (%u,%u) is missing egde data\n", i, mf->v3, mf->v4); do_edge_recalc= TRUE; }
+ if(!BLI_edgehash_haskey(edge_hash, mf->v4, mf->v1)) { PRINT(" face %u: edge v4/v1 (%u,%u) is missing egde data\n", i, mf->v4, mf->v1); do_edge_recalc= TRUE; }
}
else {
- if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %d: edge v1/v2 (%d,%d) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
- if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %d: edge v2/v3 (%d,%d) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
- if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v1)) { PRINT(" face %d: edge v3/v1 (%d,%d) is missing egde data\n", i, mf->v3, mf->v1); do_edge_recalc= TRUE; }
+ if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %u: edge v1/v2 (%u,%u) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
+ if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %u: edge v2/v3 (%u,%u) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
+ if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v1)) { PRINT(" face %u: edge v3/v1 (%u,%u) is missing egde data\n", i, mf->v3, mf->v1); do_edge_recalc= TRUE; }
}
}
@@ -261,10 +261,10 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve
if(do_verbose) {
mf_prev= mfaces + sf_prev->index;
if(mf->v4) {
- PRINT(" face %d & %d: are duplicates (%d,%d,%d,%d) (%d,%d,%d,%d)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4, mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4);
+ PRINT(" face %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4, mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4);
}
else {
- PRINT(" face %d & %d: are duplicates (%d,%d,%d) (%d,%d,%d)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf_prev->v1, mf_prev->v2, mf_prev->v3);
+ PRINT(" face %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf_prev->v1, mf_prev->v2, mf_prev->v3);
}
}
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 88a670ecb22..e621e800520 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -1537,6 +1537,7 @@ void multires_load_old(Object *ob, Mesh *me)
me->mface[i].v2 = lvl->faces[i].v[1];
me->mface[i].v3 = lvl->faces[i].v[2];
me->mface[i].v4 = lvl->faces[i].v[3];
+ me->mface[i].mat_nr = lvl->faces[i].mat_nr;
}
/* Add a multires modifier to the object */
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index a615bc42f66..0dc83084c90 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -3138,7 +3138,7 @@ int object_is_modified(Scene *scene, Object *ob)
int flag= 0;
if(ob_get_key(ob)) {
- flag |= eModifierMode_Render | eModifierMode_Render;
+ flag |= eModifierMode_Render;
}
else {
ModifierData *md;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 9aa1c6e29eb..86c646fa257 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3161,7 +3161,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
}
else {
ca->vel[0] = ca->vel[1] = 0.0f;
- ca->vel[1] = 1.0f;
+ ca->vel[2] = 1.0f;
}
/* selection coloring in edit mode */
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index b8f4b2d302f..0f0afe30392 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -967,12 +967,12 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
if(pid->cache->flag & PTCACHE_EXTERNAL) {
if(pid->cache->index >= 0)
- snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
+ snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
else
snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */
}
else {
- snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
+ snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
}
len += 16;
}
@@ -2002,7 +2002,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
if (dir==NULL)
return;
- snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index);
+ snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
@@ -2204,7 +2204,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
if (dir==NULL)
return;
- snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index);
+ snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
while ((de = readdir(dir)) != NULL) {
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
@@ -2904,7 +2904,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to)
return;
}
- snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index);
+ snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
/* put new name into cache */
strcpy(pid->cache->name, to);
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 34748c64efb..43747fde729 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -2029,16 +2029,11 @@ static void init_transform_effect(Sequence *seq)
transform->ScalexIni = 1.0f;
transform->ScaleyIni = 1.0f;
- transform->ScalexFin = 1.0f;
- transform->ScalexFin = 1.0f;
transform->xIni=0.0f;
- transform->xFin=0.0f;
transform->yIni=0.0f;
- transform->yFin=0.0f;
transform->rotIni=0.0f;
- transform->rotFin=0.0f;
transform->interpolation=1;
transform->percent=1;
@@ -2878,7 +2873,7 @@ static struct ImBuf * do_adjustment_impl(SeqRenderData context, Sequence * seq,
{
Editing * ed;
ListBase * seqbasep;
- struct ImBuf * i = 0;
+ struct ImBuf * i= NULL;
ed = context.scene->ed;
@@ -2913,7 +2908,7 @@ static struct ImBuf * do_adjustment(
struct ImBuf *UNUSED(ibuf1), struct ImBuf *UNUSED(ibuf2),
struct ImBuf *UNUSED(ibuf3))
{
- struct ImBuf * i = 0;
+ struct ImBuf * i = NULL;
struct ImBuf * out;
Editing * ed;
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 023a10b3103..40e02d65323 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -218,6 +218,18 @@ void seq_free_sequence(Scene *scene, Sequence *seq)
MEM_freeN(seq);
}
+void seq_free_sequence_recurse(Scene *scene, Sequence *seq)
+{
+ Sequence *iseq;
+
+ for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
+ seq_free_sequence_recurse(scene, iseq);
+ }
+
+ seq_free_sequence(scene, seq);
+}
+
+
Editing *seq_give_editing(Scene *scene, int alloc)
{
if (scene->ed == NULL && alloc) {
@@ -683,13 +695,16 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
}
case SEQ_MOVIE:
if(seq->anim) IMB_free_anim(seq->anim);
- seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0));
+ seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex);
if (!seq->anim) {
return;
}
- seq->len = IMB_anim_get_duration(seq->anim);
+ seq->len = IMB_anim_get_duration(seq->anim,
+ seq->strip->proxy ?
+ seq->strip->proxy->tc :
+ IMB_TC_RECORD_RUN);
seq->anim_preseek = IMB_anim_get_preseek(seq->anim);
@@ -1117,7 +1132,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se
return cnt;
}
-
+
/* **********************************************************************
proxy management
@@ -1125,48 +1140,105 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se
#define PROXY_MAXFILE (2*FILE_MAXDIR+FILE_MAXFILE)
+static IMB_Proxy_Size seq_rendersize_to_proxysize(int size)
+{
+ if (size >= 100) {
+ return IMB_PROXY_NONE;
+ }
+ if (size >= 99) {
+ return IMB_PROXY_100;
+ }
+ if (size >= 75) {
+ return IMB_PROXY_75;
+ }
+ if (size >= 50) {
+ return IMB_PROXY_50;
+ }
+ return IMB_PROXY_25;
+}
+
+static void seq_open_anim_file(Sequence * seq)
+{
+ char name[FILE_MAXDIR+FILE_MAXFILE];
+ StripProxy * proxy;
+
+ if(seq->anim != NULL) {
+ return;
+ }
+
+ BLI_join_dirfile(name, sizeof(name),
+ seq->strip->dir, seq->strip->stripdata->name);
+ BLI_path_abs(name, G.main->name);
+
+ seq->anim = openanim(name, IB_rect |
+ ((seq->flag & SEQ_FILTERY) ?
+ IB_animdeinterlace : 0), seq->streamindex);
+
+ if (seq->anim == NULL) {
+ return;
+ }
+
+ proxy = seq->strip->proxy;
+
+ if (proxy == NULL) {
+ return;
+ }
+
+ if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
+ IMB_anim_set_index_dir(seq->anim, seq->strip->proxy->dir);
+ }
+}
+
+
static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, char * name)
{
int frameno;
char dir[FILE_MAXDIR];
+ int render_size = context.preview_render_size;
if (!seq->strip->proxy) {
return FALSE;
}
+ /* MOVIE tracks (only exception: custom files) are now handled
+ internally by ImBuf module for various reasons: proper time code
+ support, quicker index build, using one file instead
+ of a full directory of jpeg files, etc. Trying to support old
+ and new method at once could lead to funny effects, if people
+ have both, a directory full of jpeg files and proxy avis, so
+ sorry folks, please rebuild your proxies... */
+
if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) {
strcpy(dir, seq->strip->proxy->dir);
+ } else if (seq->type == SEQ_IMAGE) {
+ snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir);
} else {
- if (ELEM(seq->type, SEQ_IMAGE, SEQ_MOVIE)) {
- snprintf(dir, FILE_MAXDIR, "%s/BL_proxy", seq->strip->dir);
- } else {
- return FALSE;
- }
+ return FALSE;
}
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
- BLI_join_dirfile(name, FILE_MAX, dir, seq->strip->proxy->file); /* XXX, not real length */
+ BLI_join_dirfile(name, PROXY_MAXFILE,
+ dir, seq->strip->proxy->file);
BLI_path_abs(name, G.main->name);
return TRUE;
}
+ /* dirty hack to distinguish 100% render size from PROXY_100 */
+ if (render_size == 99) {
+ render_size = 100;
+ }
+
/* generate a separate proxy directory for each preview size */
- switch(seq->type) {
- case SEQ_IMAGE:
+ if (seq->type == SEQ_IMAGE) {
snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir,
context.preview_render_size,
give_stripelem(seq, cfra)->name);
frameno = 1;
- break;
- case SEQ_MOVIE:
- frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs;
- snprintf(name, PROXY_MAXFILE, "%s/%s/%d/####", dir,
- seq->strip->stripdata->name, context.preview_render_size);
- break;
- default:
- frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs;
+ } else {
+ frameno = (int) give_stripelem_index(seq, cfra)
+ + seq->anim_startofs;
snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir,
context.preview_render_size);
}
@@ -1182,13 +1254,18 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra,
static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int cfra)
{
char name[PROXY_MAXFILE];
+ IMB_Proxy_Size psize = seq_rendersize_to_proxysize(
+ context.preview_render_size);
+ int size_flags;
if (!(seq->flag & SEQ_USE_PROXY)) {
return NULL;
}
- /* rendering at 100% ? No real sense in proxy-ing, right? */
- if (context.preview_render_size == 100) {
+ size_flags = seq->strip->proxy->build_size_flags;
+
+ /* only use proxies, if they are enabled (even if present!) */
+ if (psize != IMB_PROXY_NONE && ((size_flags & psize) != psize)) {
return NULL;
}
@@ -1199,13 +1276,19 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int
return NULL;
}
- seq->strip->proxy->anim = openanim(name, IB_rect);
+ seq->strip->proxy->anim = openanim(name, IB_rect, 0);
}
if (seq->strip->proxy->anim==NULL) {
return NULL;
}
- return IMB_anim_absolute(seq->strip->proxy->anim, frameno);
+ seq_open_anim_file(seq);
+
+ frameno = IMB_anim_index_get_frame_index(
+ seq->anim, seq->strip->proxy->tc, frameno);
+
+ return IMB_anim_absolute(seq->strip->proxy->anim, frameno,
+ IMB_TC_NONE, IMB_PROXY_NONE);
}
if (seq_proxy_get_fname(context, seq, cfra, name) == 0) {
@@ -1219,67 +1302,30 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int
}
}
-#if 0
-static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int cfra,
- int build_proxy_run, int preview_render_size);
-
-static void seq_proxy_build_frame(Scene *scene, Sequence * seq, int cfra, int preview_render_size, int seqrectx, int seqrecty)
+static void seq_proxy_build_frame(SeqRenderData context,
+ Sequence* seq, int cfra,
+ int proxy_render_size)
{
char name[PROXY_MAXFILE];
int quality;
- TStripElem * se;
- int ok;
int rectx, recty;
+ int ok;
struct ImBuf * ibuf;
- if (!(seq->flag & SEQ_USE_PROXY)) {
- return;
- }
-
- /* rendering at 100% ? No real sense in proxy-ing, right? */
- if (preview_render_size == 100) {
+ if (!seq_proxy_get_fname(context, seq, cfra, name)) {
return;
}
- /* that's why it is called custom... */
- if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
- return;
- }
+ ibuf = seq_render_strip(context, seq, cfra);
- if (!seq_proxy_get_fname(scene, seq, cfra, name, preview_render_size)) {
- return;
- }
-
- se = give_tstripelem(seq, cfra);
- if (!se) {
- return;
- }
-
- if(se->ibuf) {
- IMB_freeImBuf(se->ibuf);
- se->ibuf = 0;
- }
-
- do_build_seq_ibuf(scene, seq, se, cfra, TRUE, preview_render_size,
- seqrectx, seqrecty);
-
- if (!se->ibuf) {
- return;
- }
-
- rectx= (preview_render_size*scene->r.xsch)/100;
- recty= (preview_render_size*scene->r.ysch)/100;
-
- ibuf = se->ibuf;
+ rectx = (proxy_render_size * context.scene->r.xsch) / 100;
+ recty = (proxy_render_size * context.scene->r.ysch) / 100;
if (ibuf->x != rectx || ibuf->y != recty) {
IMB_scalefastImBuf(ibuf, (short)rectx, (short)recty);
}
- /* quality is fixed, otherwise one has to generate separate
- directories for every quality...
-
- depth = 32 is intentionally left in, otherwise ALPHA channels
+ /* depth = 32 is intentionally left in, otherwise ALPHA channels
won't work... */
quality = seq->strip->proxy->quality;
ibuf->ftype= JPG | quality;
@@ -1292,69 +1338,80 @@ static void seq_proxy_build_frame(Scene *scene, Sequence * seq, int cfra, int pr
}
IMB_freeImBuf(ibuf);
- se->ibuf = 0;
}
-static void seq_proxy_rebuild(Scene *scene, Sequence * seq, int seqrectx,
- int seqrecty)
+void seq_proxy_rebuild(struct Main * bmain, Scene *scene, Sequence * seq,
+ short *stop, short *do_update, float *progress)
{
+ SeqRenderData context;
int cfra;
- float rsize = seq->strip->proxy->size;
+ int tc_flags;
+ int size_flags;
+ int quality;
+
+ if (!seq->strip || !seq->strip->proxy) {
+ return;
+ }
+
+ if (!(seq->flag & SEQ_USE_PROXY)) {
+ return;
+ }
- waitcursor(1);
+ tc_flags = seq->strip->proxy->build_tc_flags;
+ size_flags = seq->strip->proxy->build_size_flags;
+ quality = seq->strip->proxy->quality;
- G.afbreek = 0;
+ if (seq->type == SEQ_MOVIE) {
+ seq_open_anim_file(seq);
- /* flag management tries to account for strobe and
- other "non-linearities", that might come in the future...
- better way would be to "touch" the files, so that _really_
- no one is rebuild twice.
- */
+ if (seq->anim) {
+ IMB_anim_index_rebuild(
+ seq->anim, tc_flags, size_flags, quality,
+ stop, do_update, progress);
+ }
+ return;
+ }
- for (cfra = seq->startdisp; cfra < seq->enddisp; cfra++) {
- TStripElem * tse = give_tstripelem(seq, cfra);
+ if (!(seq->flag & SEQ_USE_PROXY)) {
+ return;
+ }
- tse->flag &= ~STRIPELEM_PREVIEW_DONE;
+ /* that's why it is called custom... */
+ if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
+ return;
}
-
+ /* fail safe code */
- /* a _lot_ faster for movie files, if we read frames in
- sequential order */
- if (seq->flag & SEQ_REVERSE_FRAMES) {
- for (cfra = seq->enddisp-seq->endstill-1;
- cfra >= seq->startdisp + seq->startstill; cfra--) {
- TStripElem * tse = give_tstripelem(seq, cfra);
-
- if (!(tse->flag & STRIPELEM_PREVIEW_DONE)) {
-//XXX set_timecursor(cfra);
- seq_proxy_build_frame(scene, seq, cfra, rsize,
- seqrectx, seqrecty);
- tse->flag |= STRIPELEM_PREVIEW_DONE;
- }
- if (blender_test_break()) {
- break;
- }
+ context = seq_new_render_data(
+ bmain, scene,
+ (scene->r.size * (float) scene->r.xsch) / 100.0f + 0.5f,
+ (scene->r.size * (float) scene->r.ysch) / 100.0f + 0.5f,
+ 100);
+
+ for (cfra = seq->startdisp + seq->startstill;
+ cfra < seq->enddisp - seq->endstill; cfra++) {
+ if (size_flags & IMB_PROXY_25) {
+ seq_proxy_build_frame(context, seq, cfra, 25);
}
- } else {
- for (cfra = seq->startdisp + seq->startstill;
- cfra < seq->enddisp - seq->endstill; cfra++) {
- TStripElem * tse = give_tstripelem(seq, cfra);
-
- if (!(tse->flag & STRIPELEM_PREVIEW_DONE)) {
-//XXX set_timecursor(cfra);
- seq_proxy_build_frame(scene, seq, cfra, rsize,
- seqrectx, seqrecty);
- tse->flag |= STRIPELEM_PREVIEW_DONE;
- }
- if (blender_test_break()) {
- break;
- }
+ if (size_flags & IMB_PROXY_50) {
+ seq_proxy_build_frame(context, seq, cfra, 50);
+ }
+ if (size_flags & IMB_PROXY_75) {
+ seq_proxy_build_frame(context, seq, cfra, 75);
}
+ if (size_flags & IMB_PROXY_100) {
+ seq_proxy_build_frame(context, seq, cfra, 100);
+ }
+
+ *progress= (float)cfra/(seq->enddisp - seq->endstill
+ - seq->startdisp + seq->startstill);
+ *do_update= 1;
+
+ if(*stop || G.afbreek)
+ break;
}
- waitcursor(0);
}
-#endif
/* **********************************************************************
@@ -1571,6 +1628,8 @@ static ImBuf * input_preprocess(
{
float mul;
+ ibuf = IMB_makeSingleUser(ibuf);
+
if((seq->flag & SEQ_FILTERY) && seq->type != SEQ_MOVIE) {
IMB_filtery(ibuf);
}
@@ -2096,17 +2155,20 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
}
case SEQ_MOVIE:
{
- if(seq->anim==NULL) {
- BLI_join_dirfile(name, sizeof(name), seq->strip->dir, seq->strip->stripdata->name);
- BLI_path_abs(name, G.main->name);
-
- seq->anim = openanim(name, IB_rect |
- ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0));
- }
+ seq_open_anim_file(seq);
if(seq->anim) {
- IMB_anim_set_preseek(seq->anim, seq->anim_preseek);
- ibuf = IMB_anim_absolute(seq->anim, nr + seq->anim_startofs);
+ IMB_anim_set_preseek(seq->anim,
+ seq->anim_preseek);
+
+ ibuf = IMB_anim_absolute(
+ seq->anim, nr + seq->anim_startofs,
+ seq->strip->proxy ?
+ seq->strip->proxy->tc
+ : IMB_TC_RECORD_RUN,
+ seq_rendersize_to_proxysize(
+ context.preview_render_size));
+
/* we don't need both (speed reasons)! */
if (ibuf && ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
@@ -3625,7 +3687,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
BLI_strncpy(path, seq_load->path, sizeof(path));
BLI_path_abs(path, G.main->name);
- an = openanim(path, IB_rect);
+ an = openanim(path, IB_rect, 0);
if(an==NULL)
return NULL;
@@ -3641,7 +3703,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len = seq->len = IMB_anim_get_duration( an );
+ strip->len = seq->len = IMB_anim_get_duration( an, IMB_TC_RECORD_RUN );
strip->us= 1;
/* we only need 1 element for MOVIE strips */
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 67d7e7bffd6..186a5ea1852 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1779,7 +1779,8 @@ static void ccgDM_drawUVEdges(DerivedMesh *dm)
}
}
-static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) {
+static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs),
+ int (*compareDrawOptions)(void *userData, int cur_index, int next_index)) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
MCol *mcol= NULL;
@@ -1787,6 +1788,9 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *u
char *faceFlags = ccgdm->faceFlags;
int gridFaces = gridSize - 1, totface;
+ /* currently unused -- each original face is handled separately */
+ (void)compareDrawOptions;
+
if(useColors) {
mcol = dm->getFaceDataArray(dm, CD_WEIGHT_MCOL);
if(!mcol)