diff options
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 18 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/multires.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 85 |
7 files changed, 124 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 2880473dd37..e1d9f6169da 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1027,15 +1027,29 @@ static void add_weight_mcol_dm(Object *ob, DerivedMesh *dm, int const draw_flag) MPoly *mp = dm->getPolyArray(dm); int i, j, totface=dm->getNumTessFaces(dm), totloop; int *origIndex = dm->getVertDataArray(dm, CD_ORIGINDEX); + unsigned char *wtcol_f_step = wtcol_f; wtcol_f = MEM_mallocN(sizeof (unsigned char) * totface*4*4, "weightmap_f"); /*first add colors to the tesselation faces*/ - for (i=0; i<totface; i++, mf++) { + for (i=0; i<totface; i++, mf++, wtcol_f_step += (4 * 4)) { /*origindex being NULL means we're operating on original mesh data*/ +#if 0 unsigned int fidx= mf->v4 ? 3:2; + +#else /* better zero out triangles 4th component. else valgrind complains when the buffer's copied */ + unsigned int fidx; + if (mf->v4) { + fidx = 3; + } + else { + fidx = 2; + *(int *)(&wtcol_f_step[3 * 4]) = 0; + } +#endif + do { - copy_v4_v4_char((char *)&wtcol_f[(4 * i + fidx) * 4], + copy_v4_v4_char((char *)&wtcol_f_step[fidx * 4], (char *)&wtcol_v[4 * (*(&mf->v1 + fidx))]); } while (fidx--); } diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index bd11625bf6e..4e122ec0f11 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -48,7 +48,6 @@ #include "BKE_modifier.h" #include "BKE_pointcache.h" - #ifdef _WIN32 void tstart ( void ) {} @@ -378,6 +377,8 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul } implicit_set_positions(clmd); + + clmd->clothObject->last_frame= MINFRAME-1; } return 1; @@ -478,6 +479,8 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, do_step_cloth(ob, clmd, dm, framenr); cloth_to_object(ob, clmd, result); + clmd->clothObject->last_frame= framenr; + return result; } @@ -499,6 +502,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, do_init_cloth(ob, clmd, dm, framenr); BKE_ptcache_validate(cache, framenr); cache->flag &= ~PTCACHE_REDO_NEEDED; + clmd->clothObject->last_frame= framenr; return result; } @@ -514,6 +518,8 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED) BKE_ptcache_write(&pid, framenr); + clmd->clothObject->last_frame= framenr; + return result; } else if(cache_result==PTCACHE_READ_OLD) { @@ -525,6 +531,9 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, return result; } + if(framenr!=clmd->clothObject->last_frame+1) + return result; + /* if on second frame, write cache for first frame */ if(cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) BKE_ptcache_write(&pid, startframe); @@ -541,6 +550,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, BKE_ptcache_write(&pid, framenr); cloth_to_object (ob, clmd, result); + clmd->clothObject->last_frame= framenr; return result; } diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 4c78ab13874..33a6782244b 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -861,7 +861,7 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip } /* NOTE: margin should be kept in sync with value from ui_draw_but_TRACKPREVIEW */ - tmpibuf= BKE_tracking_get_pattern_imbuf(ibuf, track, &undist_marker, 2 /* margin */, + tmpibuf= BKE_tracking_get_pattern_imbuf(ibuf, track, &undist_marker, 3 /* margin */, 1 /* anchor */, scopes->track_pos, NULL); if(tmpibuf->rect_float) diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 035c7f409c4..5c13c2c52fe 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1780,7 +1780,7 @@ static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3]) CustomData_external_read(&me->ldata, &me->id, CD_MASK_MDISPS, me->totloop); mdisps= CustomData_get_layer(&me->ldata, CD_MDISPS); - if(!mdisps || !mmd) return; + if(!mdisps || !mmd || !mmd->totlvl) return; /* we need derived mesh created from highest resolution */ high_mmd= *mmd; diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 5253d7a9961..7a4b19915c3 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1839,6 +1839,7 @@ static void registerCompositNodes(bNodeTreeType *ttype) register_node_type_cmp_vecblur(ttype); register_node_type_cmp_dilateerode(ttype); register_node_type_cmp_defocus(ttype); + register_node_type_cmp_doubleedgemask(ttype); register_node_type_cmp_valtorgb(ttype); register_node_type_cmp_rgbtobw(ttype); @@ -1945,6 +1946,7 @@ static void registerShaderNodes(bNodeTreeType *ttype) register_node_type_sh_tex_musgrave(ttype); register_node_type_sh_tex_gradient(ttype); register_node_type_sh_tex_magic(ttype); + register_node_type_sh_tex_checker(ttype); } static void registerTextureNodes(bNodeTreeType *ttype) diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index cab621eeff7..8d20a06d009 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -3728,6 +3728,8 @@ SoftBody *sbNew(Scene *scene) if(!sb->effector_weights) sb->effector_weights = BKE_add_effector_weights(NULL); + sb->last_frame= MINFRAME-1; + return sb; } @@ -4108,6 +4110,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i softbody_update_positions(ob, sb, vertexCos, numVerts); softbody_step(scene, ob, sb, dtime); softbody_to_object(ob, vertexCos, numVerts, 0); + sb->last_frame = framenr; return; } @@ -4123,6 +4126,9 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i BKE_ptcache_validate(cache, framenr); cache->flag &= ~PTCACHE_REDO_NEEDED; + + sb->last_frame = framenr; + return; } @@ -4137,6 +4143,8 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED) BKE_ptcache_write(&pid, framenr); + sb->last_frame = framenr; + return; } else if(cache_result==PTCACHE_READ_OLD) { @@ -4148,6 +4156,9 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i return; } + if(framenr!=sb->last_frame+1) + return; + /* if on second frame, write cache for first frame */ if(cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) BKE_ptcache_write(&pid, startframe); @@ -4164,5 +4175,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i BKE_ptcache_validate(cache, framenr); BKE_ptcache_write(&pid, framenr); + + sb->last_frame = framenr; } diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index ff76fc14755..e55f4dfbf78 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -70,6 +70,10 @@ typedef struct MovieDistortion { struct libmv_CameraIntrinsics *intrinsics; } MovieDistortion; +static struct { + ListBase tracks; +} tracking_clipboard; + /*********************** common functions *************************/ void BKE_tracking_init_settings(MovieTracking *tracking) @@ -261,7 +265,7 @@ MovieTrackingTrack *BKE_tracking_add_track(MovieTracking *tracking, ListBase *tr return track; } -void BKE_tracking_insert_marker(MovieTrackingTrack *track, MovieTrackingMarker *marker) +MovieTrackingMarker *BKE_tracking_insert_marker(MovieTrackingTrack *track, MovieTrackingMarker *marker) { MovieTrackingMarker *old_marker= NULL; @@ -270,6 +274,8 @@ void BKE_tracking_insert_marker(MovieTrackingTrack *track, MovieTrackingMarker * if(old_marker) { *old_marker= *marker; + + return old_marker; } else { int a= track->markersnr; @@ -287,6 +293,8 @@ void BKE_tracking_insert_marker(MovieTrackingTrack *track, MovieTrackingMarker * track->markers[a+1]= *marker; track->last_marker= a+1; + + return &track->markers[a+1]; } } @@ -574,6 +582,72 @@ void BKE_tracking_free(MovieTracking *tracking) BKE_tracking_distortion_destroy(tracking->camera.intrinsics); } +static MovieTrackingTrack *duplicate_track(MovieTrackingTrack *track) +{ + MovieTrackingTrack *new_track; + + new_track = MEM_callocN(sizeof(MovieTrackingTrack), "tracksMapMerge new_track"); + + *new_track= *track; + new_track->next = new_track->prev = NULL; + + new_track->markers = MEM_dupallocN(new_track->markers); + + return new_track; +} + +/*********************** clipboard *************************/ + +void BKE_tracking_free_clipboard(void) +{ + MovieTrackingTrack *track = tracking_clipboard.tracks.first, *next_track; + + while (track) { + next_track = track->next; + + BKE_tracking_free_track(track); + MEM_freeN(track); + + track = next_track; + } +} + +void BKE_tracking_clipboard_copy_tracks(MovieTracking *tracking, MovieTrackingObject *object) +{ + ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object); + MovieTrackingTrack *track = tracksbase->first; + + while (track) { + if (TRACK_SELECTED(track)) { + MovieTrackingTrack *new_track = duplicate_track(track); + + BLI_addtail(&tracking_clipboard.tracks, new_track); + } + + track = track->next; + } +} + +int BKE_tracking_clipboard_has_tracks(void) +{ + return tracking_clipboard.tracks.first != NULL; +} + +void BKE_tracking_clipboard_paste_tracks(MovieTracking *tracking, MovieTrackingObject *object) +{ + ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object); + MovieTrackingTrack *track = tracking_clipboard.tracks.first; + + while (track) { + MovieTrackingTrack *new_track = duplicate_track(track); + + BLI_addtail(tracksbase, new_track); + BKE_track_unique_name(tracksbase, new_track); + + track = track->next; + } +} + /*********************** tracks map *************************/ typedef struct TracksMap { @@ -696,9 +770,7 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking) } } - new_track= MEM_callocN(sizeof(MovieTrackingTrack), "tracksMapMerge new_track"); - *new_track= *track; - new_track->markers= MEM_dupallocN(new_track->markers); + new_track= duplicate_track(track); BLI_ghash_remove(map->hash, track, NULL, NULL); /* XXX: are we actually need this */ BLI_ghash_insert(map->hash, track, new_track); @@ -992,7 +1064,7 @@ static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTracki { ImBuf *tmpibuf; int x, y; - int x1, y1, x2, y2, w, h; + int x1, y1 /*, x2, y2 */ /* UNUSED */, w, h; float mpos[2]; copy_v2_v2(mpos, marker->pos); @@ -1013,8 +1085,11 @@ static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTracki x1= x-(int)(w/2.0f); y1= y-(int)(h/2.0f); + +#if 0 /* UNUSED */ x2= x+(int)(w/2.0f); y2= y+(int)(h/2.0f); +#endif /* dimensions should be odd */ tmpibuf= IMB_allocImBuf(w+margin*2, h+margin*2, 32, IB_rect); |