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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-01-26 11:34:40 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-01-26 11:34:40 +0300
commit87627374000b7de7445736a7239a3f2b168ce7eb (patch)
tree2f0fe5d42d0938fc1b684af702d8613099bea1bd /source/blender
parent784d8ee37a52f3ef689aa6d02e75e50566efe93f (diff)
parentba8ea9ec63c25b1ce134a846176f7bf252f4d487 (diff)
2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17853:HEAD
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_global.h1
-rw-r--r--source/blender/blenkernel/SConscript6
-rw-r--r--source/blender/blenkernel/intern/collision.c2
-rw-r--r--source/blender/blenkernel/intern/constraint.c14
-rw-r--r--source/blender/blenkernel/intern/effect.c2
-rw-r--r--source/blender/blenkernel/intern/image.c36
-rw-r--r--source/blender/blenkernel/intern/particle_system.c8
-rw-r--r--source/blender/blenlib/BLI_arithb.h1
-rw-r--r--source/blender/blenlib/intern/arithb.c11
-rw-r--r--source/blender/blenlib/intern/graph.c6
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/blenpluginapi/iff.h5
-rw-r--r--source/blender/editors/animation/anim_markers.c22
-rw-r--r--source/blender/editors/space_file/SConscript7
-rw-r--r--source/blender/editors/space_file/filelist.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c3
-rw-r--r--source/blender/editors/transform/transform_snap.c18
-rw-r--r--source/blender/gpu/intern/gpu_material.c2
-rw-r--r--source/blender/imbuf/IMB_imbuf_types.h10
-rw-r--r--source/blender/imbuf/intern/IMB_jp2.h49
-rw-r--r--source/blender/imbuf/intern/jp2.c736
-rw-r--r--source/blender/imbuf/intern/openexr/CMakeLists.txt4
-rw-r--r--source/blender/imbuf/intern/readimage.c11
-rw-r--r--source/blender/imbuf/intern/util.c20
-rw-r--r--source/blender/imbuf/intern/writeimage.c8
-rw-r--r--source/blender/makesdna/DNA_action_types.h20
-rw-r--r--source/blender/makesdna/DNA_actuator_types.h2
-rw-r--r--source/blender/makesdna/DNA_scene_types.h12
-rw-r--r--source/blender/nodes/CMakeLists.txt6
-rw-r--r--source/blender/nodes/SConscript2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_filter.c1
-rw-r--r--source/blender/radiosity/intern/source/radfactors.c4
-rw-r--r--source/blender/radiosity/intern/source/radrender.c4
-rw-r--r--source/blender/readblenfile/intern/BLO_readblenfile.c2
-rw-r--r--source/blender/render/intern/source/occlusion.c10
-rw-r--r--source/blender/render/intern/source/pipeline.c32
-rw-r--r--source/blender/render/intern/source/rendercore.c4
-rw-r--r--source/blender/render/intern/source/shadeinput.c2
38 files changed, 1020 insertions, 72 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 07ade7cb208..0d5208ed90d 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -178,6 +178,7 @@ typedef struct Global {
#define G_FILE_GLSL_NO_RAMPS (1 << 19)
#define G_FILE_GLSL_NO_NODES (1 << 20)
#define G_FILE_GLSL_NO_EXTRA_TEX (1 << 21)
+#define G_FILE_IGNORE_DEPRECATION_WARNINGS (1 << 22)
/* G.windowstate */
#define G_WINDOWSTATE_USERDEF 0
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index bf09b2aac03..cb0c60fb1f1 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -35,6 +35,9 @@ if env['WITH_BF_INTERNATIONAL']:
if env['WITH_BF_OPENEXR']:
defs += ' WITH_OPENEXR'
+if env['WITH_BF_OPENJPEG']:
+ defs += ' WITH_OPENJPEG'
+
if env['WITH_BF_DDS']:
defs += ' WITH_DDS'
@@ -46,6 +49,9 @@ if env['WITH_BF_QUICKTIME']:
defs += ' WITH_QUICKTIME'
incs += ' ' + env['BF_QUICKTIME_INC']
+if env['WITH_BF_BULLET']:
+ defs += ' WITH_BULLET'
+
if env['BF_NO_ELBEEM']:
defs += ' DISABLE_ELBEEM'
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 9e57fef41f7..c122145c98f 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -1237,7 +1237,7 @@ int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModifierDat
if(out_normalVelocity < 0.0)
{
out_normalVelocity*= -1.0;
- VecMulf(out_normal, -1.0);
+ VecNegf(out_normal);
}
*/
/* Inelastic repulsion impulse. */
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index f5613a34700..912bc7ab3bd 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -898,7 +898,7 @@ static void vectomat (float *vec, float *target_up, short axis, short upflag, sh
n[2] = 1.0;
}
if (axis > 2) axis -= 3;
- else VecMulf(n,-1);
+ else VecNegf(n);
/* n specifies the transformation of the track axis */
if (flags & TARGET_Z_UP) {
@@ -2039,7 +2039,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[0]);
VecSubf(totmat[1], vec, vec2);
Normalize(totmat[1]);
- VecMulf(totmat[1],-1);
+ VecNegf(totmat[1]);
/* the x axis is fixed */
totmat[0][0] = cob->matrix[0][0];
@@ -2057,7 +2057,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[0]);
VecSubf(totmat[2], vec, vec2);
Normalize(totmat[2]);
- VecMulf(totmat[2],-1);
+ VecNegf(totmat[2]);
/* the x axis is fixed */
totmat[0][0] = cob->matrix[0][0];
@@ -2122,7 +2122,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[1]);
VecSubf(totmat[0], vec, vec2);
Normalize(totmat[0]);
- VecMulf(totmat[0],-1);
+ VecNegf(totmat[0]);
/* the y axis is fixed */
totmat[1][0] = cob->matrix[1][0];
@@ -2140,7 +2140,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[1]);
VecSubf(totmat[2], vec, vec2);
Normalize(totmat[2]);
- VecMulf(totmat[2],-1);
+ VecNegf(totmat[2]);
/* the y axis is fixed */
totmat[1][0] = cob->matrix[1][0];
@@ -2205,7 +2205,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[2]);
VecSubf(totmat[0], vec, vec2);
Normalize(totmat[0]);
- VecMulf(totmat[0],-1);
+ VecNegf(totmat[0]);
/* the z axis is fixed */
totmat[2][0] = cob->matrix[2][0];
@@ -2223,7 +2223,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[2]);
VecSubf(totmat[1], vec, vec2);
Normalize(totmat[1]);
- VecMulf(totmat[1],-1);
+ VecNegf(totmat[1]);
/* the z axis is fixed */
totmat[2][0] = cob->matrix[2][0];
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index d28d4206768..5217464c2c9 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -252,7 +252,7 @@ static float eff_calc_visibility(Scene *scene, Object *ob, float *co, float *dir
return 0;
VECCOPY(norm, dir);
- VecMulf(norm, -1.0);
+ VecNegf(norm);
len = Normalize(norm);
// check all collision objects
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 7890b72f6e2..1b851444e04 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -766,6 +766,10 @@ int BKE_imtype_to_ftype(int imtype)
return RAWTGA;
else if(imtype==R_HAMX)
return AN_hamx;
+#ifdef WITH_OPENJPEG
+ else if(imtype==R_JP2)
+ return JP2;
+#endif
else
return JPG|90;
}
@@ -800,6 +804,10 @@ int BKE_ftype_to_imtype(int ftype)
return R_RAWTGA;
else if(ftype == AN_hamx)
return R_HAMX;
+#ifdef WITH_OPENJPEG
+ else if(ftype & JP2)
+ return R_JP2;
+#endif
else
return R_JPEG90;
}
@@ -876,6 +884,12 @@ void BKE_add_image_extension(Scene *scene, char *string, int imtype)
if(!BLI_testextensie(string, ".tga"))
extension= ".tga";
}
+#ifdef WITH_OPENJPEG
+ else if(imtype==R_JP2) {
+ if(!BLI_testextensie(string, ".jp2"))
+ extension= ".jp2";
+ }
+#endif
else { // R_MOVIE, R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90, R_QUICKTIME etc
if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
extension= ".jpg";
@@ -1219,6 +1233,28 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimt
else if(imtype==R_HAMX) {
ibuf->ftype= AN_hamx;
}
+#ifdef WITH_OPENJPEG
+ else if(imtype==R_JP2) {
+ if(quality < 10) quality= 90;
+ ibuf->ftype= JP2|quality;
+
+ if (subimtype & R_JPEG2K_16BIT) {
+ ibuf->ftype |= JP2_16BIT;
+ } else if (subimtype & R_JPEG2K_12BIT) {
+ ibuf->ftype |= JP2_12BIT;
+ }
+
+ if (subimtype & R_JPEG2K_YCC) {
+ ibuf->ftype |= JP2_YCC;
+ }
+
+ if (subimtype & R_JPEG2K_CINE_PRESET) {
+ ibuf->ftype |= JP2_CINE;
+ if (subimtype & R_JPEG2K_CINE_48FPS)
+ ibuf->ftype |= JP2_CINE_48FPS;
+ }
+ }
+#endif
else {
/* R_JPEG90, R_MOVIE, etc. default we save jpegs */
if(quality < 10) quality= 90;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 4a4a8b2e5b7..516cdc76125 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -824,7 +824,7 @@ void psys_thread_distribute_particle(ParticleThread *thread, ParticleData *pa, C
VecCopyf(tan,seam->tan);
VecSubf(temp2,co1,temp);
if(Inpf(tan,temp2)<0.0f)
- VecMulf(tan,-1.0f);
+ VecNegf(tan);
}
for(w=0; w<maxw; w++){
VecSubf(temp2,ptn[w].co,temp);
@@ -1878,7 +1878,7 @@ void reset_particle(Scene *scene, ParticleData *pa, ParticleSystem *psys, Partic
}
/* create rotation quat */
- VecMulf(rot_vec,-1.0);
+ VecNegf(rot_vec);
vectoquat(rot_vec, OB_POSX, OB_POSZ, q2);
/* randomize rotation quat */
@@ -3025,7 +3025,7 @@ static void particle_intersect_face(void *userdata, int index, const BVHTreeRay
CalcNormFloat(t0, t1, t2, col->nor);
VECSUB(temp, co2, co1);
if(Inpf(col->nor, temp) > 0.0f)
- VecMulf(col->nor, -1.0f);
+ VecNegf(col->nor);
VECCOPY(col->vel,vel);
@@ -3805,7 +3805,7 @@ static void boid_body(Scene *scene, BoidVecFunc *bvf, ParticleData *pa, Particle
VecRotToQuat(pa->state.vel,bank,q);
VECCOPY(dvec,pa->state.vel);
- VecMulf(dvec,-1.0f);
+ VecNegf(dvec);
vectoquat(dvec, OB_POSX, OB_POSZ, q2);
QuatMul(pa->state.rot,q,q2);
diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h
index 8c55a83785b..5acee360872 100644
--- a/source/blender/blenlib/BLI_arithb.h
+++ b/source/blender/blenlib/BLI_arithb.h
@@ -242,6 +242,7 @@ int VecLen(int *v1, int *v2);
float VecLenf(float *v1, float *v2);
float VecLength(float *v);
void VecMulf(float *v1, float f);
+void VecNegf(float *v1);
int VecLenCompare(float *v1, float *v2, float limit);
int VecCompare(float *v1, float *v2, float limit);
diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c
index a9e1e80a403..0d65e615039 100644
--- a/source/blender/blenlib/intern/arithb.c
+++ b/source/blender/blenlib/intern/arithb.c
@@ -2188,6 +2188,13 @@ void VecMulf(float *v1, float f)
v1[2]*= f;
}
+void VecNegf(float *v1)
+{
+ v1[0] = -v1[0];
+ v1[1] = -v1[1];
+ v1[2] = -v1[2];
+}
+
void VecOrthoBasisf(float *v, float *v1, float *v2)
{
float f = sqrt(v[0]*v[0] + v[1]*v[1]);
@@ -3950,7 +3957,7 @@ int SweepingSphereIntersectsTriangleUV(float p1[3], float p2[3], float radius, f
Normalize(nor);
/* flip normal */
- if(Inpf(nor,vel)>0.0f) VecMulf(nor,-1.0f);
+ if(Inpf(nor,vel)>0.0f) VecNegf(nor);
a=Inpf(p1,nor)-Inpf(v0,nor);
nordotv=Inpf(nor,vel);
@@ -4682,7 +4689,7 @@ void tangent_from_uv(float *uv1, float *uv2, float *uv3, float *co1, float *co2,
/* check flip */
if ((ct[0]*n[0] + ct[1]*n[1] + ct[2]*n[2]) < 0.0f)
- VecMulf(tang, -1.0f);
+ VecNegf(tang);
}
/* used for zoom values*/
diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c
index de9c8860c6a..11bb8ea8964 100644
--- a/source/blender/blenlib/intern/graph.c
+++ b/source/blender/blenlib/intern/graph.c
@@ -807,15 +807,15 @@ static void testAxialSymmetry(BGraph *graph, BNode* root_node, BNode* node1, BNo
if (abs(nor[0]) > abs(nor[1]) && abs(nor[0]) > abs(nor[2]) && nor[0] < 0)
{
- VecMulf(nor, -1);
+ VecNegf(nor);
}
else if (abs(nor[1]) > abs(nor[0]) && abs(nor[1]) > abs(nor[2]) && nor[1] < 0)
{
- VecMulf(nor, -1);
+ VecNegf(nor);
}
else if (abs(nor[2]) > abs(nor[1]) && abs(nor[2]) > abs(nor[0]) && nor[2] < 0)
{
- VecMulf(nor, -1);
+ VecNegf(nor);
}
/* mirror node2 along axis */
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 256ef7cb8aa..3600c64d352 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3396,6 +3396,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
fluidmd->fss= newdataadr(fd, fluidmd->fss);
+ fluidmd->fss->meshSurfNormals = 0;
}
else if (md->type==eModifierType_Collision) {
@@ -8517,6 +8518,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
fluidmd->fss->lastgoodframe = INT_MAX;
fluidmd->fss->flag = 0;
+ fluidmd->fss->meshSurfNormals = 0;
}
}
}
diff --git a/source/blender/blenpluginapi/iff.h b/source/blender/blenpluginapi/iff.h
index 92cbd7dd093..e7f328d870f 100644
--- a/source/blender/blenpluginapi/iff.h
+++ b/source/blender/blenpluginapi/iff.h
@@ -56,6 +56,10 @@
#endif
#define RADHDR (1<<24)
+#ifdef WITH_OPENJPEG
+#define JP2 (1 << 18)
+#endif
+
#define RAWTGA (TGA | 1)
#define JPG_STD (JPG | (0 << 8))
@@ -113,6 +117,7 @@
#define IS_tim(x) (x->ftype & TIM)
#define IS_tiff(x) (x->ftype & TIFF)
#define IS_openexr(x) (x->ftype & OPENEXR)
+#define IS_jp2(x) (x->ftype & JP2)
#define IMAGIC 0732
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 2bd91ec9e6a..947b3bad9e7 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -163,6 +163,9 @@ void draw_markers_time(const bContext *C, int flag)
View2D *v2d= UI_view2d_fromcontext(C);
TimeMarker *marker;
+ if(markers == NULL)
+ return;
+
/* unselected markers are drawn at the first time */
for (marker= markers->first; marker; marker= marker->next) {
if (!(marker->flag & SELECT)) draw_marker(v2d, marker, CTX_data_scene(C)->r.cfra, flag);
@@ -185,6 +188,9 @@ static int ed_marker_add(bContext *C, wmOperator *op)
TimeMarker *marker;
int frame= CTX_data_scene(C)->r.cfra;
+ if(markers == NULL)
+ return OPERATOR_CANCELLED;
+
/* two markers can't be at the same place */
for(marker= markers->first; marker; marker= marker->next)
if(marker->frame == frame)
@@ -260,6 +266,8 @@ static int ed_marker_move_init(bContext *C, wmOperator *op)
TimeMarker *marker;
int totmark=0;
int a;
+
+ if(markers == NULL) return 0;
for (marker= markers->first; marker; marker= marker->next)
if (marker->flag & SELECT) totmark++;
@@ -496,6 +504,8 @@ static void ed_marker_duplicate_apply(bContext *C, wmOperator *op)
ListBase *markers= context_get_markers(C);
TimeMarker *marker, *newmarker;
+ if(markers == NULL) return;
+
/* go through the list of markers, duplicate selected markers and add duplicated copies
* to the begining of the list (unselect original markers) */
for(marker= markers->first; marker; marker= marker->next) {
@@ -591,6 +601,9 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend)
float viewx;
int x, y, cfra;
+ if(markers == NULL)
+ return OPERATOR_PASS_THROUGH;
+
x= evt->x - CTX_wm_region(C)->winrct.xmin;
y= evt->y - CTX_wm_region(C)->winrct.ymin;
@@ -681,6 +694,9 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
if(yminf > 30.0f || ymaxf < 0.0f)
return 0;
+ if(markers == NULL)
+ return 0;
+
/* XXX marker context */
for(marker= markers->first; marker; marker= marker->next) {
if ((marker->frame > xminf) && (marker->frame <= xmaxf)) {
@@ -730,6 +746,9 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
ListBase *markers= context_get_markers(C);
TimeMarker *marker;
int select= RNA_int_get(op->ptr, "select_type");
+
+ if(markers == NULL)
+ return OPERATOR_CANCELLED;
if(RNA_boolean_get(op->ptr, "select_swap")) {
for(marker= markers->first; marker; marker= marker->next) {
@@ -786,6 +805,9 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *op)
TimeMarker *marker, *nmarker;
short changed= 0;
+ if(markers == NULL)
+ return OPERATOR_CANCELLED;
+
for(marker= markers->first; marker; marker= nmarker) {
nmarker= marker->next;
if(marker->flag & SELECT) {
diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript
index dab30676171..8302d6eecef 100644
--- a/source/blender/editors/space_file/SConscript
+++ b/source/blender/editors/space_file/SConscript
@@ -8,4 +8,9 @@ incs += ' ../../blenloader #intern/bmfont ../../makesrna'
incs += ' ../../render/extern/include '
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
-env.BlenderLib ( 'bf_editors_space_file', sources, Split(incs), [], libtype=['core'], priority=[115] )
+defs = []
+
+if env['WITH_BF_OPENJPEG']:
+ defs.append('WITH_OPENJPEG')
+
+env.BlenderLib ( 'bf_editors_space_file', sources, Split(incs), defs, libtype=['core'], priority=[115] )
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index e3551510df1..384fb2141c3 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -769,6 +769,9 @@ void filelist_setfiletypes(struct FileList* filelist, short has_quicktime)
if( BLI_testextensie(file->relname, ".int")
|| BLI_testextensie(file->relname, ".inta")
|| BLI_testextensie(file->relname, ".jpg")
+#ifdef WITH_OPENJPEG
+ || BLI_testextensie(file->relname, ".jp2")
+#endif
|| BLI_testextensie(file->relname, ".jpeg")
|| BLI_testextensie(file->relname, ".tga")
|| BLI_testextensie(file->relname, ".rgb")
@@ -812,6 +815,10 @@ void filelist_setfiletypes(struct FileList* filelist, short has_quicktime)
if(BLI_testextensie(file->relname, ".int")
|| BLI_testextensie(file->relname, ".inta")
|| BLI_testextensie(file->relname, ".jpg")
+ || BLI_testextensie(file->relname, ".jpeg")
+#ifdef WITH_OPENJPEG
+ || BLI_testextensie(file->relname, ".jp2")
+#endif
|| BLI_testextensie(file->relname, ".tga")
|| BLI_testextensie(file->relname, ".rgb")
|| BLI_testextensie(file->relname, ".rgba")
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index c10cadb2332..a96cd5a817c 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1080,7 +1080,8 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
int m;
#endif
- if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT);
+ if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT);
+ else if((G.f & G_TEXTUREPAINT) && scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)==0);
else if(scene->obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT));
else {
v3d->flag &= ~V3D_NEEDBACKBUFDRAW;
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 023b97058d3..7663f3418fb 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1212,10 +1212,22 @@ int snapObjects(TransInfo *t, int *dist, float *loc, float *no, int mode) {
Object *ob = dupli_ob->ob;
if (ob->type == OB_MESH) {
- DerivedMesh *dm = mesh_get_derived_final(t->scene, ob, CD_MASK_BAREMESH);
+ DerivedMesh *dm;
+ EditMesh *em;
int val;
-
- val = snapDerivedMesh(t, ob, dm, NULL, dupli_ob->mat, ray_start, ray_normal, t->mval, loc, no, dist, &depth);
+
+ if(ob == t->obedit)
+ {
+ em = ((Mesh *)ob->data)->edit_mesh;
+ dm = editmesh_get_derived_cage(t->scene, t->obedit, em, CD_MASK_BAREMESH);
+ }
+ else
+ {
+ em = NULL;
+ dm = mesh_get_derived_final(t->scene, ob, CD_MASK_BAREMESH);
+ }
+
+ val = snapDerivedMesh(t, ob, dm, em, dupli_ob->mat, ray_start, ray_normal, t->mval, loc, no, dist, &depth);
retval = retval || val;
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 46df003cbbc..87703bc73bf 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -306,7 +306,7 @@ void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float v
if(material->dynproperty & DYN_LAMP_VEC) {
VECCOPY(lamp->dynvec, lamp->vec);
Normalize(lamp->dynvec);
- VecMulf(lamp->dynvec, -1.0f);
+ VecNegf(lamp->dynvec);
Mat4Mul3Vecfl(viewmat, lamp->dynvec);
}
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index 73ef83393b0..eadd7affe6a 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -181,6 +181,15 @@ typedef enum {
#define DDS (1 << 19)
#endif
+#ifdef WITH_OPENJPEG
+#define JP2 (1 << 18)
+#define JP2_12BIT (1 << 17)
+#define JP2_16BIT (1 << 16)
+#define JP2_YCC (1 << 15)
+#define JP2_CINE (1 << 14)
+#define JP2_CINE_48FPS (1 << 13)
+#endif
+
#define RAWTGA (TGA | 1)
#define JPG_STD (JPG | (0 << 8))
@@ -217,6 +226,7 @@ typedef enum {
#define IS_tga(x) (x->ftype & TGA)
#define IS_png(x) (x->ftype & PNG)
#define IS_openexr(x) (x->ftype & OPENEXR)
+#define IS_jp2(x) (x->ftype & JP2)
#define IS_cineon(x) (x->ftype & CINEON)
#define IS_dpx(x) (x->ftype & DPX)
#define IS_bmp(x) (x->ftype & BMP)
diff --git a/source/blender/imbuf/intern/IMB_jp2.h b/source/blender/imbuf/intern/IMB_jp2.h
new file mode 100644
index 00000000000..fcdd4589fca
--- /dev/null
+++ b/source/blender/imbuf/intern/IMB_jp2.h
@@ -0,0 +1,49 @@
+/*
+ * IMB_jp2.h
+ *
+ * $Id: IMB_bmp.h 14444 2008-04-16 22:40:48Z hos $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+/**
+ * \file IMB_jp2.h
+ * \ingroup imbuf
+ * \brief Function declarations for jp2.c
+ */
+
+#ifndef IMB_JP2_H
+#define IMB_JP2_H
+
+#ifdef WITH_OPENJPEG
+struct ImBuf;
+
+int imb_is_a_jp2(void *buf);
+struct ImBuf *imb_jp2_decode(unsigned char *mem, int size, int flags);
+short imb_savejp2(struct ImBuf *ibuf, char *name, int flags);
+#endif /* WITH_OPENJPEG */
+
+#endif
+
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
new file mode 100644
index 00000000000..6217cd6bea2
--- /dev/null
+++ b/source/blender/imbuf/intern/jp2.c
@@ -0,0 +1,736 @@
+/**
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifdef WITH_OPENJPEG
+
+#include "BLI_blenlib.h"
+
+#include "imbuf.h"
+#include "imbuf_patch.h"
+
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
+#include "IMB_allocimbuf.h"
+#include "IMB_jp2.h"
+
+#include "openjpeg.h"
+
+#define JP2_FILEHEADER_SIZE 14
+
+static char JP2_HEAD[]= {0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A};
+
+/* We only need this because of how the presets are set */
+typedef struct img_folder{
+ /** The directory path of the folder containing input images*/
+ char *imgdirpath;
+ /** Output format*/
+ char *out_format;
+ /** Enable option*/
+ char set_imgdir;
+ /** Enable Cod Format for output*/
+ char set_out_format;
+ /** User specified rate stored in case of cinema option*/
+ float *rates;
+}img_fol_t;
+
+static int checkj2p(unsigned char *mem) /* J2K_CFMT */
+{
+ return memcmp(JP2_HEAD, mem, 12) ? 0 : 1;
+}
+
+int imb_is_a_jp2(void *buf)
+{
+ return checkj2p(buf);
+}
+
+
+/**
+sample error callback expecting a FILE* client object
+*/
+void error_callback(const char *msg, void *client_data) {
+ FILE *stream = (FILE*)client_data;
+ fprintf(stream, "[ERROR] %s", msg);
+}
+/**
+sample warning callback expecting a FILE* client object
+*/
+void warning_callback(const char *msg, void *client_data) {
+ FILE *stream = (FILE*)client_data;
+ fprintf(stream, "[WARNING] %s", msg);
+}
+/**
+sample debug callback expecting no client object
+*/
+void info_callback(const char *msg, void *client_data) {
+ (void)client_data;
+ fprintf(stdout, "[INFO] %s", msg);
+}
+
+
+
+struct ImBuf *imb_jp2_decode(unsigned char *mem, int size, int flags)
+{
+ struct ImBuf *ibuf = 0;
+ int use_float = 0; /* for precissions higher then 8 use float */
+ unsigned char *rect= NULL;
+ float *rect_float= NULL;
+
+ long signed_offsets[4] = {0,0,0,0};
+ int float_divs[4];
+
+ int index;
+
+ int w, h, depth;
+
+ opj_dparameters_t parameters; /* decompression parameters */
+
+ opj_event_mgr_t event_mgr; /* event manager */
+ opj_image_t *image = NULL;
+
+ int i;
+
+ opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
+ opj_cio_t *cio = NULL;
+
+ if (checkj2p(mem) == 0) return(0);
+
+ /* configure the event callbacks (not required) */
+ memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
+ event_mgr.error_handler = error_callback;
+ event_mgr.warning_handler = warning_callback;
+ event_mgr.info_handler = info_callback;
+
+
+ /* set decoding parameters to default values */
+ opj_set_default_decoder_parameters(&parameters);
+
+
+ /* JPEG 2000 compressed image data */
+
+ /* get a decoder handle */
+ dinfo = opj_create_decompress(CODEC_JP2);
+
+ /* catch events using our callbacks and give a local context */
+ opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
+
+ /* setup the decoder decoding parameters using the current image and user parameters */
+ opj_setup_decoder(dinfo, &parameters);
+
+ /* open a byte stream */
+ cio = opj_cio_open((opj_common_ptr)dinfo, mem, size);
+
+ /* decode the stream and fill the image structure */
+ image = opj_decode(dinfo, cio);
+
+ if(!image) {
+ fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
+ opj_destroy_decompress(dinfo);
+ opj_cio_close(cio);
+ return NULL;
+ }
+
+ /* close the byte stream */
+ opj_cio_close(cio);
+
+
+ if((image->numcomps * image->x1 * image->y1) == 0)
+ {
+ fprintf(stderr,"\nError: invalid raw image parameters\n");
+ return NULL;
+ }
+
+ w = image->comps[0].w;
+ h = image->comps[0].h;
+
+ switch (image->numcomps) {
+ case 1: /* Greyscale */
+ case 3: /* Color */
+ depth= 24;
+ break;
+ default: /* 2 or 4 - Greyscale or Color + alpha */
+ depth= 32; /* greyscale + alpha */
+ break;
+ }
+
+
+ i = image->numcomps;
+ if (i>4) i= 4;
+
+ while (i) {
+ i--;
+
+ if (image->comps[i].prec > 8)
+ use_float = 1;
+
+ if (image->comps[i].sgnd)
+ signed_offsets[i]= 1 << (image->comps[i].prec - 1);
+
+ /* only needed for float images but dosnt hurt to calc this */
+ float_divs[i]= (1<<image->comps[i].prec)-1;
+ }
+
+ if (use_float) {
+ ibuf= IMB_allocImBuf(w, h, depth, IB_rectfloat, 0);
+ rect_float = ibuf->rect_float;
+ } else {
+ ibuf= IMB_allocImBuf(w, h, depth, IB_rect, 0);
+ rect = (unsigned char *) ibuf->rect;
+ }
+
+ if (ibuf==NULL) {
+ if(dinfo)
+ opj_destroy_decompress(dinfo);
+ return NULL;
+ }
+
+ ibuf->ftype = JP2;
+
+ if (use_float) {
+ rect_float = ibuf->rect_float;
+
+ if (image->numcomps < 3) {
+ /* greyscale 12bits+ */
+ for (i = 0; i < w * h; i++, rect_float+=4) {
+ index = w * h - ((i) / (w) + 1) * w + (i) % (w);
+
+ rect_float[0]= rect_float[1]= rect_float[2]= (float)(image->comps[0].data[index] + signed_offsets[0]) / float_divs[0];
+
+ if (image->numcomps == 2)
+ rect_float[3]= (image->comps[1].data[index] + signed_offsets[1]) / float_divs[1];
+ else
+ rect_float[3]= 1.0f;
+ }
+ } else {
+ /* rgb or rgba 12bits+ */
+ for (i = 0; i < w * h; i++, rect_float+=4) {
+ index = w * h - ((i) / (w) + 1) * w + (i) % (w);
+
+ rect_float[0]= (float)(image->comps[0].data[index] + signed_offsets[0]) / float_divs[0];
+ rect_float[1]= (float)(image->comps[1].data[index] + signed_offsets[1]) / float_divs[1];
+ rect_float[2]= (float)(image->comps[2].data[index] + signed_offsets[2]) / float_divs[2];
+
+ if (image->numcomps >= 4)
+ rect_float[3]= (float)(image->comps[2].data[index] + signed_offsets[3]) / float_divs[3];
+ else
+ rect_float[3]= 1.0f;
+ }
+ }
+
+ } else {
+
+ if (image->numcomps < 3) {
+ /* greyscale */
+ for (i = 0; i < w * h; i++, rect+=4) {
+ index = w * h - ((i) / (w) + 1) * w + (i) % (w);
+
+ rect_float[0]= rect_float[1]= rect_float[2]= (image->comps[0].data[index] + signed_offsets[0]);
+
+ if (image->numcomps == 2)
+ rect[3]= image->comps[1].data[index] + signed_offsets[1];
+ else
+ rect[3]= 255;
+ }
+ } else {
+ /* 8bit rgb or rgba */
+ for (i = 0; i < w * h; i++, rect+=4) {
+ int index = w * h - ((i) / (w) + 1) * w + (i) % (w);
+
+ rect[0]= image->comps[0].data[index] + signed_offsets[0];
+ rect[1]= image->comps[1].data[index] + signed_offsets[1];
+ rect[2]= image->comps[2].data[index] + signed_offsets[2];
+
+ if (image->numcomps >= 4)
+ rect[3]= image->comps[2].data[index] + signed_offsets[3];
+ else
+ rect[3]= 255;
+ }
+ }
+ }
+
+ /* free remaining structures */
+ if(dinfo) {
+ opj_destroy_decompress(dinfo);
+ }
+
+ /* free image data structure */
+ opj_image_destroy(image);
+
+ if (flags & IB_rect) {
+ IMB_rect_from_float(ibuf);
+ }
+
+ return(ibuf);
+}
+
+//static opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp) {
+/* prec can be 8, 12, 16 */
+
+#define UPSAMPLE_8_TO_12(_val) ((_val<<4) | (_val & ((1<<4)-1)))
+#define UPSAMPLE_8_TO_16(_val) ((_val<<8)+_val)
+
+#define DOWNSAMPLE_FLOAT_TO_8BIT(_val) (_val)<=0.0f?0: ((_val)>=1.0f?255: (int)(255.0f*(_val)))
+#define DOWNSAMPLE_FLOAT_TO_12BIT(_val) (_val)<=0.0f?0: ((_val)>=1.0f?4095: (int)(4095.0f*(_val)))
+#define DOWNSAMPLE_FLOAT_TO_16BIT(_val) (_val)<=0.0f?0: ((_val)>=1.0f?65535: (int)(65535.0f*(_val)))
+
+
+/*
+2048x1080 (2K) at 24 fps or 48 fps, or 4096x2160 (4K) at 24 fps; 3×12 bits per pixel, XYZ color space
+
+ * In 2K, for Scope (2.39:1) presentation 2048x858 pixels of the imager is used
+ * In 2K, for Flat (1.85:1) presentation 1998x1080 pixels of the imager is used
+*/
+
+/* ****************************** COPIED FROM image_to_j2k.c */
+
+/* ----------------------------------------------------------------------- */
+#define CINEMA_24_CS 1302083 /*Codestream length for 24fps*/
+#define CINEMA_48_CS 651041 /*Codestream length for 48fps*/
+#define COMP_24_CS 1041666 /*Maximum size per color component for 2K & 4K @ 24fps*/
+#define COMP_48_CS 520833 /*Maximum size per color component for 2K @ 48fps*/
+
+
+static int initialise_4K_poc(opj_poc_t *POC, int numres){
+ POC[0].tile = 1;
+ POC[0].resno0 = 0;
+ POC[0].compno0 = 0;
+ POC[0].layno1 = 1;
+ POC[0].resno1 = numres-1;
+ POC[0].compno1 = 3;
+ POC[0].prg1 = CPRL;
+ POC[1].tile = 1;
+ POC[1].resno0 = numres-1;
+ POC[1].compno0 = 0;
+ POC[1].layno1 = 1;
+ POC[1].resno1 = numres;
+ POC[1].compno1 = 3;
+ POC[1].prg1 = CPRL;
+ return 2;
+}
+
+void cinema_parameters(opj_cparameters_t *parameters){
+ parameters->tile_size_on = false;
+ parameters->cp_tdx=1;
+ parameters->cp_tdy=1;
+
+ /*Tile part*/
+ parameters->tp_flag = 'C';
+ parameters->tp_on = 1;
+
+ /*Tile and Image shall be at (0,0)*/
+ parameters->cp_tx0 = 0;
+ parameters->cp_ty0 = 0;
+ parameters->image_offset_x0 = 0;
+ parameters->image_offset_y0 = 0;
+
+ /*Codeblock size= 32*32*/
+ parameters->cblockw_init = 32;
+ parameters->cblockh_init = 32;
+ parameters->csty |= 0x01;
+
+ /*The progression order shall be CPRL*/
+ parameters->prog_order = CPRL;
+
+ /* No ROI */
+ parameters->roi_compno = -1;
+
+ parameters->subsampling_dx = 1; parameters->subsampling_dy = 1;
+
+ /* 9-7 transform */
+ parameters->irreversible = 1;
+
+}
+
+void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
+ int i;
+ float temp_rate;
+
+ switch (parameters->cp_cinema){
+ case CINEMA2K_24:
+ case CINEMA2K_48:
+ if(parameters->numresolution > 6){
+ parameters->numresolution = 6;
+ }
+ if (!((image->comps[0].w == 2048) || (image->comps[0].h == 1080))){
+ fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\nJPEG Digital Cinema Profile-3 "
+ "(2K profile) compliance requires that at least one of coordinates match 2048 x 1080\n",
+ image->comps[0].w,image->comps[0].h);
+ parameters->cp_rsiz = STD_RSIZ;
+ }
+ break;
+
+ case CINEMA4K_24:
+ if(parameters->numresolution < 1){
+ parameters->numresolution = 1;
+ }else if(parameters->numresolution > 7){
+ parameters->numresolution = 7;
+ }
+ if (!((image->comps[0].w == 4096) || (image->comps[0].h == 2160))){
+ fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4"
+ "(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n",
+ image->comps[0].w,image->comps[0].h);
+ parameters->cp_rsiz = STD_RSIZ;
+ }
+ parameters->numpocs = initialise_4K_poc(parameters->POC,parameters->numresolution);
+ break;
+ case OFF:
+ /* do nothing */
+ break;
+ }
+
+ switch (parameters->cp_cinema){
+ case CINEMA2K_24:
+ case CINEMA4K_24:
+ for(i=0 ; i<parameters->tcp_numlayers ; i++){
+ temp_rate = 0 ;
+ if (img_fol->rates[i]== 0){
+ parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
+ (CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
+ }else{
+ temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
+ (img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
+ if (temp_rate > CINEMA_24_CS ){
+ parameters->tcp_rates[i]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
+ (CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
+ }else{
+ parameters->tcp_rates[i]= img_fol->rates[i];
+ }
+ }
+ }
+ parameters->max_comp_size = COMP_24_CS;
+ break;
+
+ case CINEMA2K_48:
+ for(i=0 ; i<parameters->tcp_numlayers ; i++){
+ temp_rate = 0 ;
+ if (img_fol->rates[i]== 0){
+ parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
+ (CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
+ }else{
+ temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
+ (img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
+ if (temp_rate > CINEMA_48_CS ){
+ parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
+ (CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
+ }else{
+ parameters->tcp_rates[i]= img_fol->rates[i];
+ }
+ }
+ }
+ parameters->max_comp_size = COMP_48_CS;
+ break;
+ case OFF:
+ /* do nothing */
+ break;
+ }
+ parameters->cp_disto_alloc = 1;
+}
+
+
+static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) {
+
+ unsigned char *rect;
+ float *rect_float;
+
+ int subsampling_dx = parameters->subsampling_dx;
+ int subsampling_dy = parameters->subsampling_dy;
+
+
+ int i, numcomps, w, h, prec;
+ int x,y, y_row;
+ OPJ_COLOR_SPACE color_space;
+ opj_image_cmptparm_t cmptparm[4]; /* maximum of 4 components */
+ opj_image_t * image = NULL;
+
+ img_fol_t img_fol; /* only needed for cinema presets */
+ memset(&img_fol,0,sizeof(img_fol_t));
+
+ if (ibuf->ftype & JP2_CINE) {
+
+ if (ibuf->x==4096 || ibuf->y==2160)
+ parameters->cp_cinema= CINEMA4K_24;
+ else {
+ if (ibuf->ftype & JP2_CINE_48FPS) {
+ parameters->cp_cinema= CINEMA2K_48;
+ }
+ else {
+ parameters->cp_cinema= CINEMA2K_24;
+ }
+ }
+ if (parameters->cp_cinema){
+ img_fol.rates = (float*)MEM_mallocN(parameters->tcp_numlayers * sizeof(float), "jp2_rates");
+ for(i=0; i< parameters->tcp_numlayers; i++){
+ img_fol.rates[i] = parameters->tcp_rates[i];
+ }
+ cinema_parameters(parameters);
+ }
+
+ color_space= CLRSPC_SYCC;
+ prec= 12;
+ numcomps= 3;
+ }
+ else {
+ /* Get settings from the imbuf */
+ color_space = (ibuf->ftype & JP2_YCC) ? CLRSPC_SYCC : CLRSPC_SRGB;
+
+ if (ibuf->ftype & JP2_16BIT) prec= 16;
+ else if (ibuf->ftype & JP2_12BIT) prec= 12;
+ else prec= 8;
+
+ /* 32bit images == alpha channel */
+ /* grayscale not supported yet */
+ numcomps= (ibuf->depth==32) ? 4 : 3;
+ }
+
+ w= ibuf->x;
+ h= ibuf->y;
+
+
+ /* initialize image components */
+ memset(&cmptparm[0], 0, 4 * sizeof(opj_image_cmptparm_t));
+ for(i = 0; i < numcomps; i++) {
+ cmptparm[i].prec = prec;
+ cmptparm[i].bpp = prec;
+ cmptparm[i].sgnd = 0;
+ cmptparm[i].dx = subsampling_dx;
+ cmptparm[i].dy = subsampling_dy;
+ cmptparm[i].w = w;
+ cmptparm[i].h = h;
+ }
+ /* create the image */
+ image = opj_image_create(numcomps, &cmptparm[0], color_space);
+ if(!image) {
+ printf("Error: opj_image_create() failed\n");
+ return NULL;
+ }
+
+ /* set image offset and reference grid */
+ image->x0 = parameters->image_offset_x0;
+ image->y0 = parameters->image_offset_y0;
+ image->x1 = parameters->image_offset_x0 + (w - 1) * subsampling_dx + 1;
+ image->y1 = parameters->image_offset_y0 + (h - 1) * subsampling_dy + 1;
+
+ /* set image data */
+ rect = (unsigned char*) ibuf->rect;
+ rect_float= ibuf->rect_float;
+
+ if (rect_float && rect && prec==8) {
+ /* No need to use the floating point buffer, just write the 8 bits from the char buffer */
+ rect_float= NULL;
+ }
+
+
+ if (rect_float) {
+ switch (prec) {
+ case 8: /* Convert blenders float color channels to 8,12 or 16bit ints */
+ for(y=h-1; y>=0; y--) {
+ y_row = y*w;
+ for(x=0; x<w; x++, rect_float+=4) {
+ i = y_row + x;
+
+ image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[0]);
+ image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[1]);
+ image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[2]);
+ if (numcomps>3)
+ image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[3]);
+ }
+ }
+ break;
+
+ case 12:
+ for(y=h-1; y>=0; y--) {
+ y_row = y*w;
+ for(x=0; x<w; x++, rect_float+=4) {
+ i = y_row + x;
+
+ image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[0]);
+ image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[1]);
+ image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[2]);
+ if (numcomps>3)
+ image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[3]);
+ }
+ }
+ break;
+ case 16:
+ for(y=h-1; y>=0; y--) {
+ y_row = y*w;
+ for(x=0; x<w; x++, rect_float+=4) {
+ i = y_row + x;
+
+ image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[0]);
+ image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[1]);
+ image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[2]);
+ if (numcomps>3)
+ image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[3]);
+ }
+ }
+ break;
+ }
+ } else {
+ /* just use rect*/
+ switch (prec) {
+ case 8:
+ for(y=h-1; y>=0; y--) {
+ y_row = y*w;
+ for(x=0; x<w; x++, rect+=4) {
+ i = y_row + x;
+
+ image->comps[0].data[i] = rect[0];
+ image->comps[1].data[i] = rect[1];
+ image->comps[2].data[i] = rect[2];
+ if (numcomps>3)
+ image->comps[3].data[i] = rect[3];
+ }
+ }
+ break;
+
+ case 12: /* Up Sampling, a bit pointless but best write the bit depth requested */
+ for(y=h-1; y>=0; y--) {
+ y_row = y*w;
+ for(x=0; x<w; x++, rect+=4) {
+ i = y_row + x;
+
+ image->comps[0].data[i]= UPSAMPLE_8_TO_12(rect[0]);
+ image->comps[1].data[i]= UPSAMPLE_8_TO_12(rect[1]);
+ image->comps[2].data[i]= UPSAMPLE_8_TO_12(rect[2]);
+ if (numcomps>3)
+ image->comps[3].data[i]= UPSAMPLE_8_TO_12(rect[3]);
+ }
+ }
+ break;
+ case 16:
+ for(y=h-1; y>=0; y--) {
+ y_row = y*w;
+ for(x=0; x<w; x++, rect+=4) {
+ i = y_row + x;
+
+ image->comps[0].data[i]= UPSAMPLE_8_TO_16(rect[0]);
+ image->comps[1].data[i]= UPSAMPLE_8_TO_16(rect[1]);
+ image->comps[2].data[i]= UPSAMPLE_8_TO_16(rect[2]);
+ if (numcomps>3)
+ image->comps[3].data[i]= UPSAMPLE_8_TO_16(rect[3]);
+ }
+ }
+ break;
+ }
+ }
+
+ /* Decide if MCT should be used */
+ parameters->tcp_mct = image->numcomps == 3 ? 1 : 0;
+
+ if(parameters->cp_cinema){
+ cinema_setup_encoder(parameters,image,&img_fol);
+ }
+
+ if (img_fol.rates)
+ MEM_freeN(img_fol.rates);
+
+ return image;
+}
+
+
+/* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */
+short imb_savejp2(struct ImBuf *ibuf, char *name, int flags) {
+
+ int quality = ibuf->ftype & 0xff;
+
+ int bSuccess;
+ opj_cparameters_t parameters; /* compression parameters */
+ opj_event_mgr_t event_mgr; /* event manager */
+ opj_image_t *image = NULL;
+
+ /*
+ configure the event callbacks (not required)
+ setting of each callback is optionnal
+ */
+ memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
+ event_mgr.error_handler = error_callback;
+ event_mgr.warning_handler = warning_callback;
+ event_mgr.info_handler = info_callback;
+
+ /* set encoding parameters to default values */
+ opj_set_default_encoder_parameters(&parameters);
+
+ /* compression ratio */
+ /* invert range, from 10-100, 100-1
+ * where jpeg see's 1 and highest quality (lossless) and 100 is very low quality*/
+ parameters.tcp_rates[0]= ((100-quality)/90.0f*99.0f) + 1;
+
+
+ parameters.tcp_numlayers = 1; // only one resolution
+ parameters.cp_disto_alloc = 1;
+
+ image= ibuftoimage(ibuf, &parameters);
+
+
+ { /* JP2 format output */
+ int codestream_length;
+ opj_cio_t *cio = NULL;
+ FILE *f = NULL;
+
+ /* get a JP2 compressor handle */
+ opj_cinfo_t* cinfo = opj_create_compress(CODEC_JP2);
+
+ /* catch events using our callbacks and give a local context */
+ opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr);
+
+ /* setup the encoder parameters using the current image and using user parameters */
+ opj_setup_encoder(cinfo, &parameters, image);
+
+ /* open a byte stream for writing */
+ /* allocate memory for all tiles */
+ cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
+
+ /* encode the image */
+ bSuccess = opj_encode(cinfo, cio, image, NULL); /* last arg used to be parameters.index but this deprecated */
+
+ if (!bSuccess) {
+ opj_cio_close(cio);
+ fprintf(stderr, "failed to encode image\n");
+ return 0;
+ }
+ codestream_length = cio_tell(cio);
+
+ /* write the buffer to disk */
+ f = fopen(name, "wb");
+
+ if (!f) {
+ fprintf(stderr, "failed to open %s for writing\n", name);
+ return 1;
+ }
+ fwrite(cio->buffer, 1, codestream_length, f);
+ fclose(f);
+ fprintf(stderr,"Generated outfile %s\n",name);
+ /* close and free the byte stream */
+ opj_cio_close(cio);
+
+ /* free remaining compression structures */
+ opj_destroy_compress(cinfo);
+ }
+
+ /* free image data */
+ opj_image_destroy(image);
+
+ return 1;
+}
+
+#endif /* WITH_OPENJPEG */
diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt
index bb1dad087f3..21792086774 100644
--- a/source/blender/imbuf/intern/openexr/CMakeLists.txt
+++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt
@@ -38,5 +38,9 @@ SET(INC
${OPENEXR_INC}
)
+IF(WITH_OPENEXR)
+ ADD_DEFINITIONS(-DWITH_OPENEXR)
+ENDIF(WITH_OPENEXR)
+
BLENDERLIB(bf_openexr "${SRC}" "${INC}")
#env.BlenderLib ('bf_openexr', source_files, incs, defs, libtype=['core','player'], priority = [90, 200])
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index 05e7921665b..6df92f69fff 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -58,6 +58,10 @@
#include "IMB_dpxcineon.h"
#include "BKE_global.h"
+#ifdef WITH_OPENJPEG
+#include "IMB_jp2.h"
+#endif
+
#ifdef WITH_OPENEXR
#include "openexr/openexr_api.h"
#endif
@@ -161,11 +165,16 @@ ImBuf *IMB_ibImageFromMemory(int *mem, int size, int flags) {
if (ibuf) return (ibuf);
#endif
+#ifdef WITH_OPENJPEG
+ ibuf = imb_jp2_decode((uchar *)mem, size, flags);
+ if (ibuf) return (ibuf);
+#endif
+
#ifdef WITH_DDS
ibuf = imb_load_dds((uchar *)mem, size, flags);
if (ibuf) return (ibuf);
#endif
-
+
#ifdef WITH_QUICKTIME
#if defined(_WIN32) || defined (__APPLE__)
if(G.have_quicktime) {
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index c86f9b017bf..15d1d031dbd 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -68,10 +68,14 @@
#include "quicktime_import.h"
#endif
+#ifdef WITH_OPENJPEG
+#include "IMB_jp2.h"
+#endif
+
#ifdef WITH_FFMPEG
#include <ffmpeg/avcodec.h>
#include <ffmpeg/avformat.h>
-//#include <ffmpeg/avdevice.h>
+#include <ffmpeg/avdevice.h>
#include <ffmpeg/log.h>
#if LIBAVFORMAT_VERSION_INT < (49 << 16)
@@ -140,7 +144,11 @@ static int IMB_ispic_name(char *name)
/*
if (imb_is_a_bmp(buf)) return(BMP);
*/
-
+
+#ifdef WITH_OPENJPEG
+ if (imb_is_a_jp2(buf)) return(JP2);
+#endif
+
#ifdef WITH_QUICKTIME
#if defined(_WIN32) || defined(__APPLE__)
if(G.have_quicktime) {
@@ -191,6 +199,9 @@ int IMB_ispic(char *filename)
#ifdef WITH_BF_OPENEXR
|| BLI_testextensie(filename, ".exr")
#endif
+#ifdef WITH_BF_OPENJPEG
+ || BLI_testextensie(filename, ".jp2")
+#endif
|| BLI_testextensie(filename, ".sgi")) {
return IMB_ispic_name(filename);
} else {
@@ -211,6 +222,9 @@ int IMB_ispic(char *filename)
#ifdef WITH_BF_OPENEXR
|| BLI_testextensie(filename, ".exr")
#endif
+#ifdef WITH_BF_OPENJPEG
+ || BLI_testextensie(filename, ".jp2")
+#endif
|| BLI_testextensie(filename, ".iff")
|| BLI_testextensie(filename, ".lbm")
|| BLI_testextensie(filename, ".sgi")) {
@@ -258,7 +272,7 @@ void do_init_ffmpeg()
if (!ffmpeg_init) {
ffmpeg_init = 1;
av_register_all();
- //avdevice_register_all();
+ avdevice_register_all();
if ((G.f & G_DEBUG) == 0)
{
diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c
index 11cb1ed039a..7e1120bf3e4 100644
--- a/source/blender/imbuf/intern/writeimage.c
+++ b/source/blender/imbuf/intern/writeimage.c
@@ -57,6 +57,9 @@
#include "IMB_bmp.h"
#include "IMB_tiff.h"
#include "IMB_radiance_hdr.h"
+#ifdef WITH_OPENJPEG
+#include "IMB_jp2.h"
+#endif
#ifdef WITH_OPENEXR
#include "openexr/openexr_api.h"
#endif
@@ -131,6 +134,11 @@ short IMB_saveiff(struct ImBuf *ibuf, char *name, int flags)
if (IS_dpx(ibuf)) {
return imb_save_dpx(ibuf, name, flags);
}
+#ifdef WITH_OPENJPEG
+ if (IS_jp2(ibuf)) {
+ return imb_savejp2(ibuf, name, flags);
+ }
+#endif
file = open(name, O_BINARY | O_RDWR | O_CREAT | O_TRUNC, 0666);
if (file < 0) return (FALSE);
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 1c49489c3c5..37995145ff8 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -102,7 +102,7 @@ typedef struct bPoseChannel {
/* PoseChannel (transform) flags */
-enum {
+typedef enum ePchan_Flag {
POSE_LOC = 0x0001,
POSE_ROT = 0x0002,
POSE_SIZE = 0x0004,
@@ -119,7 +119,7 @@ enum {
} ePchan_Flag;
/* PoseChannel constflag (constraint detection) */
-enum {
+typedef enum ePchan_ConstFlag {
PCHAN_HAS_IK = (1<<0),
PCHAN_HAS_CONST = (1<<1),
/* only used for drawing Posemode, not stored in channel */
@@ -130,7 +130,7 @@ enum {
} ePchan_ConstFlag;
/* PoseChannel->ikflag */
-enum {
+typedef enum ePchan_IkFlag {
BONE_IK_NO_XDOF = (1<<0),
BONE_IK_NO_YDOF = (1<<1),
BONE_IK_NO_ZDOF = (1<<2),
@@ -145,7 +145,7 @@ enum {
} ePchan_IkFlag;
/* PoseChannel->rotmode */
-enum {
+typedef enum ePchan_RotMode {
/* quaternion rotations (default, and for older Blender versions) */
PCHAN_ROT_QUAT = 0,
/* euler rotations (xyz only) */
@@ -177,7 +177,7 @@ typedef struct bPose {
/* Pose->flag */
-enum {
+typedef enum ePose_Flags {
/* results in armature_rebuild_pose being called */
POSE_RECALC = (1<<0),
/* prevents any channel from getting overridden by anim from IPO */
@@ -221,7 +221,7 @@ typedef struct bActionGroup {
} bActionGroup;
/* Action Group flags */
-enum {
+typedef enum eActionGroup_Flag {
AGRP_SELECTED = (1<<0),
AGRP_ACTIVE = (1<<1),
AGRP_PROTECTED = (1<<2),
@@ -259,7 +259,7 @@ typedef struct bAction {
/* Flags for the action */
-enum {
+typedef enum eAction_Flags {
/* flags for displaying in UI */
ACT_EXPANDED = (1<<0),
ACT_SELECTED = (1<<1),
@@ -331,7 +331,7 @@ typedef struct SpaceAction {
} SpaceAction;
/* SpaceAction flag */
-enum {
+typedef enum eSAction_Flag {
/* during transform (only set for TimeSlide) */
SACTION_MOVING = (1<<0),
/* show sliders (if relevant) */
@@ -354,7 +354,7 @@ enum {
/* SpaceAction Mode Settings */
// XXX should this be used by other editors too?
-enum {
+typedef enum eAnimEdit_Context {
/* action (default) */
SACTCONT_ACTION = 0,
/* editing of shapekey's IPO block */
@@ -366,7 +366,7 @@ enum {
} eAnimEdit_Context;
/* SpaceAction AutoSnap Settings (also used by other Animation Editors) */
-enum {
+typedef enum eAnimEdit_AutoSnap {
/* no auto-snap */
SACTSNAP_OFF = 0,
/* snap to 1.0 frame/second intervals */
diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h
index 43dada97d0e..48432b8c6e2 100644
--- a/source/blender/makesdna/DNA_actuator_types.h
+++ b/source/blender/makesdna/DNA_actuator_types.h
@@ -82,7 +82,7 @@ typedef struct bEditObjectActuator {
char name[32];
float linVelocity[3]; /* initial lin. velocity on creation */
float angVelocity[3]; /* initial ang. velocity on creation */
- float pad;
+ float mass;
short localflag; /* flag for the lin & ang. vel: apply locally */
short dyn_operation;
} bEditObjectActuator;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index aeb5fe01533..9194e4d2632 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -312,6 +312,10 @@ typedef struct RenderData {
/* cineon */
short cineonwhite, cineonblack;
float cineongamma;
+
+ /* jpeg2000 */
+ short jp2_preset, jp2_depth;
+ int rpad3;
} RenderData;
/* control render convert and shading engine */
@@ -693,6 +697,7 @@ typedef struct Scene {
#define R_DPX 27
#define R_MULTILAYER 28
#define R_DDS 29
+#define R_JP2 30
/* subimtype, flag options for imtype */
#define R_OPENEXR_HALF 1
@@ -701,6 +706,13 @@ typedef struct Scene {
#define R_CINEON_LOG 8
#define R_TIFF_16BIT 16
+#define R_JPEG2K_12BIT 32 /* Jpeg2000 */
+#define R_JPEG2K_16BIT 64
+#define R_JPEG2K_YCC 128 /* when disabled use RGB */
+#define R_JPEG2K_CINE_PRESET 256
+#define R_JPEG2K_CINE_48FPS 512
+
+
/* bake_mode: same as RE_BAKE_xxx defines */
/* bake_flag: */
#define R_BAKE_CLEAR 1
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 0b2bd9b4bfd..1f76cd0b424 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -55,11 +55,9 @@ ELSE(WITH_PYTHON)
ADD_DEFINITIONS(-DDISABLE_PYTHON)
ENDIF(WITH_PYTHON)
-ADD_DEFINITIONS(-DWITH_CCGSUBSURF)
-
-BLENDERLIB(bf_nodes "${SRC}" "${INC}")
-
IF(WITH_INTERNATIONAL)
ADD_DEFINITIONS(-DWITH_FREETYPE2)
ENDIF(WITH_INTERNATIONAL)
+BLENDERLIB(bf_nodes "${SRC}" "${INC}")
+
diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript
index b1ce78c717e..4859bbb550f 100644
--- a/source/blender/nodes/SConscript
+++ b/source/blender/nodes/SConscript
@@ -39,8 +39,6 @@ if env['WITH_BF_QUICKTIME']:
defs += ' WITH_QUICKTIME'
incs += ' ' + env['BF_QUICKTIME_INC']
-defs += ' WITH_CCGSUBSURF '
-
env.BlenderLib ( libname = 'bf_nodes', sources = sources, includes = Split(incs), defines = Split(defs), libtype=['core'], priority = [190] )
env.BlenderLib ( libname = 'bf_cmpnodes', sources = cmpsources, includes = Split(incs), defines = Split(defs), libtype=['core'], priority = [175] )
env.BlenderLib ( libname = 'bf_shdnodes', sources = shdsources, includes = Split(incs), defines = Split(defs), libtype=['core'], priority = [175] )
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
index 46a9d747ac1..6011ac3b58a 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
@@ -78,6 +78,7 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac)
QUATCOPY(fp, row2+4);
}
else if(pix==CB_VAL) {
+ fp+= pix;
for(x=2; x<rowlen; x++) {
f1= filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2];
f2= filter[0]*row1[0] + filter[3]*row1[1] + filter[6]*row1[2] + filter[1]*row2[0] + filter[4]*row2[1] + filter[7]*row2[2] + filter[2]*row3[0] + filter[5]*row3[1] + filter[8]*row3[2];
diff --git a/source/blender/radiosity/intern/source/radfactors.c b/source/blender/radiosity/intern/source/radfactors.c
index 1a400ff57a8..b87473dd811 100644
--- a/source/blender/radiosity/intern/source/radfactors.c
+++ b/source/blender/radiosity/intern/source/radfactors.c
@@ -533,10 +533,10 @@ void progressiverad()
if(shoot->first->f & RAD_TWOSIDED) {
VECCOPY(unshot, shoot->unshot);
- VecMulf(shoot->norm, -1.0);
+ VecNegf(shoot->norm);
if(makeformfactors(shoot))
applyformfactors(shoot);
- VecMulf(shoot->norm, -1.0);
+ VecNegf(shoot->norm);
VECCOPY(shoot->unshot, unshot);
}
diff --git a/source/blender/radiosity/intern/source/radrender.c b/source/blender/radiosity/intern/source/radrender.c
index 57726518f76..d33bbc90ee3 100644
--- a/source/blender/radiosity/intern/source/radrender.c
+++ b/source/blender/radiosity/intern/source/radrender.c
@@ -294,10 +294,10 @@ static void progressiverad_rr(Render *re)
/* ...unless it's two sided */
if(shootrf->flag & RAD_TWOSIDED) {
VECCOPY(unshot, shootrf->unshot);
- VecMulf(shootrf->norm, -1.0);
+ VecNegf(shootrf->norm);
makeformfactors_rr(re, shoot, shootrf);
applyformfactors_rr(re, shoot, shootrf);
- VecMulf(shootrf->norm, -1.0);
+ VecNegf(shootrf->norm);
VECCOPY(shootrf->unshot, unshot);
}
diff --git a/source/blender/readblenfile/intern/BLO_readblenfile.c b/source/blender/readblenfile/intern/BLO_readblenfile.c
index a988b269725..40a991ad702 100644
--- a/source/blender/readblenfile/intern/BLO_readblenfile.c
+++ b/source/blender/readblenfile/intern/BLO_readblenfile.c
@@ -68,7 +68,7 @@ char *headerMagic = "BLENDFI";
*/
void BLO_setversionnumber(char array[4], int version)
{
- memset(array, 0, sizeof(array));
+ memset(array, 0, sizeof(char)*4);
array[1] = version / 100;
array[2] = version % 100;
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index 5a2a58ca919..174a9db4398 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -181,8 +181,8 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr,
/* not a pretty solution, but fixes common cases */
if(shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
- VecMulf(shi->vn, -1.0f);
- VecMulf(shi->vno, -1.0f);
+ VecNegf(shi->vn);
+ VecNegf(shi->vno);
}
/* init material vars */
@@ -1288,7 +1288,7 @@ static void occ_compute_passes(Render *re, OcclusionTree *tree, int totpass)
for(pass=0; pass<totpass; pass++) {
for(i=0; i<tree->totface; i++) {
occ_face(&tree->face[i], co, n, NULL);
- VecMulf(n, -1.0f);
+ VecNegf(n);
VECADDFAC(co, co, n, 1e-8f);
occ_lookup(tree, 0, &tree->face[i], co, n, &occ[i], NULL);
@@ -1321,7 +1321,7 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f
aocolor= WO_AOPLAIN;
VECCOPY(nn, n);
- VecMulf(nn, -1.0f);
+ VecNegf(nn);
occ_lookup(tree, thread, exclude, co, nn, &occ, (aocolor)? bn: NULL);
@@ -1525,7 +1525,7 @@ static void *exec_strandsurface_sample(void *data)
CalcCent3f(co, co1, co2, co3);
CalcNormFloat(co1, co2, co3, n);
}
- VecMulf(n, -1.0f);
+ VecNegf(n);
sample_occ_tree(re, re->occlusiontree, NULL, co, n, othread->thread, 0, col);
VECCOPY(othread->facecol[a], col);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 12f904f8f5c..70f03fa8947 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -2622,17 +2622,19 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra)
else
nfra+= tfra;
- if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH) ) {
- BKE_makepicstring(scene, name, scene->r.pic, scene->r.cfra, scene->r.imtype);
- }
-
- if (scene->r.mode & R_NO_OVERWRITE && BLI_exist(name)) {
- printf("skipping existing frame \"%s\"\n", name);
- continue;
- }
- if (scene->r.mode & R_TOUCH && !BLI_exist(name)) {
- BLI_make_existing_file(name); /* makes the dir if its not there */
- BLI_touch(name);
+ /* Touch/NoOverwrite options are only valid for image's */
+ if(BKE_imtype_is_movie(scene->r.imtype) == 0) {
+ if(scene->r.mode & (R_NO_OVERWRITE | R_TOUCH))
+ BKE_makepicstring(scene, name, scene->r.pic, scene->r.cfra, scene->r.imtype);
+
+ if(scene->r.mode & R_NO_OVERWRITE && BLI_exist(name)) {
+ printf("skipping existing frame \"%s\"\n", name);
+ continue;
+ }
+ if(scene->r.mode & R_TOUCH && !BLI_exist(name)) {
+ BLI_make_existing_file(name); /* makes the dir if its not there */
+ BLI_touch(name);
+ }
}
re->r.cfra= scene->r.cfra; /* weak.... */
@@ -2645,8 +2647,10 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra)
if(G.afbreek==1) {
/* remove touched file */
- if (scene->r.mode & R_TOUCH && BLI_exist(name) && BLI_filepathsize(name) == 0) {
- BLI_delete(name, 0, 0);
+ if(BKE_imtype_is_movie(scene->r.imtype) == 0) {
+ if (scene->r.mode & R_TOUCH && BLI_exist(name) && BLI_filepathsize(name) == 0) {
+ BLI_delete(name, 0, 0);
+ }
}
break;
@@ -2711,7 +2715,7 @@ void RE_set_max_threads(int threads)
} else if(threads>=1 && threads<=BLENDER_MAX_THREADS) {
commandline_threads= threads;
} else {
- printf("Error, threads has to be in range 1-%d\n", BLENDER_MAX_THREADS);
+ printf("Error, threads has to be in range 0-%d\n", BLENDER_MAX_THREADS);
}
}
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index ebefbad6e21..deb6f0db743 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -1505,8 +1505,8 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
/* not a pretty solution, but fixes common cases */
if(shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
- VecMulf(shi->vn, -1.0f);
- VecMulf(shi->vno, -1.0f);
+ VecNegf(shi->vn);
+ VecNegf(shi->vno);
}
/* if nodetree, use the material that we are currently preprocessing
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index 476330152ec..1cd8ec110f9 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -354,7 +354,7 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo
Normalize(shi->vn);
if(INPR(shi->vn, shi->view) < 0.0f)
- VecMulf(shi->vn, -1.0f);
+ VecNegf(shi->vn);
}
VECCOPY(shi->vno, shi->vn);