diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-09-30 17:16:55 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-09-30 17:16:55 +0400 |
commit | e91f33101ff0999e07f7ce941f31dca793d954e7 (patch) | |
tree | 83c0d933f2ac1d063e2c57aaded58fd09d8d5712 /source/blender/blenkernel | |
parent | a42ba82f638e481d7fd3c3ed2ba05c331ef6717e (diff) | |
parent | 818b2e81da7d5f3e04439e3b4fef5c7ce5263b5b (diff) |
Merged changes in the trunk up to revision 50956.
Conflicts resolved:
source/blender/editors/interface/resources.c
Diffstat (limited to 'source/blender/blenkernel')
32 files changed, 175 insertions, 111 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 7df491c0fef..2d7030b2d42 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -203,7 +203,7 @@ void BKE_pose_ikparam_init(struct bPose *pose); void BKE_pose_itasc_init(struct bItasc *itasc); /* clears BONE_UNKEYED flags for frame changing */ -// XXX to be depreceated for a more general solution in animsys... +// XXX to be deprecated for a more general solution in animsys... void framechange_poses_clear_unkeyed(void); /* Bone Groups API --------------------- */ diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index db1139c9c7b..dd45ab19eb1 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 263 -#define BLENDER_SUBVERSION 21 +#define BLENDER_SUBVERSION 22 /* 262 was the last editmesh release but its has compatibility code for bmesh data, * so set the minversion to 2.61 */ diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index ac324b2af00..5e5f58f73fe 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -66,7 +66,7 @@ int BKE_imtype_is_movie(const char imtype); int BKE_imtype_supports_zbuf(const char imtype); int BKE_imtype_supports_compress(const char imtype); int BKE_imtype_supports_quality(const char imtype); -int BKE_imtype_supports_float(const char imtype); +int BKE_imtype_requires_linear_float(const char imtype); char BKE_imtype_valid_channels(const char imtype); char BKE_imtype_valid_depths(const char imtype); diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index ad5541a5a2f..06931662d3f 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -68,7 +68,7 @@ typedef struct Main { ListBase latt; ListBase lamp; ListBase camera; - ListBase ipo; // XXX depreceated + ListBase ipo; // XXX deprecated ListBase key; ListBase world; ListBase screen; diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 954fb47806b..c14085a559a 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -88,8 +88,8 @@ int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata, int totface, int totloop, int totpoly); /*calculates a face normal.*/ -void mesh_calc_poly_normal(struct MPoly *mpoly, struct MLoop *loopstart, - struct MVert *mvarray, float no[3]); +void BKE_mesh_calc_poly_normal(struct MPoly *mpoly, struct MLoop *loopstart, + struct MVert *mvarray, float no[3]); void BKE_mesh_calc_poly_normal_coords(struct MPoly *mpoly, struct MLoop *loopstart, const float (*vertex_coords)[3], float no[3]); @@ -98,7 +98,7 @@ void BKE_mesh_calc_poly_center(struct MPoly *mpoly, struct MLoop *loopstart, struct MVert *mvarray, float cent[3]); float BKE_mesh_calc_poly_area(struct MPoly *mpoly, struct MLoop *loopstart, - struct MVert *mvarray, float polynormal[3]); + struct MVert *mvarray, const float polynormal[3]); /* Find the index of the loop in 'poly' which references vertex, * returns -1 if not found */ diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 269d96d5c38..ec0703248fd 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -54,7 +54,7 @@ void BKE_object_workob_clear(struct Object *workob); void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob); void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src); -struct SoftBody *copy_softbody(struct SoftBody *sb); +struct SoftBody *copy_softbody(struct SoftBody *sb, int copy_caches); struct BulletSoftBody *copy_bulletsoftbody(struct BulletSoftBody *sb); void BKE_object_copy_particlesystems(struct Object *obn, struct Object *ob); void BKE_object_copy_softbody(struct Object *obn, struct Object *ob); @@ -82,6 +82,7 @@ struct Object *BKE_object_add(struct Scene *scene, int type); void *BKE_object_obdata_add_from_type(int type); struct Object *BKE_object_copy(struct Object *ob); +struct Object *BKE_object_copy_with_caches(struct Object *ob); void BKE_object_make_local(struct Object *ob); int BKE_object_is_libdata(struct Object *ob); int BKE_object_obdata_is_libdata(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index d6ab9a35697..77b35e1a25c 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -303,7 +303,7 @@ struct PointCache *BKE_ptcache_add(struct ListBase *ptcaches); void BKE_ptcache_free_mem(struct ListBase *mem_cache); void BKE_ptcache_free(struct PointCache *cache); void BKE_ptcache_free_list(struct ListBase *ptcaches); -struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct ListBase *ptcaches_old); +struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct ListBase *ptcaches_old, int copy_data); /********************** Baking *********************/ diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 1b301ba43b3..ec15e2ea87f 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1140,21 +1140,17 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa float *v3; /* float *v4; */ /* UNUSED */ float cent[3], quat[4], mat[3][3], mat3[3][3], tmat[4][4], obmat[4][4]; + float f_no[3]; MLoop *loopstart = mloop + mp->loopstart; - if (mp->totloop < 3) { - /* highly unlikely but to be safe */ + if (UNLIKELY(mp->totloop < 3)) { continue; } else { + BKE_mesh_calc_poly_normal(mp, mloop + mp->loopstart, mvert, f_no); v1 = mvert[(mv1 = loopstart[0].v)].co; v2 = mvert[(mv2 = loopstart[1].v)].co; v3 = mvert[(mv3 = loopstart[2].v)].co; -#if 0 - if (mp->totloop > 3) { - v4 = mvert[(mv4 = loopstart[3].v)].co; - } -#endif } /* translation */ @@ -1170,12 +1166,12 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa copy_v3_v3(obmat[3], cent); /* rotation */ - tri_to_quat(quat, v1, v2, v3); + tri_to_quat_ex(quat, v1, v2, v3, f_no); quat_to_mat3(mat, quat); /* scale */ if (par->transflag & OB_DUPLIFACES_SCALE) { - float size = BKE_mesh_calc_poly_area(mp, loopstart, mvert, NULL); + float size = BKE_mesh_calc_poly_area(mp, loopstart, mvert, f_no); size = sqrtf(size) * par->dupfacesca; mul_m3_fl(mat, size); } diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index cf785a4bb42..d685edfcda2 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -640,7 +640,7 @@ static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char if (fcu->rna_path != old_path) { bActionGroup *agrp = fcu->grp; - if ((agrp) && strcmp(oldName, agrp->name)==0) { + if ((agrp) && strcmp(oldName, agrp->name) == 0) { BLI_strncpy(agrp->name, newName, sizeof(agrp->name)); } } diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c index 18161bc6fcb..a7d90f09160 100644 --- a/source/blender/blenkernel/intern/bmfont.c +++ b/source/blender/blenkernel/intern/bmfont.c @@ -96,7 +96,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step) ysize = (bytes + (ibuf->x - 1)) / ibuf->x; if (ysize < ibuf->y) { - /* we're first going to copy all data into a liniar buffer. + /* we're first going to copy all data into a linear buffer. * step can be 4 or 1 bytes, and the data is not sequential because * the bitmap was flipped vertically. */ diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index fde95e0767e..ce39eea5ceb 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -529,7 +529,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf unsigned char *dst, crgb[3]; const float alpha = BKE_brush_alpha_get(scene, brush); float brush_rgb[3]; - + imbflag = (flt) ? IB_rectfloat : IB_rect; xoff = -bufsize / 2.0f + 0.5f; yoff = -bufsize / 2.0f + 0.5f; @@ -563,7 +563,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf else { BKE_brush_sample_tex(scene, brush, xy, rgba, 0); mul_v3_v3v3(dstf, rgba, brush_rgb); - dstf[3] = rgba[3] *alpha *BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); + dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); } } } @@ -594,7 +594,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf else if (texfall == 2) { BKE_brush_sample_tex(scene, brush, xy, rgba, 0); mul_v3_v3(rgba, brush->rgb); - alpha_f = rgba[3] *alpha *BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); + alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); rgb_float_to_uchar(dst, rgba); @@ -602,7 +602,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf } else { BKE_brush_sample_tex(scene, brush, xy, rgba, 0); - alpha_f = rgba[3] *alpha *BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); + alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); dst[0] = crgb[0]; dst[1] = crgb[1]; diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 09ca0df0680..0bda3b266b8 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2768,7 +2768,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n if (skip_align) { /* handles need to be updated during animation and applying stuff like hooks, - * but in such situatios it's quite difficult to distinguish in which order + * but in such situations it's quite difficult to distinguish in which order * align handles should be aligned so skip them for now */ return; } diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 1cb29b90133..d55848514cc 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1944,7 +1944,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh { /* Note: Current method only uses polygon edges to detect neighboring pixels. * -> It doesn't always lead to the optimum pixel but is accurate enough - * and faster/simplier than including possible face tip point links) + * and faster/simpler than including possible face tip point links) */ int x, y; @@ -2852,15 +2852,15 @@ static void mesh_faces_nearest_point_dp(void *userdata, int index, const float c /***************************** Brush Painting Calls ******************************/ -/* - * Mix color values to canvas point. +/** + * Mix color values to canvas point. * - * surface : canvas surface - * index : surface point index - * paintFlags : paint object flags - * paintColor,Alpha,Wetness : to be mixed paint values - * timescale : value used to adjust time dependand - * operations when using substeps + * \param surface canvas surface + * \param index surface point index + * \param paintFlags paint object flags + * \param paintColor,Alpha,Wetness to be mixed paint values + * \param timescale value used to adjust time dependent + * operations when using substeps */ static void dynamicPaint_mixPaintColors(DynamicPaintSurface *surface, int index, int paintFlags, const float paintColor[3], float *paintAlpha, float *paintWetness, float *timescale) @@ -4161,7 +4161,7 @@ static int dynamicPaint_prepareEffectStep(DynamicPaintSurface *surface, Scene *s pdEndEffectors(&effectors); } - /* Get number of required steps using averate point distance + /* Get number of required steps using average point distance * so that just a few ultra close pixels wont up substeps to max */ /* adjust number of required substep by fastest active effect */ @@ -4224,7 +4224,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force /* Only continue if surrounding point has higher wetness */ if (ePoint->wetness < pPoint->wetness || ePoint->wetness < MIN_WETNESS) continue; - w_factor = 1.0f / numOfNeighs *MIN2(ePoint->wetness, 1.0f) * speed_scale; + w_factor = 1.0f / numOfNeighs * MIN2(ePoint->wetness, 1.0f) * speed_scale; CLAMP(w_factor, 0.0f, 1.0f); /* mix new wetness and color */ diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index d620fc50e86..3d3afa7c4b3 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -619,6 +619,8 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char BLI_strncpy(colorspace_settings->name, colorspace, sizeof(colorspace_settings->name)); } + + IMB_colormanagement_check_is_data(ibuf, colorspace_settings->name); } else { ibuf = IMB_allocImBuf(width, height, depth, IB_rect); @@ -1031,7 +1033,7 @@ int BKE_imtype_supports_quality(const char imtype) return 0; } -int BKE_imtype_supports_float(const char imtype) +int BKE_imtype_requires_linear_float(const char imtype) { switch (imtype) { case R_IMF_IMTYPE_CINEON: @@ -2605,8 +2607,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ /* invalidate color managed buffers if render result changed */ BLI_lock_thread(LOCK_COLORMANAGE); - if (ibuf->x != rres.rectx || ibuf->y != rres.recty || ibuf->rect_float != rectf) - { + if (ibuf->x != rres.rectx || ibuf->y != rres.recty || ibuf->rect_float != rectf) { ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID; } diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index b2a9e229be9..953ee673f6b 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -32,7 +32,7 @@ /* NOTE: * - * This file is no longer used to provide tools for the depreceated IPO system. Instead, it + * This file is no longer used to provide tools for the deprecated IPO system. Instead, it * is only used to house the conversion code to the new system. * * -- Joshua Leung, Jan 2009 @@ -1765,7 +1765,7 @@ void do_versions_ipos_to_animato(Main *main) /* Any actuators set to ACT_IPO at this point are actually Action Actuators that need this converted IPO to finish converting the actuator. */ if (act->type == ACT_IPO) { - aa = (bActionActuator*)act->data; + aa = (bActionActuator *)act->data; aa->act = ob->adt->action; act->type = ACT_ACTION; } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 5b05ce02104..b9bf2fd01a3 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -133,7 +133,7 @@ Key *BKE_key_add(ID *id) /* common function */ key->uidgen = 1; - /* XXX the code here uses some defines which will soon be depreceated... */ + /* XXX the code here uses some defines which will soon be deprecated... */ switch (GS(id->name)) { case ID_ME: el = key->elemstr; diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 1a9ac9dc0af..13ad9962aff 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -1208,7 +1208,7 @@ static float maskrasterize_layer_isect(unsigned int *face, float (*cos)[3], cons /* needs work */ #if 1 - /* quad check fails for bowtie, so keep using 2 tri checks */ + /* quad check fails for bow-tie, so keep using 2 tri checks */ //if (isect_point_quad_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]])) if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]]) || isect_point_tri_v2(xy, cos[face[0]], cos[face[2]], cos[face[3]])) @@ -1216,7 +1216,7 @@ static float maskrasterize_layer_isect(unsigned int *face, float (*cos)[3], cons return maskrasterize_layer_z_depth_quad(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]]); } #elif 1 - /* don't use isect_point_tri_v2_cw because we could have bowtie quads */ + /* don't use isect_point_tri_v2_cw because we could have bow-tie quads */ if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]])) { return maskrasterize_layer_z_depth_tri(xy, cos[face[0]], cos[face[1]], cos[face[2]]); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 3408e2393c9..b8f891eabe1 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1328,9 +1328,9 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) r_col[2] = facm * (r_col[2]) + fac * (r_col[2]) / col[2]; break; case MA_RAMP_DIFF: - r_col[0] = facm * (r_col[0]) + fac *fabsf(r_col[0] - col[0]); - r_col[1] = facm * (r_col[1]) + fac *fabsf(r_col[1] - col[1]); - r_col[2] = facm * (r_col[2]) + fac *fabsf(r_col[2] - col[2]); + r_col[0] = facm * (r_col[0]) + fac * fabsf(r_col[0] - col[0]); + r_col[1] = facm * (r_col[1]) + fac * fabsf(r_col[1] - col[1]); + r_col[2] = facm * (r_col[2]) + fac * fabsf(r_col[2] - col[2]); break; case MA_RAMP_DARK: tmp = col[0] + ((1 - col[0]) * facm); @@ -1491,7 +1491,7 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) } /** - * \brief copy/paste buffer, if we had a propper py api that would be better + * \brief copy/paste buffer, if we had a proper py api that would be better * \note matcopybuf.nodetree does _NOT_ use ID's * \todo matcopybuf.nodetree's node->id's are NOT validated, this will crash! */ diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 206d80a6ff0..e45a052db4d 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -788,7 +788,7 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) nr--; } - /* check corrupt cases, bowtie geometry, cant handle these because edge data wont exist so just return 0 */ + /* check corrupt cases, bow-tie geometry, cant handle these because edge data wont exist so just return 0 */ if (nr == 3) { if ( /* real edges */ @@ -1864,7 +1864,7 @@ void BKE_mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, /* only calc poly normals */ mp = mpolys; for (i = 0; i < numPolys; i++, mp++) { - mesh_calc_poly_normal(mp, mloop + mp->loopstart, mverts, pnors[i]); + BKE_mesh_calc_poly_normal(mp, mloop + mp->loopstart, mverts, pnors[i]); } } @@ -1914,7 +1914,7 @@ void BKE_mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpo mp = mpolys; for (i = 0; i < numPolys; i++, mp++) { - mesh_calc_poly_normal(mp, mloop + mp->loopstart, mverts, pnors[i]); + BKE_mesh_calc_poly_normal(mp, mloop + mp->loopstart, mverts, pnors[i]); ml = mloop + mp->loopstart; BLI_array_empty(vertcos); @@ -2900,8 +2900,8 @@ static void mesh_calc_ngon_normal(MPoly *mpoly, MLoop *loopstart, } } -void mesh_calc_poly_normal(MPoly *mpoly, MLoop *loopstart, - MVert *mvarray, float no[3]) +void BKE_mesh_calc_poly_normal(MPoly *mpoly, MLoop *loopstart, + MVert *mvarray, float no[3]) { if (mpoly->totloop > 4) { mesh_calc_ngon_normal(mpoly, loopstart, mvarray, no); @@ -3016,7 +3016,7 @@ void BKE_mesh_calc_poly_center(MPoly *mpoly, MLoop *loopstart, /* note, passing polynormal is only a speedup so we can skip calculating it */ float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart, - MVert *mvarray, float polynormal[3]) + MVert *mvarray, const float polynormal[3]) { if (mpoly->totloop == 3) { return area_tri_v3(mvarray[loopstart[0].v].co, @@ -3035,7 +3035,7 @@ float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart, int i; MLoop *l_iter = loopstart; float area, polynorm_local[3], (*vertexcos)[3]; - float *no = polynormal ? polynormal : polynorm_local; + const float *no = polynormal ? polynormal : polynorm_local; BLI_array_fixedstack_declare(vertexcos, BM_NGON_STACK_SIZE, mpoly->totloop, __func__); /* pack vertex cos into an array for area_poly_v3 */ @@ -3045,7 +3045,7 @@ float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart, /* need normal for area_poly_v3 as well */ if (polynormal == NULL) { - mesh_calc_poly_normal(mpoly, loopstart, mvarray, no); + BKE_mesh_calc_poly_normal(mpoly, loopstart, mvarray, polynorm_local); } /* finally calculate the area */ diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 97d4c150b84..386e4163fd2 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -292,11 +292,11 @@ static void movieclip_calc_length(MovieClip *clip) clip->len = framenr + 1; } else { - for (;; ) { + for (;;) { get_sequence_fname(clip, framenr, name); if (!BLI_exists(name)) { - clip->len = framenr + 1; + clip->len = framenr; break; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 6fd7a55dd0a..8b3d7b3d974 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -899,23 +899,44 @@ Object *BKE_object_add(struct Scene *scene, int type) return ob; } -SoftBody *copy_softbody(SoftBody *sb) +SoftBody *copy_softbody(SoftBody *sb, int copy_caches) { SoftBody *sbn; if (sb == NULL) return(NULL); sbn = MEM_dupallocN(sb); - sbn->totspring = sbn->totpoint = 0; - sbn->bpoint = NULL; - sbn->bspring = NULL; + + if (copy_caches == FALSE) { + sbn->totspring = sbn->totpoint = 0; + sbn->bpoint = NULL; + sbn->bspring = NULL; + } + else { + sbn->totspring = sb->totspring; + sbn->totpoint = sb->totpoint; + + if (sbn->bpoint) { + int i; + + sbn->bpoint = MEM_dupallocN(sbn->bpoint); + + for (i = 0; i < sbn->totpoint; i++) { + if (sbn->bpoint[i].springs) + sbn->bpoint[i].springs = MEM_dupallocN(sbn->bpoint[i].springs); + } + } + + if (sb->bspring) + sbn->bspring = MEM_dupallocN(sb->bspring); + } sbn->keys = NULL; sbn->totkey = sbn->totpointkey = 0; sbn->scratch = NULL; - sbn->pointcache = BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches); + sbn->pointcache = BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches, copy_caches); if (sb->effector_weights) sbn->effector_weights = MEM_dupallocN(sb->effector_weights); @@ -988,7 +1009,7 @@ static ParticleSystem *copy_particlesystem(ParticleSystem *psys) psysn->childcachebufs.first = psysn->childcachebufs.last = NULL; psysn->renderdata = NULL; - psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches); + psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches, FALSE); /* XXX - from reading existing code this seems correct but intended usage of * pointcache should /w cloth should be added in 'ParticleSystem' - campbell */ @@ -1049,7 +1070,7 @@ void BKE_object_copy_particlesystems(Object *obn, Object *ob) void BKE_object_copy_softbody(Object *obn, Object *ob) { if (ob->soft) - obn->soft = copy_softbody(ob->soft); + obn->soft = copy_softbody(ob->soft, FALSE); } static void copy_object_pose(Object *obn, Object *ob) @@ -1130,7 +1151,7 @@ void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src) copy_v3_v3(ob_tar->size, ob_src->size); } -Object *BKE_object_copy(Object *ob) +static Object *object_copy_do(Object *ob, int copy_caches) { Object *obn; ModifierData *md; @@ -1191,7 +1212,7 @@ Object *BKE_object_copy(Object *ob) if (obn->pd->rng) obn->pd->rng = MEM_dupallocN(ob->pd->rng); } - obn->soft = copy_softbody(ob->soft); + obn->soft = copy_softbody(ob->soft, copy_caches); obn->bsoft = copy_bulletsoftbody(ob->bsoft); BKE_object_copy_particlesystems(obn, ob); @@ -1207,6 +1228,18 @@ Object *BKE_object_copy(Object *ob) return obn; } +/* copy objects, will re-initialize cached simulation data */ +Object *BKE_object_copy(Object *ob) +{ + return object_copy_do(ob, FALSE); +} + +/* copy objects, will duplicate cached simulation data */ +Object *BKE_object_copy_with_caches(Object *ob) +{ + return object_copy_do(ob, TRUE); +} + static void extern_local_object(Object *ob) { ParticleSystem *psys; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 3267253e744..5a302cba2ab 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -190,7 +190,7 @@ void BKE_paint_free(Paint *paint) } /* called when copying scene settings, so even if 'src' and 'tar' are the same - * still do a id_us_plus(), rather then if we were copying betweem 2 existing + * still do a id_us_plus(), rather then if we were copying between 2 existing * scenes where a matching value should decrease the existing user count as * with paint_brush_set() */ void BKE_paint_copy(Paint *src, Paint *tar) diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index ef03db7ed8f..e8af794eaea 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -116,7 +116,7 @@ int count_particles_mod(ParticleSystem *psys, int totgr, int cur) } return tot; } -/* we allocate path cache memory in chunks instead of a big continguous +/* we allocate path cache memory in chunks instead of a big contiguous * chunk, windows' memory allocater fails to find big blocks of memory often */ #define PATH_CACHE_BUF_SIZE 1024 @@ -3776,7 +3776,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink = ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.f; - ptex->length = 1.0f - part->randlength *PSYS_FRAND(child_index + 26); + ptex->length = 1.0f - part->randlength * PSYS_FRAND(child_index + 26); ptex->length *= part->clength_thres < PSYS_FRAND(child_index + 27) ? part->clength : 1.0f; for (m = 0; m < MAX_MTEX; m++, mtexp++) { @@ -3968,7 +3968,7 @@ float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED size *= part->childsize; if (part->childrandsize != 0.0f) - size *= 1.0f - part->childrandsize *PSYS_FRAND(cpa - psys->child + 26); + size *= 1.0f - part->childrandsize * PSYS_FRAND(cpa - psys->child + 26); return size; } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 2c0452bc2d1..154c8cca75d 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -797,8 +797,10 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch } else { ctx->jitoff[i] = fmod(ctx->jitoff[i],(float)ctx->jitlevel); - psys_uv_to_w(ctx->jit[2*(int)ctx->jitoff[i]], ctx->jit[2*(int)ctx->jitoff[i]+1], mface->v4, pa->fuv); - ctx->jitoff[i]++; + if (!isnan(ctx->jitoff[i])) { + psys_uv_to_w(ctx->jit[2*(int)ctx->jitoff[i]], ctx->jit[2*(int)ctx->jitoff[i]+1], mface->v4, pa->fuv); + ctx->jitoff[i]++; + } } break; case PART_DISTR_RAND: @@ -3775,7 +3777,7 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)) /* Calculate the speed of the particle relative to the local scale of the * simulation. This should be called once per particle during a simulation * step, after the velocity has been updated. element_size defines the scale of - * the simulation, and is typically the distance to neighbourning particles. */ + * the simulation, and is typically the distance to neighboring particles. */ static void update_courant_num(ParticleSimulationData *sim, ParticleData *pa, float dtime, SPHData *sphdata) { diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 780528f4a0d..0d01bb33fc5 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2663,32 +2663,59 @@ void BKE_ptcache_free_list(ListBase *ptcaches) } } -static PointCache *ptcache_copy(PointCache *cache) +static PointCache *ptcache_copy(PointCache *cache, int copy_data) { PointCache *ncache; ncache= MEM_dupallocN(cache); - /* hmm, should these be copied over instead? */ ncache->mem_cache.first = NULL; ncache->mem_cache.last = NULL; - ncache->cached_frames = NULL; - ncache->edit = NULL; - ncache->flag= 0; - ncache->simframe= 0; + if (copy_data == FALSE) { + ncache->mem_cache.first = NULL; + ncache->mem_cache.last = NULL; + ncache->cached_frames = NULL; + + ncache->flag= 0; + ncache->simframe= 0; + } + else { + PTCacheMem *pm; + + for (pm = cache->mem_cache.first; pm; pm = pm->next) { + PTCacheMem *pmn = MEM_dupallocN(pm); + int i; + + for (i = 0; i < BPHYS_TOT_DATA; i++) { + if (pmn->data[i]) + pmn->data[i] = MEM_dupallocN(pm->data[i]); + } + + BKE_ptcache_mem_pointers_init(pm); + + BLI_addtail(&ncache->mem_cache, pmn); + } + + if (ncache->cached_frames) + ncache->cached_frames = MEM_dupallocN(cache->cached_frames); + } + + /* hmm, should these be copied over instead? */ + ncache->edit = NULL; return ncache; } + /* returns first point cache */ -PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old) +PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old, int copy_data) { PointCache *cache = ptcaches_old->first; ptcaches_new->first = ptcaches_new->last = NULL; for (; cache; cache=cache->next) - BLI_addtail(ptcaches_new, ptcache_copy(cache)); + BLI_addtail(ptcaches_new, ptcache_copy(cache, copy_data)); return ptcaches_new->first; } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 0c0396ea758..4b91943f740 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -390,7 +390,7 @@ Scene *BKE_scene_add(const char *name) sce->r.edgeint = 10; sce->r.ocres = 128; - /* OCIO_TODO: for forwards compatibiliy only, so if no tonecurve are used, + /* OCIO_TODO: for forwards compatibility only, so if no tonecurve are used, * images would look in the same way as in current blender * * perhaps at some point should be completely deprecated? @@ -1274,9 +1274,11 @@ void BKE_scene_disable_color_management(Scene *scene) ColorManagedDisplaySettings *display_settings = &scene->display_settings; ColorManagedViewSettings *view_settings = &scene->view_settings; const char *view; + const char *none_display_name; - /* NOTE: None display with Default view should always exist in OCIO configuration, otherwise it wouldn't work as expected */ - BLI_strncpy(display_settings->display_device, "None", sizeof(display_settings->display_device)); + none_display_name = IMB_colormanagement_display_get_none_name(); + + BLI_strncpy(display_settings->display_device, none_display_name, sizeof(display_settings->display_device)); view = IMB_colormanagement_view_get_default_name(display_settings->display_device); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 8d7ca94ed48..bb845400cef 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -313,7 +313,7 @@ void BKE_sequencer_editing_free(Scene *scene) static void sequencer_imbuf_assign_spaces(Scene *scene, ImBuf *ibuf) { - IMB_colormanagement_imbuf_assign_float_space(ibuf, &scene->sequencer_colorspace_settings); + IMB_colormanagement_assign_float_colorspace(ibuf, scene->sequencer_colorspace_settings.name); } void BKE_sequencer_imbuf_to_sequencer_space(Scene *scene, ImBuf *ibuf, int make_float) @@ -1835,8 +1835,6 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra, StripCrop c = {0}; StripTransform t = {0}; int sx, sy, dx, dy; - double xscale = 1.0; - double yscale = 1.0; if (is_proxy_image) { double f = seq_rendersize_to_scale_factor(context.preview_render_size); @@ -1853,14 +1851,6 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra, t = *seq->strip->transform; } - xscale = context.scene->r.xsch ? ((double) context.rectx / (double) context.scene->r.xsch) : 1.0; - yscale = context.scene->r.ysch ? ((double) context.recty / (double) context.scene->r.ysch) : 1.0; - - c.left *= xscale; c.right *= xscale; - c.top *= yscale; c.bottom *= yscale; - - t.xofs *= xscale; t.yofs *= yscale; - sx = ibuf->x - c.left - c.right; sy = ibuf->y - c.top - c.bottom; dx = sx; @@ -2186,7 +2176,7 @@ static ImBuf *seq_render_movieclip_strip(SeqRenderData context, Sequence *seq, f memset(&user, 0, sizeof(MovieClipUser)); - BKE_movieclip_user_set_frame(&user, nr + seq->anim_startofs); + BKE_movieclip_user_set_frame(&user, nr + seq->anim_startofs + seq->clip->start_frame); user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL; @@ -2583,17 +2573,19 @@ static ImBuf *do_render_strip_uncached(SeqRenderData context, Sequence *seq, flo case SEQ_TYPE_MOVIECLIP: { ibuf = seq_render_movieclip_strip(context, seq, nr); - sequencer_imbuf_assign_spaces(context.scene, ibuf); - if (ibuf && use_preprocess) { + if (ibuf) { + /* duplicate frame so movie cache wouldn't be confused by sequencer's stuff */ ImBuf *i = IMB_dupImBuf(ibuf); - IMB_freeImBuf(ibuf); - ibuf = i; + + if (ibuf->rect_float) + BKE_sequencer_imbuf_to_sequencer_space(context.scene, ibuf, FALSE); + + copy_to_ibuf_still(context, seq, nr, ibuf); } - copy_to_ibuf_still(context, seq, nr, ibuf); break; } diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 4c28fe01895..f47c931e309 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -151,7 +151,7 @@ typedef struct SB_thread_context { #define SOFTGOALSNAP 0.999f /* if bp-> goal is above make it a *forced follow original* and skip all ODE stuff for this bp - * removes *unnecessary* stiffnes from ODE system + * removes *unnecessary* stiffness from ODE system */ #define HEUNWARNLIMIT 1 /* 500 would be fine i think for detecting severe *stiff* stuff */ @@ -3925,7 +3925,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime) sst=PIL_check_seconds_timer(); /* Integration back in time is possible in theory, but pretty useless here. - * So we refuse to do so. Since we do not know anything about 'outside' canges + * So we refuse to do so. Since we do not know anything about 'outside' changes * especially colliders we refuse to go more than 10 frames. */ if (dtime < 0 || dtime > 10.5f) return; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 1f1d609ae42..05d0705107d 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -48,6 +48,7 @@ #include "DNA_constraint_types.h" #include "DNA_controller_types.h" +#include "DNA_actuator_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" @@ -528,6 +529,7 @@ void BKE_text_unlink(Main *bmain, Text *text) SpaceLink *sl; Object *ob; bController *cont; + bActuator *act; bConstraint *con; short update; @@ -541,6 +543,15 @@ void BKE_text_unlink(Main *bmain, Text *text) if (pc->text == text) pc->text = NULL; } } + /* game actuators */ + for (act = ob->actuators.first; act; act = act->next) { + if (act->type == ACT_2DFILTER) { + bTwoDFilterActuator *tfa; + + tfa = act->data; + if (tfa->text == text) tfa->text = NULL; + } + } /* pyconstraints */ update = 0; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 337f1b5d248..c9d7ec3964f 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -335,7 +335,7 @@ static void search_pixel_to_marker_unified(int frame_width, int frame_height, } /* Each marker has 5 coordinates associated with it that get warped with - * tracking: the four corners ("pattern_corners"), and the cernter ("pos"). + * tracking: the four corners ("pattern_corners"), and the center ("pos"). * This function puts those 5 points into the appropriate frame for tracking * (the "search" coordinate frame). */ @@ -455,7 +455,7 @@ void BKE_tracking_clipboard_paste_tracks(MovieTracking *tracking, MovieTrackingO /*********************** Tracks *************************/ -static void tracking_marker_insert_disabled(MovieTrackingTrack *track, MovieTrackingMarker *ref_marker, +static void tracking_marker_insert_disabled(MovieTrackingTrack *track, const MovieTrackingMarker *ref_marker, int before, int overwrite) { MovieTrackingMarker marker_new; @@ -2400,7 +2400,7 @@ static void tracking_insert_new_marker(MovieTrackingContext *context, MovieTrack * if so -- create disabled marker before currently tracking "segment" */ - tracking_marker_insert_disabled(track, &new_marker, !context->backwards, FALSE); + tracking_marker_insert_disabled(track, old_marker, !context->backwards, FALSE); } /* insert currently tracked marker */ diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index da5e7ff3db7..46836b1f8d1 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -350,7 +350,7 @@ static int unit_as_string(char *str, int len_max, double value, int prec, bUnitC /* Add unit prefix and strip zeros */ /* replace trailing zero's with spaces - * so the number is less complicated but allignment in a button wont + * so the number is less complicated but alignment in a button wont * jump about while dragging */ i = len - 1; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 4019eba5177..ff1fdebb728 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -839,7 +839,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report * inter-frames (H.264 B-frames, for example), it can output the frames * in a different order from the one it was given. * For example, when sending frames 1, 2, 3, 4 to the encoder, it may write - * them in the order 1, 4, 2, 3 - first the two frames used for predition, + * them in the order 1, 4, 2, 3 - first the two frames used for prediction, * and then the bidirectionally-predicted frames. What this means in practice * is that the encoder may not immediately produce one output frame for each * input frame. These delayed frames must be flushed before we close the @@ -914,8 +914,7 @@ void BKE_ffmpeg_filepath_get(char *string, RenderData *rd) } while (*fe) { - if (BLI_strcasecmp(string + strlen(string) - strlen(*fe), *fe) == 0) - { + if (BLI_strcasecmp(string + strlen(string) - strlen(*fe), *fe) == 0) { break; } fe++; |