diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-06 23:11:06 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-06 23:11:06 +0400 |
commit | 286c5915b35f3008030cd89899be0d714bd30ada (patch) | |
tree | 8ae11c6876a26ec92bc7262e6fd5ab55ce5cd100 /source/blender/blenkernel/intern | |
parent | 870ba8aa13c87fdeb1724d0f3ad7b7a4b53a4d32 (diff) | |
parent | f43a733f591377f2cdce0555443dba003c05fd30 (diff) |
Merging r47507 through r47534 from trunk into soc-2011-tomato
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/collision.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/editderivedmesh.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 39 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/navmesh_conversion.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 12 |
9 files changed, 73 insertions, 39 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index e067b7195ce..b681426f8a7 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -143,6 +143,7 @@ void cloth_init(ClothModifierData *clmd ) clmd->coll_parms->collision_list = NULL; clmd->coll_parms->self_loop_count = 1.0; clmd->coll_parms->selfepsilon = 0.75; + clmd->coll_parms->vgroup_selfcol = 0; /* These defaults are copied from softbody.c's * softbody_calc_forces() function. @@ -756,10 +757,12 @@ static void cloth_to_object (Object *ob, ClothModifierData *clmd, float (*verte int cloth_uses_vgroup(ClothModifierData *clmd) { return (((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) || - (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )) && + (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL ) || + (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF)) && ((clmd->sim_parms->vgroup_mass>0) || (clmd->sim_parms->vgroup_struct>0)|| - (clmd->sim_parms->vgroup_bend>0))); + (clmd->sim_parms->vgroup_bend>0) || + (clmd->coll_parms->vgroup_selfcol>0))); } /** @@ -815,6 +818,13 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm ) verts->bend_stiff = dvert->dw [j].weight; } } + + if (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF ) { + if ( dvert->dw[j].def_nr == (clmd->coll_parms->vgroup_selfcol-1)) { + if( dvert->dw [j].weight > 0.0) + verts->flags |= CLOTH_VERT_FLAG_NOSELFCOLL; + } + } /* // for later if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_weight-1)) diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 32e9dd7508b..44f524304d2 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -840,6 +840,10 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData * clmd, float step, flo continue; } } + + if( ( cloth->verts[i].flags & CLOTH_VERT_FLAG_NOSELFCOLL ) || + ( cloth->verts[j].flags & CLOTH_VERT_FLAG_NOSELFCOLL ) ) + continue; sub_v3_v3v3(temp, verts[i].tx, verts[j].tx); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index c6a0ecc057a..afd50de8159 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3897,6 +3897,7 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase MovieTrackingTrack *track; MovieTrackingObject *tracking_object; Object *camob = data->camera ? data->camera : scene->camera; + int framenr; if (data->flag & FOLLOWTRACK_ACTIVECLIP) clip = scene->clip; @@ -3919,6 +3920,8 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase if (!track) return; + framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, scene->r.cfra); + if (data->flag & FOLLOWTRACK_USE_3D_POSITION) { if (track->flag & TRACK_HAS_BUNDLE) { float obmat[4][4], mat[4][4]; @@ -3930,7 +3933,7 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase copy_m4_m4(mat, camob->obmat); - BKE_tracking_get_interpolated_camera(tracking, tracking_object, scene->r.cfra, imat); + BKE_tracking_get_interpolated_camera(tracking, tracking_object, framenr, imat); invert_m4(imat); mul_serie_m4(cob->matrix, obmat, mat, imat, NULL, NULL, NULL, NULL, NULL); @@ -3969,7 +3972,7 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase CameraParams params; float pos[2], rmat[4][4]; - marker = BKE_tracking_get_marker(track, scene->r.cfra); + marker = BKE_tracking_get_marker(track, framenr); add_v2_v2v2(pos, marker->pos, track->offset); @@ -4092,8 +4095,9 @@ static void camerasolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase float mat[4][4], obmat[4][4]; MovieTracking *tracking = &clip->tracking; MovieTrackingObject *object = BKE_tracking_get_camera_object(tracking); + int framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, scene->r.cfra); - BKE_tracking_get_interpolated_camera(tracking, object, scene->r.cfra, mat); + BKE_tracking_get_interpolated_camera(tracking, object, framenr, mat); copy_m4_m4(obmat, cob->matrix); @@ -4156,10 +4160,11 @@ static void objectsolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase if (object) { float mat[4][4], obmat[4][4], imat[4][4], cammat[4][4], camimat[4][4], parmat[4][4]; + int framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, scene->r.cfra); BKE_object_where_is_calc_mat4(scene, camob, cammat); - BKE_tracking_get_interpolated_camera(tracking, object, scene->r.cfra, mat); + BKE_tracking_get_interpolated_camera(tracking, object, framenr, mat); invert_m4_m4(camimat, cammat); mult_m4_m4m4(parmat, cammat, data->invmat); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 53bc9c4cb7e..a1e67ebd414 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -54,6 +54,7 @@ #include "DNA_screen_types.h" #include "DNA_windowmanager_types.h" #include "DNA_movieclip_types.h" +#include "DNA_mask_types.h" #include "BKE_animsys.h" #include "BKE_action.h" @@ -2469,6 +2470,15 @@ void DAG_on_visible_update(Main *bmain, const short do_time) /* hack to get objects updating on layer changes */ DAG_id_type_tag(bmain, ID_OB); + + /* so masks update on load */ + if (bmain->mask.first) { + Mask *mask; + + for (mask = bmain->mask.first; mask; mask = mask->id.next) { + DAG_id_tag_update(&mask->id, 0); + } + } } static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUSED(ob), ID **idpoin) diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 335758fec11..32c6caffff7 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -1697,8 +1697,8 @@ DerivedMesh *getEditDerivedBMesh(BMEditMesh *em, BM_ITER_MESH_INDEX (eve, &iter, bmdm->tc->bm, BM_VERTS_OF_MESH, i) { DM_set_vert_data(&bmdm->dm, i, CD_MVERT_SKIN, - CustomData_bmesh_get(&bm->vdata, eve->head.data, - CD_MVERT_SKIN)); + CustomData_bmesh_get(&bm->vdata, eve->head.data, + CD_MVERT_SKIN)); } } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 5db565d343c..ed93f27fe5c 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -2041,8 +2041,8 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh) void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData *ldata, CustomData *pdata, int totedge_i, int totface_i, int totloop_i, int totpoly_i, MEdge *medge, MFace *mface, - int *totloop_r, int *totpoly_r, - MLoop **mloop_r, MPoly **mpoly_r) + int *totloop_r, int *totpoly_r, + MLoop **mloop_r, MPoly **mpoly_r) { MFace *mf; MLoop *ml, *mloop; diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 22eae912967..8d67d3bd02d 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -153,18 +153,13 @@ static void get_sequence_fname(MovieClip *clip, int framenr, char *name) BLI_strncpy(name, clip->name, sizeof(clip->name)); BLI_stringdec(name, head, tail, &numlen); - if (clip->flag & MCLIP_CUSTOM_START_FRAME) { - offset = clip->start_frame; - } - else { - /* movieclips always points to first image from sequence, - * autoguess offset for now. could be something smarter in the future - */ - offset = sequence_guess_offset(clip->name, strlen(head), numlen); - } + /* movieclips always points to first image from sequence, + * autoguess offset for now. could be something smarter in the future + */ + offset = sequence_guess_offset(clip->name, strlen(head), numlen); if (numlen) - BLI_stringenc(name, head, tail, numlen, offset + framenr - 1); + BLI_stringenc(name, head, tail, numlen, offset + framenr - clip->start_frame); else BLI_strncpy(name, clip->name, sizeof(clip->name)); @@ -176,6 +171,7 @@ static void get_proxy_fname(MovieClip *clip, int proxy_render_size, int undistor { int size = rendersize_to_number(proxy_render_size); char dir[FILE_MAX], clipdir[FILE_MAX], clipfile[FILE_MAX]; + int proxynr = framenr - clip->start_frame + 1; BLI_split_dirfile(clip->name, clipdir, clipfile, FILE_MAX, FILE_MAX); @@ -187,9 +183,9 @@ static void get_proxy_fname(MovieClip *clip, int proxy_render_size, int undistor } if (undistorted) - BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d_undistorted/%08d", dir, clipfile, size, framenr); + BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d_undistorted/%08d", dir, clipfile, size, proxynr); else - BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d/%08d", dir, clipfile, size, framenr); + BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d/%08d", dir, clipfile, size, proxynr); BLI_path_abs(name, G.main->name); BLI_path_frame(name, 1, 0); @@ -254,11 +250,7 @@ static ImBuf *movieclip_load_movie_file(MovieClip *clip, MovieClipUser *user, in int fra; dur = IMB_anim_get_duration(clip->anim, tc); - fra = framenr - 1; - - if (clip->flag & MCLIP_CUSTOM_START_FRAME) { - fra += clip->start_frame - 1; - } + fra = framenr - clip->start_frame; if (fra < 0) fra = 0; @@ -1038,7 +1030,8 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip if (act_track) { MovieTrackingTrack *track = act_track; - MovieTrackingMarker *marker = BKE_tracking_get_marker(track, user->framenr); + int framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, user->framenr); + MovieTrackingMarker *marker = BKE_tracking_get_marker(track, framenr); if (marker->flag & MARKER_DISABLED) { scopes->track_disabled = TRUE; @@ -1238,3 +1231,13 @@ void BKE_movieclip_unlink(Main *bmain, MovieClip *clip) clip->id.us = 0; } + +int BKE_movieclip_remap_scene_to_clip_frame(MovieClip *clip, int framenr) +{ + return framenr - clip->start_frame + 1; +} + +int BKE_movieclip_remap_clip_to_scene_frame(MovieClip *clip, int framenr) +{ + return framenr + clip->start_frame - 1; +} diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c index 24382b3bf91..a21878d1d7d 100644 --- a/source/blender/blenkernel/intern/navmesh_conversion.c +++ b/source/blender/blenkernel/intern/navmesh_conversion.c @@ -307,15 +307,15 @@ struct SortContext static int compareByData(void *ctx, const void * a, const void * b) { return (((struct SortContext *)ctx)->recastData[((struct SortContext *)ctx)->trisToFacesMap[*(int*)a]] - - ((struct SortContext *)ctx)->recastData[((struct SortContext *)ctx)->trisToFacesMap[*(int*)b]] ); + ((struct SortContext *)ctx)->recastData[((struct SortContext *)ctx)->trisToFacesMap[*(int*)b]] ); } int buildNavMeshData(const int nverts, const float* verts, - const int ntris, const unsigned short *tris, - const int* recastData, const int* trisToFacesMap, - int *ndtris_r, unsigned short **dtris_r, - int *npolys_r, unsigned short **dmeshes_r, unsigned short **polys_r, - int *vertsPerPoly_r, int **dtrisToPolysMap_r, int **dtrisToTrisMap_r) + const int ntris, const unsigned short *tris, + const int* recastData, const int* trisToFacesMap, + int *ndtris_r, unsigned short **dtris_r, + int *npolys_r, unsigned short **dmeshes_r, unsigned short **polys_r, + int *vertsPerPoly_r, int **dtrisToPolysMap_r, int **dtrisToTrisMap_r) { int *trisMapping; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 8f181311a6f..a8a0d8f67cf 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1025,7 +1025,8 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u track = tracksbase->first; while (track) { if (TRACK_SELECTED(track) && (track->flag & (TRACK_LOCKED | TRACK_HIDDEN)) == 0) { - MovieTrackingMarker *marker = BKE_tracking_get_marker(track, user->framenr); + int framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, user->framenr); + MovieTrackingMarker *marker = BKE_tracking_get_marker(track, framenr); if ((marker->flag & MARKER_DISABLED) == 0) num_tracks++; @@ -1046,7 +1047,8 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u track = tracksbase->first; while (track) { if (TRACK_SELECTED(track) && (track->flag & (TRACK_HIDDEN | TRACK_LOCKED)) == 0) { - MovieTrackingMarker *marker = BKE_tracking_get_marker(track, user->framenr); + int framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, user->framenr); + MovieTrackingMarker *marker = BKE_tracking_get_marker(track, framenr); if ((marker->flag & MARKER_DISABLED) == 0) { TrackContext track_context; @@ -1540,7 +1542,7 @@ static ImBuf *get_frame_ibuf(MovieTrackingContext *context, int framenr) ImBuf *ibuf; MovieClipUser user = context->user; - user.framenr = framenr; + user.framenr = BKE_movieclip_remap_clip_to_scene_frame(context->clip, framenr); ibuf = BKE_movieclip_get_ibuf_flag(context->clip, &user, context->clip_flag, MOVIECLIP_CACHE_SKIP); @@ -1628,7 +1630,7 @@ void BKE_tracking_sync_user(MovieClipUser *user, MovieTrackingContext *context) int BKE_tracking_next(MovieTrackingContext *context) { ImBuf *destination_ibuf; - int curfra = context->user.framenr; + int curfra = BKE_movieclip_remap_scene_to_clip_frame(context->clip, context->user.framenr); int a, ok = FALSE, map_size; map_size = tracks_map_size(context->tracks_map); @@ -1784,7 +1786,7 @@ int BKE_tracking_next(MovieTrackingContext *context) marker_new.framenr = nextfra; marker_new.flag |= MARKER_DISABLED; - #pragma omp critical + //#pragma omp critical { BKE_tracking_insert_marker(track, &marker_new); } |