diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-28 01:18:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-28 01:18:59 +0400 |
commit | 3bccd1ffed919d160320e17bf87c5acbefc1e9b9 (patch) | |
tree | 30fafda6975b75080ab8d4511926a9b5a78d4c51 | |
parent | aad88b560b55e89472364c1f158900a4cc985c03 (diff) | |
parent | 1ca7c2e4f3b8dd224782f5c05333fd327d7bc3b3 (diff) |
svn merge ^/trunk/blender -r42182:42194
-rw-r--r-- | build_files/buildbot/config/user-config-i686.py | 4 | ||||
-rw-r--r-- | build_files/buildbot/config/user-config-player-i686.py | 4 | ||||
-rw-r--r-- | build_files/buildbot/config/user-config-player-x86_64.py | 4 | ||||
-rw-r--r-- | build_files/buildbot/config/user-config-x86_64.py | 4 | ||||
-rw-r--r-- | intern/cycles/blender/addon/__init__.py | 7 | ||||
-rw-r--r-- | intern/cycles/blender/addon/engine.py | 2 | ||||
-rw-r--r-- | intern/cycles/blender/addon/enums.py | 2 | ||||
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 2 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 18 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_tracking.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 357 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_mempool.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_mempool.c | 23 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 4 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 7 |
17 files changed, 268 insertions, 187 deletions
diff --git a/build_files/buildbot/config/user-config-i686.py b/build_files/buildbot/config/user-config-i686.py index 99af7f3fa04..34817ed0ae9 100644 --- a/build_files/buildbot/config/user-config-i686.py +++ b/build_files/buildbot/config/user-config-i686.py @@ -58,6 +58,8 @@ WITH_BF_PNG = True BF_PNG_LIB = 'libpng' BF_PNG_LIBPATH = '/home/sources/staticlibs/lib32' +WITH_BF_STATICLIBSAMPLERATE = True + WITH_BF_ZLIB = True WITH_BF_STATICZLIB = True BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a' @@ -114,5 +116,5 @@ WITH_BF_OCEANSIM = True # Compilation and optimization BF_DEBUG = False -REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++ +REL_CCFLAGS = ['-O2'] # C & C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32'] diff --git a/build_files/buildbot/config/user-config-player-i686.py b/build_files/buildbot/config/user-config-player-i686.py index 3445ae59bda..6c5c5f89ad4 100644 --- a/build_files/buildbot/config/user-config-player-i686.py +++ b/build_files/buildbot/config/user-config-player-i686.py @@ -52,6 +52,8 @@ WITH_BF_PNG = True BF_PNG_LIB = 'libpng' BF_PNG_LIBPATH = '/home/sources/staticlibs/lib32' +WITH_BF_STATICLIBSAMPLERATE = True + WITH_BF_ZLIB = True WITH_BF_STATICZLIB = True BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a' @@ -93,5 +95,5 @@ WITH_BF_OCEANSIM = True # Compilation and optimization BF_DEBUG = False -REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++ +REL_CCFLAGS = ['-O2'] # C & C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32'] diff --git a/build_files/buildbot/config/user-config-player-x86_64.py b/build_files/buildbot/config/user-config-player-x86_64.py index 6ec56865c26..ad3839a2434 100644 --- a/build_files/buildbot/config/user-config-player-x86_64.py +++ b/build_files/buildbot/config/user-config-player-x86_64.py @@ -48,6 +48,8 @@ WITH_BF_JPEG = True BF_JPEG_LIB = 'libjpeg' BF_JPEG_LIBPATH = '/home/sources/staticlibs/lib64' +WITH_BF_STATICLIBSAMPLERATE = True + WITH_BF_PNG = True BF_PNG_LIB = 'libpng' BF_PNG_LIBPATH = '/home/sources/staticlibs/lib64' @@ -93,5 +95,5 @@ WITH_BF_OCEANSIM = True # Compilation and optimization BF_DEBUG = False -REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++ +REL_CCFLAGS = ['-O2'] # C & C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64'] diff --git a/build_files/buildbot/config/user-config-x86_64.py b/build_files/buildbot/config/user-config-x86_64.py index a607be286f9..e090ddfbfd6 100644 --- a/build_files/buildbot/config/user-config-x86_64.py +++ b/build_files/buildbot/config/user-config-x86_64.py @@ -58,6 +58,8 @@ WITH_BF_PNG = True BF_PNG_LIB = 'libpng' BF_PNG_LIBPATH = '/home/sources/staticlibs/lib64' +WITH_BF_STATICLIBSAMPLERATE = True + WITH_BF_ZLIB = True WITH_BF_STATICZLIB = True BF_ZLIB_LIB_STATIC = '${BF_ZLIB}/lib/libz.a' @@ -114,5 +116,5 @@ WITH_BF_OCEANSIM = True # Compilation and optimization BF_DEBUG = False -REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++ +REL_CCFLAGS = ['-O2'] # C & C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64'] diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py index a7a8a74bf38..34ed3dd8072 100644 --- a/intern/cycles/blender/addon/__init__.py +++ b/intern/cycles/blender/addon/__init__.py @@ -33,12 +33,7 @@ bl_info = { "category": "Render"} import bpy - -from cycles import ui -from cycles import properties -from cycles import xml -from cycles import engine -from cycles import presets +from . import ui, properties, xml, engine, presets class CyclesRender(bpy.types.RenderEngine): diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index a32a9e91499..2fedd2c0afa 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -56,7 +56,7 @@ def free(engine): def render(engine): import bcycles - if "session" in dir(engine): + if hasattr(engine, "session"): bcycles.render(engine.session) diff --git a/intern/cycles/blender/addon/enums.py b/intern/cycles/blender/addon/enums.py index 463fdc19534..581dc08436a 100644 --- a/intern/cycles/blender/addon/enums.py +++ b/intern/cycles/blender/addon/enums.py @@ -18,7 +18,7 @@ # <pep8 compliant> -from cycles import engine +from . import engine def get_gpu_device(): diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 95f898f3ca5..37de27dc6b4 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -27,7 +27,7 @@ from bpy.props import (BoolProperty, import math -from cycles import enums +from . import enums class CyclesRenderSettings(bpy.types.PropertyGroup): diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 224e44c287a..ca733c6eeb0 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -22,8 +22,7 @@ import bpy from bpy.types import Panel, Menu -from cycles import enums -from cycles import engine +from . import enums, engine class CYCLES_MT_integrator_presets(Menu): @@ -324,7 +323,7 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): ob = context.object - return CyclesButtonsPanel.poll(context) and ob and ob.type in ('MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META') # todo: 'LAMP' + return CyclesButtonsPanel.poll(context) and ob and ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META'} # todo: 'LAMP' def draw(self, context): layout = self.layout @@ -399,7 +398,7 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel): split = layout.split() col = split.column(align=True) - if lamp.type in ('POINT', 'SUN', 'SPOT'): + if lamp.type in {'POINT', 'SUN', 'SPOT'}: col.prop(lamp, "shadow_soft_size", text="Size") elif lamp.type == 'AREA': col.prop(lamp, "shape", text="") @@ -460,7 +459,8 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): # world = context.world - return False # world and world.node_tree and CyclesButtonsPanel.poll(context) + # world and world.node_tree and CyclesButtonsPanel.poll(context) + return False def draw(self, context): layout = self.layout @@ -494,7 +494,8 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): # mat = context.material - return False # mat and mat.node_tree and CyclesButtonsPanel.poll(context) + # mat and mat.node_tree and CyclesButtonsPanel.poll(context) + return False def draw(self, context): layout = self.layout @@ -730,7 +731,7 @@ def draw_pause(self, context): def get_panels(): - return [ + return ( bpy.types.RENDER_PT_render, bpy.types.RENDER_PT_output, bpy.types.RENDER_PT_encoding, @@ -782,7 +783,8 @@ def get_panels(): bpy.types.PARTICLE_PT_field_weights, bpy.types.PARTICLE_PT_force_fields, bpy.types.PARTICLE_PT_vertexgroups, - bpy.types.PARTICLE_PT_custom_props] + bpy.types.PARTICLE_PT_custom_props, + ) def register(): diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index af852d49d82..1c25547b146 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -58,7 +58,6 @@ struct MovieTrackingMarker *BKE_tracking_exact_marker(struct MovieTrackingTrack int BKE_tracking_has_marker(struct MovieTrackingTrack *track, int framenr); void BKE_tracking_free_track(struct MovieTrackingTrack *track); -struct MovieTrackingTrack *BKE_tracking_copy_track(struct MovieTrackingTrack *track); void BKE_tracking_clear_path(struct MovieTrackingTrack *track, int ref_frame, int action); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 474b00e626b..45e708a8233 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -360,18 +360,6 @@ void BKE_tracking_free_track(MovieTrackingTrack *track) if(track->markers) MEM_freeN(track->markers); } -MovieTrackingTrack *BKE_tracking_copy_track(MovieTrackingTrack *track) -{ - MovieTrackingTrack *new_track= MEM_dupallocN(track); - - new_track->next= new_track->prev= NULL; - - if(new_track->markers) - new_track->markers= MEM_dupallocN(new_track->markers); - - return new_track; -} - static void put_disabled_marker(MovieTrackingTrack *track, MovieTrackingMarker *ref_marker, int before, int overwrite) { MovieTrackingMarker marker_new; @@ -528,11 +516,173 @@ void BKE_tracking_free(MovieTracking *tracking) BKE_tracking_distortion_destroy(tracking->camera.intrinsics); } -/*********************** tracking *************************/ +/*********************** tracks map *************************/ -typedef struct TrackContext { +typedef struct TracksMap { + int num_tracks; + int customdata_size; + + char *customdata; + MovieTrackingTrack *tracks; + + GHash *hash; + + int ptr; +} TracksMap; + +static TracksMap *tracks_map_new(int num_tracks, int customdata_size) +{ + TracksMap *map= MEM_callocN(sizeof(TracksMap), "TrackingsMap"); + + map->num_tracks= num_tracks; + map->customdata_size= customdata_size; + + map->tracks= MEM_callocN(sizeof(MovieTrackingTrack)*num_tracks, "TrackingsMap tracks"); + + if(customdata_size) + map->customdata= MEM_callocN(customdata_size*num_tracks, "TracksMap customdata"); + + map->hash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "TracksMap hash"); + + return map; +} + +static int tracks_map_size(TracksMap *map) +{ + return map->num_tracks; +} + +static void tracks_map_get(TracksMap *map, int index, MovieTrackingTrack **track, void **customdata) +{ + *track= &map->tracks[index]; + + if(map->customdata) + *customdata= &map->customdata[index*map->customdata_size]; +} + +static void tracks_map_insert(TracksMap *map, MovieTrackingTrack *track, void *customdata) +{ + MovieTrackingTrack new_track= *track; + + new_track.markers= MEM_dupallocN(new_track.markers); + + map->tracks[map->ptr]= new_track; + + if(customdata) + memcpy(&map->customdata[map->ptr*map->customdata_size], customdata, map->customdata_size); + + BLI_ghash_insert(map->hash, &map->tracks[map->ptr], track); + + map->ptr++; +} + +static void tracks_map_merge(TracksMap *map, MovieTracking *tracking) +{ MovieTrackingTrack *track; + ListBase tracks= {NULL, NULL}, new_tracks= {NULL, NULL}; + ListBase *old_tracks= &tracking->tracks; + int a; + + /* duplicate currently operating tracks to temporary list. + this is needed to keep names in unique state and it's faster to change names + of currently operating tracks (if needed) */ + for(a= 0; a<map->num_tracks; a++) { + int replace_sel= 0; + MovieTrackingTrack *new_track, *old; + + track= &map->tracks[a]; + + /* find original of operating track in list of previously displayed tracks */ + old= BLI_ghash_lookup(map->hash, track); + if(old) { + MovieTrackingTrack *cur= old_tracks->first; + + while(cur) { + if(cur==old) + break; + + cur= cur->next; + } + + /* original track was found, re-use flags and remove this track */ + if(cur) { + if(cur==tracking->act_track) + replace_sel= 1; + + track->flag= cur->flag; + track->pat_flag= cur->pat_flag; + track->search_flag= cur->search_flag; + BKE_tracking_free_track(cur); + BLI_freelinkN(old_tracks, cur); + } + } + + new_track= MEM_callocN(sizeof(MovieTrackingTrack), "tracksMapMerge new_track"); + *new_track= *track; + new_track->markers= MEM_dupallocN(new_track->markers); + + BLI_ghash_remove(map->hash, track, NULL, NULL); /* XXX: are we actually need this */ + BLI_ghash_insert(map->hash, track, new_track); + + if(replace_sel) /* update current selection in clip */ + tracking->act_track= new_track; + + BLI_addtail(&tracks, new_track); + } + + /* move all tracks, which aren't operating */ + track= old_tracks->first; + while(track) { + MovieTrackingTrack *next= track->next; + + track->next= track->prev= NULL; + BLI_addtail(&new_tracks, track); + + track= next; + } + + /* now move all tracks which are currently operating and keep their names unique */ + track= tracks.first; + while(track) { + MovieTrackingTrack *next= track->next; + + BLI_remlink(&tracks, track); + + track->next= track->prev= NULL; + BLI_addtail(&new_tracks, track); + + BLI_uniquename(&new_tracks, track, "Track", '.', offsetof(MovieTrackingTrack, name), sizeof(track->name)); + + track= next; + } + + tracking->tracks= new_tracks; +} + +static void tracks_map_free(TracksMap *map, void (*customdata_free) (void *customdata)) +{ + int i= 0; + + BLI_ghash_free(map->hash, NULL, NULL); + + for(i= 0; i<map->num_tracks; i++) { + if(map->customdata && customdata_free) + customdata_free(&map->customdata[i*map->customdata_size]); + + BKE_tracking_free_track(&map->tracks[i]); + } + + if(map->customdata) + MEM_freeN(map->customdata); + + MEM_freeN(map->tracks); + MEM_freeN(map); +} + +/*********************** tracking *************************/ + +typedef struct TrackContext { #ifdef WITH_LIBMV float keyframed_pos[2]; @@ -544,6 +694,8 @@ typedef struct TrackContext { int patsize; /* size of pattern (currently only 16x16 due to libmv side) */ unsigned char *pattern; /* keyframed pattern */ unsigned char *warped; /* warped version of reference */ +#else + int pad; #endif } TrackContext; @@ -553,11 +705,8 @@ typedef struct MovieTrackingContext { int first_time, frames; - TrackContext *track_context; - int num_tracks; - - GHash *hash; MovieTrackingSettings settings; + TracksMap *tracks_map; short backwards, disable_failed; int sync_frame; @@ -569,12 +718,11 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u MovieTracking *tracking= &clip->tracking; MovieTrackingSettings *settings= &tracking->settings; MovieTrackingTrack *track; - TrackContext *track_context; + int num_tracks= 0; context->settings= *settings; context->backwards= backwards; context->disable_failed= disable_failed; - context->hash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "tracking trackHash"); context->sync_frame= user->framenr; context->first_time= 1; @@ -585,33 +733,33 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u MovieTrackingMarker *marker= BKE_tracking_get_marker(track, user->framenr); if((marker->flag&MARKER_DISABLED)==0) - context->num_tracks++; + num_tracks++; } track= track->next; } - if(context->num_tracks) { + if(num_tracks) { int width, height; + context->tracks_map= tracks_map_new(num_tracks, sizeof(TrackContext)); + BKE_movieclip_get_size(clip, user, &width, &height); /* create tracking data */ - context->track_context= MEM_callocN(sizeof(TrackContext)*context->num_tracks, "tracking track_context"); - - track_context= context->track_context; track= tracking->tracks.first; while(track) { if(TRACK_SELECTED(track) && (track->flag&TRACK_LOCKED)==0) { MovieTrackingMarker *marker= BKE_tracking_get_marker(track, user->framenr); if((marker->flag&MARKER_DISABLED)==0) { - MovieTrackingTrack *new_track= BKE_tracking_copy_track(track); + TrackContext track_context; + + memset(&track_context, 0, sizeof(TrackContext)); - track_context->track= new_track; #ifdef WITH_LIBMV { - if(track_context->track->tracker==TRACKER_KLT) { + if(track->tracker==TRACKER_KLT) { float search_size_x= (track->search_max[0]-track->search_min[0])*width; float search_size_y= (track->search_max[1]-track->search_min[1])*height; float pattern_size_x= (track->pat_max[0]-track->pat_min[0])*width; @@ -627,22 +775,20 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u /* try to accomodate the user's choice of pyramid level in a way * that doesn't cause the coarsest pyramid pattern to be larger * than the search size */ - int level= MIN2(track_context->track->pyramid_levels, max_pyramid_levels); + int level= MIN2(track->pyramid_levels, max_pyramid_levels); wndx= (int)((track->pat_max[0]-track->pat_min[0])*width)/2; wndy= (int)((track->pat_max[1]-track->pat_min[1])*height)/2; - track_context->region_tracker= libmv_regionTrackerNew(100, level, MAX2(wndx, wndy)); + track_context.region_tracker= libmv_regionTrackerNew(100, level, MAX2(wndx, wndy)); } - else if(track_context->track->tracker==TRACKER_SAD) { + else if(track->tracker==TRACKER_SAD) { /* nothing to initialize */ } } #endif - BLI_ghash_insert(context->hash, new_track, track); - - track_context++; + tracks_map_insert(context->tracks_map, track, &track_context); } } @@ -656,35 +802,30 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u return context; } -void BKE_tracking_context_free(MovieTrackingContext *context) +static void track_context_free(void *customdata) { - int a; - TrackContext *track_context; - - for(a= 0, track_context= context->track_context; a<context->num_tracks; a++, track_context++) { - BKE_tracking_free_track(context->track_context[a].track); + TrackContext *track_context= (TrackContext *)customdata; #if WITH_LIBMV - if(track_context->region_tracker) - libmv_regionTrackerDestroy(track_context->region_tracker); + if(track_context->region_tracker) + libmv_regionTrackerDestroy(track_context->region_tracker); - if(track_context->patch) - MEM_freeN(track_context->patch); + if(track_context->patch) + MEM_freeN(track_context->patch); - if(track_context->pattern) - MEM_freeN(track_context->pattern); + if(track_context->pattern) + MEM_freeN(track_context->pattern); - if(track_context->warped) - MEM_freeN(track_context->warped); + if(track_context->warped) + MEM_freeN(track_context->warped); +#else + (void) track_context; #endif +} - MEM_freeN(track_context->track); - } - - if(context->track_context) - MEM_freeN(context->track_context); - - BLI_ghash_free(context->hash, NULL, NULL); +void BKE_tracking_context_free(MovieTrackingContext *context) +{ + tracks_map_free(context->tracks_map, track_context_free); MEM_freeN(context); } @@ -937,86 +1078,10 @@ static void get_warped(TrackContext *track_context, int x, int y, int width, uns void BKE_tracking_sync(MovieTrackingContext *context) { - TrackContext *track_context; MovieTracking *tracking= &context->clip->tracking; - MovieTrackingTrack *track; - ListBase tracks= {NULL, NULL}, new_tracks= {NULL, NULL}; - ListBase *old_tracks= &context->clip->tracking.tracks; - int a, newframe; - - /* duplicate currently tracking tracks to temporary list. - this is needed to keep names in unique state and it's faster to change names - of currently tracking tracks (if needed) */ - for(a= 0, track_context= context->track_context; a<context->num_tracks; a++, track_context++) { - int replace_sel= 0; - MovieTrackingTrack *new_track, *old; + int newframe; - track= track_context->track; - - /* find original of tracking track in list of previously displayed tracks */ - old= BLI_ghash_lookup(context->hash, track); - if(old) { - MovieTrackingTrack *cur= old_tracks->first; - - while(cur) { - if(cur==old) - break; - - cur= cur->next; - } - - /* original track was found, re-use flags and remove this track */ - if(cur) { - if(cur==tracking->act_track) - replace_sel= 1; - - track->flag= cur->flag; - track->pat_flag= cur->pat_flag; - track->search_flag= cur->search_flag; - - BKE_tracking_free_track(cur); - BLI_freelinkN(old_tracks, cur); - } - } - - new_track= BKE_tracking_copy_track(track); - - BLI_ghash_remove(context->hash, track, NULL, NULL); /* XXX: are we actually need this */ - BLI_ghash_insert(context->hash, track, new_track); - - if(replace_sel) /* update current selection in clip */ - tracking->act_track= new_track; - - BLI_addtail(&tracks, new_track); - } - - /* move all tracks, which aren't tracking */ - track= old_tracks->first; - while(track) { - MovieTrackingTrack *next= track->next; - - track->next= track->prev= NULL; - BLI_addtail(&new_tracks, track); - - track= next; - } - - /* now move all tracks which are currently tracking and keep their names unique */ - track= tracks.first; - while(track) { - MovieTrackingTrack *next= track->next; - - BLI_remlink(&tracks, track); - - track->next= track->prev= NULL; - BLI_addtail(&new_tracks, track); - - BLI_uniquename(&new_tracks, track, "Track", '.', offsetof(MovieTrackingTrack, name), sizeof(track->name)); - - track= next; - } - - context->clip->tracking.tracks= new_tracks; + tracks_map_merge(context->tracks_map, tracking); if(context->backwards) newframe= context->user.framenr+1; else newframe= context->user.framenr-1; @@ -1033,10 +1098,12 @@ int BKE_tracking_next(MovieTrackingContext *context) { ImBuf *ibuf_new; int curfra= context->user.framenr; - int a, ok= 0; + int a, ok= 0, map_size; + + map_size= tracks_map_size(context->tracks_map); /* nothing to track, avoid unneeded frames reading to save time and memory */ - if(!context->num_tracks) + if(!map_size) return 0; if(context->backwards) context->user.framenr--; @@ -1046,11 +1113,15 @@ int BKE_tracking_next(MovieTrackingContext *context) if(!ibuf_new) return 0; - #pragma omp parallel for private(a) shared(ibuf_new, ok) if(context->num_tracks>1) - for(a= 0; a<context->num_tracks; a++) { - TrackContext *track_context= &context->track_context[a]; - MovieTrackingTrack *track= track_context->track; - MovieTrackingMarker *marker= BKE_tracking_exact_marker(track, curfra); + #pragma omp parallel for private(a) shared(ibuf_new, ok) if(map_size>1) + for(a= 0; a<map_size; a++) { + TrackContext *track_context; + MovieTrackingTrack *track; + MovieTrackingMarker *marker; + + tracks_map_get(context->tracks_map, a, &track, (void**)&track_context); + + marker= BKE_tracking_exact_marker(track, curfra); if(marker && (marker->flag&MARKER_DISABLED)==0) { #ifdef WITH_LIBMV @@ -1079,7 +1150,7 @@ int BKE_tracking_next(MovieTrackingContext *context) marker->pos[1]<margin[1] || marker->pos[1]>1.0f-margin[1]) { onbound= 1; } - else if(track_context->track->tracker==TRACKER_KLT) { + else if(track->tracker==TRACKER_KLT) { float *patch_new; if(need_readjust) { @@ -1107,7 +1178,7 @@ int BKE_tracking_next(MovieTrackingContext *context) MEM_freeN(patch_new); } - else if(track_context->track->tracker==TRACKER_SAD) { + else if(track->tracker==TRACKER_SAD) { unsigned char *image_new; float correlation; float warp[3][2]={{0}}; @@ -1165,7 +1236,7 @@ int BKE_tracking_next(MovieTrackingContext *context) x2= warp[2][0]; y2= warp[2][1]; - tracked= track_context->track->minimum_correlation < correlation; + tracked= track->minimum_correlation < correlation; if(tracked) get_warped(track_context, x2, y2, width, image_new); diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index a46ba78aef0..77896709285 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -55,7 +55,7 @@ void *BLI_mempool_calloc(BLI_mempool *pool); void BLI_mempool_free(BLI_mempool *pool, void *addr); void BLI_mempool_destroy(BLI_mempool *pool); int BLI_mempool_count(BLI_mempool *pool); -void *BLI_mempool_findelem(BLI_mempool *pool, const int index); +void *BLI_mempool_findelem(BLI_mempool *pool, int index); /** iteration stuff. note: this may easy to produce bugs with **/ /*private structure*/ diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index f8da524d097..0060878587b 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -241,18 +241,19 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) } } -void *BLI_mempool_findelem(BLI_mempool *pool, const int index) +void *BLI_mempool_findelem(BLI_mempool *pool, int index) { - if ((index >= 0) && (index < pool->totused)) { - BLI_mempool_chunk *mpchunk; - int i= 0; - - for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { - if (index < i + pool->pchunk) { - return ((char *)mpchunk->data) + (pool->esize * (index - i)); - } - i += pool->pchunk; - } + if (!pool->allow_iter) { + fprintf(stderr, "%s: Error! you can't iterate over this mempool!\n", __func__); + return NULL; + } + else if ((index >= 0) && (index < pool->totused)) { + /* we could have some faster mem chunk stepping code inline */ + BLI_mempool_iter iter; + void *elem; + BLI_mempool_iternew(pool, &iter); + for (elem= BLI_mempool_iterstep(&iter); index-- != 0; elem= BLI_mempool_iterstep(&iter)) { }; + return elem; } return NULL; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index d66e6852f1d..38b0c2f6d38 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -494,7 +494,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) /* calculate header rect */ /* + 0.001f to prevent flicker due to float inaccuracy */ headrect= *rect; - headrect.ymin= headrect.ymax - 2.0f/block->aspect; + headrect.ymin= headrect.ymax; headrect.ymax= headrect.ymin + floor(PNL_HEADER/block->aspect + 0.001f); { @@ -508,7 +508,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) /* draw with background color */ glEnable(GL_BLEND); glColor4ubv((unsigned char*)btheme->tui.panel.header); - glRectf(minx, headrect.ymin, maxx, y); + glRectf(minx, headrect.ymin+1, maxx, y); fdrawline(minx, y, maxx, y); fdrawline(minx, y, maxx, y); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index f3d087d6986..24c26109502 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -262,12 +262,12 @@ static void region_draw_azone_tab_plus(AZone *az) break; } - glColor4f(0.05f, 0.05f, 0.05f, 0.5f); + glColor4f(0.05f, 0.05f, 0.05f, 0.4f); uiRoundBox((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f); glEnable(GL_BLEND); - glColor4f(0.8f, 0.8f, 0.8f, 0.5f); + glColor4f(0.8f, 0.8f, 0.8f, 0.4f); draw_azone_plus((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2); glDisable(GL_BLEND); @@ -711,8 +711,8 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar) } } -#define AZONEPAD_TAB_PLUSW 16 -#define AZONEPAD_TAB_PLUSH 16 +#define AZONEPAD_TAB_PLUSW 14 +#define AZONEPAD_TAB_PLUSH 14 /* region already made zero sized, in shape of edge */ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar) @@ -739,9 +739,9 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar) az->y2= ar->winrct.ymin; break; case AE_LEFT_TO_TOPRIGHT: - az->x1= ar->winrct.xmin + 1 - AZONEPAD_TAB_PLUSH; + az->x1= ar->winrct.xmin - AZONEPAD_TAB_PLUSH; az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW; - az->x2= ar->winrct.xmin + 1; + az->x2= ar->winrct.xmin; az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW; break; case AE_RIGHT_TO_TOPLEFT: diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index e5a5109d796..6eb5e511bc4 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -741,7 +741,7 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, MovieClip *clip, fl d2= dist_to_rect(co, marker->pos, cur->pat_min, cur->pat_max); /* distance to search boundbox */ - if(sc->flag&SC_SHOW_MARKER_SEARCH) + if(sc->flag&SC_SHOW_MARKER_SEARCH && TRACK_VIEW_SELECTED(sc, cur)) d3= dist_to_rect(co, marker->pos, cur->search_min, cur->search_max); /* choose minimal distance. useful for cases of overlapped markers. */ diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 424a08f15cb..940e2e749e3 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -746,7 +746,7 @@ static int rna_StringProperty_max_length_get(PointerRNA *ptr) return ((StringPropertyRNA*)prop)->maxlength; } -static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop_parent, int *free) { PropertyRNA *prop= (PropertyRNA*)ptr->data; EnumPropertyRNA *eprop; @@ -754,6 +754,11 @@ static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA rna_idproperty_check(&prop, ptr); eprop= (EnumPropertyRNA*)prop; + /* incompatible default attributes */ + if ((prop_parent->flag & PROP_ENUM_FLAG) != (prop->flag & PROP_ENUM_FLAG)) { + return NULL; + } + if( (eprop->itemf == NULL) || (eprop->itemf == rna_EnumProperty_default_itemf) || (ptr->type == &RNA_EnumProperty) || |