diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-05-22 02:01:47 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-05-22 02:01:47 +0400 |
commit | dbcb73c033fc15fc0df2ab0a05ac0b2c4a9a31b1 (patch) | |
tree | 630247e3c4b18a799545bee8de23ee075cfa5a79 /source/blender | |
parent | f76c3aa3764283918413a50ed9dab079e720ed98 (diff) | |
parent | c0a0f2c43e934e2054eefe5bf90889cf67b736f9 (diff) |
Merged changes in the trunk up to revision 28911.
Diffstat (limited to 'source/blender')
103 files changed, 1731 insertions, 885 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 291deb5ea70..6a602339e11 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -83,9 +83,6 @@ typedef struct Global { struct VFont *selfont; struct ListBase ttfdata; - /* libtiff flag used to determine if shared library loaded for libtiff*/ - int have_libtiff; - /* this variable is written to / read from FileGlobal->fileflags */ int fileflags; diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index e5c7745f637..258fb6f1b3f 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -52,9 +52,9 @@ void multiresModifier_join(struct Object *); void multiresModifier_del_levels(struct MultiresModifierData *, struct Object *, int direction); void multiresModifier_subdivide(struct MultiresModifierData *mmd, struct Object *ob, int updateblock, int simple); -int multiresModifier_reshape(struct MultiresModifierData *mmd, struct Object *dst, struct Object *src); -int multiresModifier_reshapeFromDM(struct MultiresModifierData *mmd, struct Object *ob, struct DerivedMesh *srcdm); -int multiresModifier_reshapeFromDeformMod(struct MultiresModifierData *mmd, struct Object *ob, struct ModifierData *md); +int multiresModifier_reshape(struct Object *dst, struct Object *src); +int multiresModifier_reshapeFromDM(struct Object *ob, struct DerivedMesh *srcdm); +int multiresModifier_reshapeFromDeformMod(struct Object *ob, struct ModifierData *md); void multires_stitch_grids(struct Object *); diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index 51d915cca18..0b3fce9408c 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -105,6 +105,7 @@ #define AVG2(x, y) ( 0.5 * ((x) + (y)) ) #define FTOCHAR(val) ((val)<=0.0f)? 0 : (((val)>(1.0f-0.5f/255.0f))? 255 : (char)((255.0f*(val))+0.5f)) +#define FTOUSHORT(val) ((val >= 1.0f-0.5f/65535)? 65535: (val <= 0.0f)? 0: (unsigned short)(val*65535.0f + 0.5f)) #define VECCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2);} #define VECCOPY2D(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1);} diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 1ad0ddf0520..2086f4064d5 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -50,6 +50,10 @@ IF(WITH_OPENEXR) ADD_DEFINITIONS(-DWITH_OPENEXR) ENDIF(WITH_OPENEXR) +IF(WITH_TIFF) + ADD_DEFINITIONS(-DWITH_TIFF) +ENDIF(WITH_TIFF) + IF(WITH_OPENJPEG) ADD_DEFINITIONS(-DWITH_OPENJPEG) ENDIF(WITH_OPENJPEG) diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index ac10889f36a..85d4934609d 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -38,6 +38,9 @@ else: if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') +if env['WITH_BF_TIFF']: + defs.append('WITH_TIFF') + if env['WITH_BF_OPENJPEG']: defs.append('WITH_OPENJPEG') diff --git a/source/blender/blenkernel/intern/Makefile b/source/blender/blenkernel/intern/Makefile index 4e365f363c3..15c022592f9 100644 --- a/source/blender/blenkernel/intern/Makefile +++ b/source/blender/blenkernel/intern/Makefile @@ -132,6 +132,10 @@ ifeq ($(WITH_QUICKTIME), true) CPPFLAGS += -DWITH_QUICKTIME endif +ifeq ($(WITH_TIFF), true) + CPPFLAGS += -DWITH_TIFF +endif + ifeq ($(OS), darwin) ifeq ($(WITH_BF_OPENMP), true) CPPFLAGS += -DPARALLEL=1 diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 8619ab1eb1c..313d79cf3b9 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -187,6 +187,8 @@ bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel * if (avs->path_bakeflag & MOTIONPATH_BAKE_HEADS) mpath->flag |= MOTIONPATH_FLAG_BHEAD; + else + mpath->flag &= ~MOTIONPATH_FLAG_BHEAD; /* allocate a cache */ mpath->points= MEM_callocN(sizeof(bMotionPathVert)*mpath->length, "bMotionPathVerts"); @@ -250,6 +252,83 @@ void animviz_get_object_motionpaths(Object *ob, ListBase *targets) /* ........ */ +/* Note on evaluation optimisations: + * Optimisations currently used here play tricks with the depsgraph in order to try and + * evaluate as few objects as strictly necessary to get nicer performance under standard + * production conditions. For those people who really need the accurate version, + * disable the ifdef (i.e. 1 -> 0) and comment out the call to motionpaths_calc_optimise_depsgraph() + */ + +/* tweak the object ordering to trick depsgraph into making MotionPath calculations run faster */ +static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets) +{ + Base *base, *baseNext; + MPathTarget *mpt; + + /* make sure our temp-tag isn't already in use */ + for (base= scene->base.first; base; base= base->next) + base->object->flag &= ~BA_TEMP_TAG; + + /* for each target, dump its object to the start of the list if it wasn't moved already */ + for (mpt= targets->first; mpt; mpt= mpt->next) { + for (base=scene->base.first; base; base=baseNext) { + baseNext = base->next; + + if ((base->object == mpt->ob) && !(mpt->ob->flag & BA_TEMP_TAG)) { + BLI_remlink(&scene->base, base); + BLI_addhead(&scene->base, base); + + mpt->ob->flag |= BA_TEMP_TAG; + break; // we really don't need to continue anymore once this happens, but this line might really 'break' + } + } + } + + /* "brew me a list that's sorted a bit faster now depsy" */ + DAG_scene_sort(scene); +} + +/* update scene for current frame */ +static void motionpaths_calc_update_scene(Scene *scene) +{ +#if 1 // 'production' optimisations always on + Base *base, *last=NULL; + + /* only stuff that moves or needs display still */ + DAG_scene_update_flags(scene, scene->lay); + + /* find the last object with the tag + * - all those afterwards are assumed to not be relevant for our calculations + */ + // optimise further by moving out... + for (base=scene->base.first; base; base=base->next) { + if (base->object->flag & BA_TEMP_TAG) + last = base; + } + + /* perform updates for tagged objects */ + // XXX: this will break if rigs depend on scene or other data that + // is animated but not attached to/updatable from objects + for (base=scene->base.first; base; base=base->next) { + /* update this object */ + object_handle_update(scene, base->object); + + /* if this is the last one we need to update, let's stop to save some time */ + if (base == last) + break; + } +#else // original, 'always correct' version + /* do all updates + * - if this is too slow, resort to using a more efficient way + * that doesn't force complete update, but for now, this is the + * most accurate way! + */ + scene_update_for_newframe(scene, scene->lay); // XXX this is the best way we can get anything moving +#endif +} + +/* ........ */ + /* perform baking for the targets on the current frame */ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) { @@ -311,7 +390,7 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets) // TODO: this method could be improved... // 1) max range for standard baking - // 2) minimum range for recalc baking (i.e. between keyfames, but how?) + // 2) minimum range for recalc baking (i.e. between keyframes, but how?) for (mpt= targets->first; mpt; mpt= mpt->next) { /* try to increase area to do (only as much as needed) */ sfra= MIN2(sfra, mpt->mpath->start_frame); @@ -319,14 +398,14 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets) } if (efra <= sfra) return; + /* optimise the depsgraph for faster updates */ + // TODO: whether this is used should depend on some setting for the level of optimisations used + motionpaths_calc_optimise_depsgraph(scene, targets); + /* calculate path over requested range */ for (CFRA=sfra; CFRA<=efra; CFRA++) { - /* do all updates - * - if this is too slow, resort to using a more efficient way - * that doesn't force complete update, but for now, this is the - * most accurate way! - */ - scene_update_for_newframe(scene, scene->lay); // XXX this is the best way we can get anything moving + /* update relevant data for new frame */ + motionpaths_calc_update_scene(scene); /* perform baking for targets */ motionpaths_calc_bake_targets(scene, targets); @@ -334,7 +413,7 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets) /* reset original environment */ CFRA= cfra; - scene_update_for_newframe(scene, scene->lay); // XXX this is the best way we can get anything moving + motionpaths_calc_update_scene(scene); /* clear recalc flags from targets */ for (mpt= targets->first; mpt; mpt= mpt->next) { diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index a7a4d789610..10c2c1801cb 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -339,6 +339,19 @@ static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName, /* firstly, handle the F-Curve's own path */ if (fcu->rna_path) fcu->rna_path= rna_path_rename_fix(owner_id, prefix, oldName, newName, fcu->rna_path, verify_paths); + } +} + +/* Check RNA-Paths for a list of Drivers */ +static void drivers_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, char *oldKey, char *newKey, ListBase *curves, int verify_paths) +{ + FCurve *fcu; + + /* we need to check every curve - drivers are F-Curves too! */ + for (fcu= curves->first; fcu; fcu= fcu->next) { + /* firstly, handle the F-Curve's own path */ + if (fcu->rna_path) + fcu->rna_path= rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths); /* driver? */ if (fcu->driver) { @@ -352,15 +365,16 @@ static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName, { /* rename RNA path */ if (dtar->rna_path) - dtar->rna_path= rna_path_rename_fix(dtar->id, prefix, oldName, newName, dtar->rna_path, verify_paths); + dtar->rna_path= rna_path_rename_fix(dtar->id, prefix, oldKey, newKey, dtar->rna_path, verify_paths); /* also fix the bone-name (if applicable) */ - // XXX this has been disabled because the old/new names have padding which means this check will fail - //if ( ((dtar->id) && (GS(dtar->id->name) == ID_OB)) && - // (dtar->pchan_name[0]) && (strcmp(oldName, dtar->pchan_name)==0) ) - //{ - // BLI_strncpy(dtar->pchan_name, newName, sizeof(dtar->pchan_name)); - //} + if (strstr(prefix, "bones")) { + if ( ((dtar->id) && (GS(dtar->id->name) == ID_OB)) && + (dtar->pchan_name[0]) && (strcmp(oldName, dtar->pchan_name)==0) ) + { + BLI_strncpy(dtar->pchan_name, newName, sizeof(dtar->pchan_name)); + } + } } DRIVER_TARGETS_LOOPER_END } @@ -398,11 +412,12 @@ void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, char *prefix, c if (ELEM(NULL, owner_id, adt)) return; - if (oldName != NULL && newName != NULL) { + if ((oldName != NULL) && (newName != NULL)) { /* pad the names with [" "] so that only exact matches are made */ oldN= BLI_sprintfN("[\"%s\"]", oldName); newN= BLI_sprintfN("[\"%s\"]", newName); - } else { + } + else { oldN= BLI_sprintfN("[%d]", oldSubscript); newN= BLI_sprintfN("[%d]", newSubscript); } @@ -414,7 +429,7 @@ void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, char *prefix, c fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->tmpact->curves, verify_paths); /* Drivers - Drivers are really F-Curves */ - fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->drivers, verify_paths); + drivers_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &adt->drivers, verify_paths); /* NLA Data - Animation Data for Strips */ for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 4f9b9435a80..557f3900d7b 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2055,7 +2055,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o /* we need to clamp this within sensible values */ // NOTE: these should be fine for now, but should get sanitised in future - scale= MIN2( MAX2(scale, 0.0001) , 100000); + scale= MIN2(MAX2(scale, 0.0001) , 100000); } else scale= 1.0f; @@ -2127,8 +2127,6 @@ static void splineik_execute_tree(Scene *scene, Object *ob, bPoseChannel *pchan_ splineik_evaluate_bone(tree, scene, ob, pchan, i, ctime); } - // TODO: if another pass is needed to ensure the validity of the chain after blending, it should go here - /* free the tree info specific to SplineIK trees now */ if (tree->chain) MEM_freeN(tree->chain); if (tree->free_points) MEM_freeN(tree->points); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index eb478eaddf5..5588c8df161 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -779,10 +779,12 @@ void BKE_add_image_extension(char *string, int imtype) if(!BLI_testextensie(string, ".bmp")) extension= ".bmp"; } - else if(G.have_libtiff && (imtype==R_TIFF)) { +#ifdef WITH_TIFF + else if(imtype==R_TIFF) { if(!BLI_testextensie(string, ".tif") && !BLI_testextensie(string, ".tiff")) extension= ".tif"; } +#endif #ifdef WITH_OPENEXR else if( ELEM(imtype, R_OPENEXR, R_MULTILAYER)) { if(!BLI_testextensie(string, ".exr")) @@ -1187,12 +1189,14 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimt else if ((imtype==R_BMP)) { ibuf->ftype= BMP; } - else if ((G.have_libtiff) && (imtype==R_TIFF)) { +#ifdef WITH_TIFF + else if (imtype==R_TIFF) { ibuf->ftype= TIF; if(subimtype & R_TIFF_16BIT) ibuf->ftype |= TIF_16BIT; } +#endif #ifdef WITH_OPENEXR else if (imtype==R_OPENEXR || imtype==R_MULTILAYER) { ibuf->ftype= OPENEXR; diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 52c6f9355a3..d8c39abc44a 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -207,7 +207,7 @@ void multiresModifier_join(Object *ob) } #endif -int multiresModifier_reshapeFromDM(MultiresModifierData *mmd, Object *ob, DerivedMesh *srcdm) +int multiresModifier_reshapeFromDM(Object *ob, DerivedMesh *srcdm) { DerivedMesh *mrdm = get_multires_dm (ob); @@ -228,13 +228,13 @@ int multiresModifier_reshapeFromDM(MultiresModifierData *mmd, Object *ob, Derive } /* Returns 1 on success, 0 if the src's totvert doesn't match */ -int multiresModifier_reshape(MultiresModifierData *mmd, Object *dst, Object *src) +int multiresModifier_reshape(Object *dst, Object *src) { DerivedMesh *srcdm = src->derivedFinal; - return multiresModifier_reshapeFromDM(mmd, dst, srcdm); + return multiresModifier_reshapeFromDM(dst, srcdm); } -int multiresModifier_reshapeFromDeformMod(MultiresModifierData *mmd, Object *ob, ModifierData *md) +int multiresModifier_reshapeFromDeformMod(Object *ob, ModifierData *md) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); DerivedMesh *dm, *ndm; @@ -256,7 +256,7 @@ int multiresModifier_reshapeFromDeformMod(MultiresModifierData *mmd, Object *ob, dm->release(dm); /* Reshaping */ - result= multiresModifier_reshapeFromDM(mmd, ob, ndm); + result= multiresModifier_reshapeFromDM(ob, ndm); /* Cleanup */ ndm->release(ndm); diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index fb973febf04..dc4a9ee3bdc 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -186,7 +186,7 @@ PackedFile *newPackedFile(ReportList *reports, char *filename) file= open(name, O_BINARY|O_RDONLY); if (file <= 0) { - BKE_reportf(reports, RPT_ERROR, "Can't open file: \"%s\"", name); + BKE_reportf(reports, RPT_ERROR, "Unable to pack file, source path not found: \"%s\"", name); } else { filelen = BLI_filesize(file); @@ -216,15 +216,15 @@ void packAll(Main *bmain, ReportList *reports) bSound *sound; for(ima=bmain->image.first; ima; ima=ima->id.next) - if(ima->packedfile == NULL) + if(ima->packedfile == NULL && ima->id.lib==NULL && ELEM3(ima->type, IMA_SRC_FILE, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) ima->packedfile = newPackedFile(reports, ima->name); for(vf=bmain->vfont.first; vf; vf=vf->id.next) - if(vf->packedfile == NULL) + if(vf->packedfile == NULL && vf->id.lib==NULL) vf->packedfile = newPackedFile(reports, vf->name); for(sound=bmain->sound.first; sound; sound=sound->id.next) - if(sound->packedfile == NULL) + if(sound->packedfile == NULL && vf->id.lib==NULL) sound->packedfile = newPackedFile(reports, sound->name); } diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 160f8a35520..cb596622431 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2366,8 +2366,12 @@ typedef struct { static void *ptcache_make_cache_thread(void *ptr) { ptcache_make_cache_data *data = (ptcache_make_cache_data*)ptr; - for(; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) + for(; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) { scene_update_for_newframe(data->scene, data->scene->lay); + if(G.background) { + printf("bake: frame %d :: %d\n", (int)*data->cfra_ptr, data->endframe); + } + } data->thread_ended = TRUE; return NULL; @@ -2489,36 +2493,40 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) thread_data.thread_ended = FALSE; old_progress = -1; - BLI_init_threads(&threads, ptcache_make_cache_thread, 1); - BLI_insert_thread(&threads, (void*)&thread_data); - - while (thread_data.thread_ended == FALSE) { + if(G.background) { + ptcache_make_cache_thread((void*)&thread_data); + } + else { + BLI_init_threads(&threads, ptcache_make_cache_thread, 1); + BLI_insert_thread(&threads, (void*)&thread_data); - if(bake) - progress = (int)(100.0f * (float)(CFRA - startframe)/(float)(thread_data.endframe-startframe)); - else - progress = CFRA; + while (thread_data.thread_ended == FALSE) { - /* NOTE: baking should not redraw whole ui as this slows things down */ - if ((baker->progressbar) && (progress != old_progress)) { - baker->progressbar(baker->progresscontext, progress); - old_progress = progress; - } - - /* Delay to lessen CPU load from UI thread */ - PIL_sleep_ms(200); + if(bake) + progress = (int)(100.0f * (float)(CFRA - startframe)/(float)(thread_data.endframe-startframe)); + else + progress = CFRA; + + /* NOTE: baking should not redraw whole ui as this slows things down */ + if ((baker->progressbar) && (progress != old_progress)) { + baker->progressbar(baker->progresscontext, progress); + old_progress = progress; + } + + /* Delay to lessen CPU load from UI thread */ + PIL_sleep_ms(200); - /* NOTE: breaking baking should leave calculated frames in cache, not clear it */ - if(blender_test_break() && !thread_data.break_operation) { - thread_data.break_operation = TRUE; - if (baker->progressend) - baker->progressend(baker->progresscontext); - WM_cursor_wait(1); + /* NOTE: breaking baking should leave calculated frames in cache, not clear it */ + if(blender_test_break() && !thread_data.break_operation) { + thread_data.break_operation = TRUE; + if (baker->progressend) + baker->progressend(baker->progresscontext); + WM_cursor_wait(1); + } } - } BLI_end_threads(&threads); - + } /* clear baking flag */ if(pid) { cache->flag &= ~(PTCACHE_BAKING|PTCACHE_REDO_NEEDED); diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 6424829c12a..38e9a584952 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -239,10 +239,19 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype) for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { if (bhead->code==ofblocktype) { ID *id= (ID*) (bhead+1); - if ( (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) { - new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview"); - BLI_linklist_prepend(&previews, new_prv); - looking = 1; + switch(GS(id->name)) + { + case ID_MA: /* fall through */ + case ID_TE: /* fall through */ + case ID_IM: /* fall through */ + case ID_WO: /* fall through */ + case ID_LA: /* fall through */ + new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview"); + BLI_linklist_prepend(&previews, new_prv); + looking = 1; + break; + default: + break; } } else if (bhead->code==DATA) { if (looking) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1ffcef80242..e78a66bf999 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4162,8 +4162,8 @@ static void lib_link_scene(FileData *fd, Main *main) base->object= newlibadr_us(fd, sce->id.lib, base->object); if(base->object==NULL) { - printf("LIB ERROR: base removed\n"); BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: Object lost from scene:'%s\'\n", sce->id.name+2); + if(G.background==0) printf("LIB ERROR: base removed from scene:'%s\'\n", sce->id.name+2); BLI_remlink(&sce->base, base); if(base==sce->basact) sce->basact= 0; MEM_freeN(base); @@ -12301,8 +12301,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) if(fd==NULL) { /* printf and reports for now... its important users know this */ - printf("read library: '%s', '%s'\n", mainptr->curlib->filename, mainptr->curlib->name); BKE_reportf(basefd->reports, RPT_INFO, "read library: '%s', '%s'\n", mainptr->curlib->filename, mainptr->curlib->name); + if(!G.background && basefd->reports) printf("read library: '%s', '%s'\n", mainptr->curlib->filename, mainptr->curlib->name); fd= blo_openblenderfile(mainptr->curlib->filename, basefd->reports); @@ -12347,8 +12347,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) else mainptr->curlib->filedata= NULL; if (fd==NULL) { - printf("ERROR: can't find lib %s \n", mainptr->curlib->filename); BKE_reportf(basefd->reports, RPT_ERROR, "Can't find lib '%s'\n", mainptr->curlib->filename); + if(!G.background && basefd->reports) printf("ERROR: can't find lib %s \n", mainptr->curlib->filename); } } if(fd) { @@ -12365,8 +12365,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) append_id_part(fd, mainptr, id, &realid); if (!realid) { - printf("LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename); BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename); + if(!G.background && basefd->reports) printf("LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename); } change_idid_adr(mainlist, basefd, id, realid); @@ -12401,8 +12401,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) ID *idn= id->next; if(id->flag & LIB_READ) { BLI_remlink(lbarray[a], id); - printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename); BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename); + if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename); change_idid_adr(mainlist, basefd, id, NULL); MEM_freeN(id); diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt index 58a52f7041d..50d511eea24 100644 --- a/source/blender/editors/CMakeLists.txt +++ b/source/blender/editors/CMakeLists.txt @@ -58,6 +58,10 @@ IF(WITH_OPENEXR) ADD_DEFINITIONS(-DWITH_OPENEXR) ENDIF(WITH_OPENEXR) +IF(WITH_TIFF) + ADD_DEFINITIONS(-DWITH_TIFF) +ENDIF(WITH_TIFF) + IF(WITH_OPENJPEG) ADD_DEFINITIONS(-DWITH_OPENJPEG) ENDIF(WITH_OPENJPEG) diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 97c93c6a913..bdaf0bf700a 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -939,7 +939,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *op) /* do groups only first (unless in Drivers mode, where there are none) */ if (ac.datatype != ANIMCONT_DRIVERS) { /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CHANNELS | ANIMFILTER_FOREDIT); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CHANNELS | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* delete selected groups and their associated channels */ @@ -978,7 +978,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *op) /* now do F-Curves */ if (ac.datatype != ANIMCONT_GPENCIL) { /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* delete selected F-Curves */ @@ -1038,7 +1038,7 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *op) ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype); /* hide all channels not selected */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_UNSEL); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_UNSEL | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -1054,7 +1054,7 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *op) BLI_freelistN(&anim_data); /* make all the selected channels visible */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -1113,11 +1113,11 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* get list of all channels that selection may need to be flushed to */ - filter= ANIMFILTER_CHANNELS; + filter= (ANIMFILTER_CHANNELS | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* See if we should be making showing all selected or hiding */ @@ -1215,7 +1215,8 @@ static void setflag_anim_channels (bAnimContext *ac, short setting, short mode, } /* filter data that we're working on */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS); + // XXX: noduplis enabled so that results don't cancel, but will be problematic for some channels where only type differs + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS | ANIMFILTER_NODUPLIS); if (onlysel) filter |= ANIMFILTER_SEL; ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 5ac7f6d4119..67f2cb834e0 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -68,6 +68,7 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" +#include "BLI_ghash.h" #include "BKE_animsys.h" #include "BKE_action.h" @@ -2512,6 +2513,65 @@ static short animdata_filter_dopesheet_summary (bAnimContext *ac, ListBase *anim return 1; } +/* ----------- Cleanup API --------------- */ + +/* Remove entries with invalid types in animation channel list */ +static int animdata_filter_remove_invalid (ListBase *anim_data) +{ + bAnimListElem *ale, *next; + int items = 0; + + /* only keep entries with valid types */ + for (ale= anim_data->first; ale; ale= next) { + next= ale->next; + + if (ale->type == ANIMTYPE_NONE) + BLI_freelinkN(anim_data, ale); + else + items++; + } + + return items; +} + +/* Remove duplicate entries in animation channel list */ +static int animdata_filter_remove_duplis (ListBase *anim_data) +{ + bAnimListElem *ale, *next; + GHash *gh; + int items = 0; + + /* build new hashtable to efficiently store and retrieve which entries have been + * encountered already while searching + */ + gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "animdata_filter_duplis_remove gh"); + + /* loop through items, removing them from the list if a similar item occurs already */ + for (ale = anim_data->first; ale; ale = next) { + next = ale->next; + + /* check if hash has any record of an entry like this + * - just use ale->data for now, though it would be nicer to involve + * ale->type in combination too to capture corner cases (where same data performs differently) + */ + if (BLI_ghash_haskey(gh, ale->data) == 0) { + /* this entry is 'unique' and can be kept */ + BLI_ghash_insert(gh, ale->data, NULL); + items++; + } + else { + /* this entry isn't needed anymore */ + BLI_freelinkN(anim_data, ale); + } + } + + /* free the hash... */ + BLI_ghash_free(gh, NULL, NULL); + + /* return the number of items still in the list */ + return items; +} + /* ----------- Public API --------------- */ /* This function filters the active data source to leave only animation channels suitable for @@ -2527,7 +2587,6 @@ int ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_mode /* only filter data if there's somewhere to put it */ if (data && anim_data) { - bAnimListElem *ale, *next; Object *obact= (ac) ? ac->obact : NULL; /* firstly filter the data */ @@ -2572,16 +2631,12 @@ int ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_mode break; } - /* remove any weedy entries */ - // XXX this is weedy code! - for (ale= anim_data->first; ale; ale= next) { - next= ale->next; - - if (ale->type == ANIMTYPE_NONE) { - items--; - BLI_freelinkN(anim_data, ale); - } - } + /* remove any 'weedy' entries */ + items = animdata_filter_remove_invalid(anim_data); + + /* remove duplicates (if required) */ + if (filter_mode & ANIMFILTER_NODUPLIS) + items = animdata_filter_remove_duplis(anim_data); } /* return the number of items in the list */ diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 23cb697b453..230a3e8a3dd 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -192,6 +192,7 @@ typedef enum eAnimFilter_Flags { ANIMFILTER_ANIMDATA = (1<<9), /* only return the underlying AnimData blocks (not the tracks, etc.) data comes from */ ANIMFILTER_NLATRACKS = (1<<10), /* only include NLA-tracks */ ANIMFILTER_SELEDIT = (1<<11), /* link editability with selected status */ + ANIMFILTER_NODUPLIS = (1<<12), /* duplicate entries for animation data attached to multi-user blocks must not occur */ /* all filters - the power inside the bracket must be the last power for left-shifts + 1 */ ANIMFILTER_ALLFILTERS = ((1<<12) - 1) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index ff56b14c653..2c9d5a8e131 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2119,8 +2119,13 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE } if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) { + int ret = WM_UI_HANDLER_BREAK; + /* XXX (a bit ugly) Special case handling for filebrowser drag button */ + if(but->dragpoin && but->imb && ui_but_mouse_inside_icon(but, data->region, event)) { + ret = WM_UI_HANDLER_CONTINUE; + } button_activate_state(C, but, BUTTON_STATE_EXIT); - return WM_UI_HANDLER_BREAK; + return ret; } } else if(data->state == BUTTON_STATE_WAIT_DRAG) { diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 762203272a3..d91cdd5c20d 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1107,7 +1107,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui continue; if(itemptr.type && RNA_struct_is_ID(itemptr.type)) - iconid= ui_id_icon_get((bContext*)C, itemptr.data, 0); + iconid= ui_id_icon_get((bContext*)C, itemptr.data, 1); else iconid = 0; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index aef24acc7a7..8cf6c2915c2 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -170,7 +170,7 @@ static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSea continue; if(BLI_strcasestr(id->name+2, str)) { - iconid= ui_id_icon_get((bContext*)C, id, 0); + iconid= ui_id_icon_get((bContext*)C, id, 1); if(!uiSearchItemAdd(items, id->name+2, id, iconid)) break; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 49c455d9299..82b195fb94a 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1488,6 +1488,11 @@ void init_userdef_do_versions(void) if (U.v2d_min_gridsize == 0) { U.v2d_min_gridsize= 35; } + + /* Single Column UI Value */ + if (U.propwidth == 0) { + U.propwidth = 200; + } /* funny name, but it is GE stuff, moves userdef stuff to engine */ // XXX space_set_commmandline_options(); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 039b18efb39..9163baf606f 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1340,7 +1340,7 @@ void OBJECT_OT_constraint_add_with_targets(wmOperatorType *ot) void OBJECT_OT_constraint_copy(wmOperatorType *ot) { /* identifiers */ - ot->name= "Copy Constraints to Others"; + ot->name= "Copy Constraints to Selected"; ot->description = "Copy constraints to other selected objects."; ot->idname= "OBJECT_OT_constraint_copy"; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 4685c12fedd..da3798910e8 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -30,6 +30,7 @@ #include <time.h> #include <float.h> #include <ctype.h> +#include <stddef.h> //for offsetof #include "MEM_guardedalloc.h" @@ -104,6 +105,7 @@ /* for menu/popup icons etc etc*/ +#include "UI_interface.h" #include "WM_api.h" #include "WM_types.h" @@ -1098,6 +1100,7 @@ void flip_subdivison(Scene *scene, View3D *v3d, int level) static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob) { +//XXX no longer used - to be removed - replaced by game_properties_copy_exec bProperty *prop; Base *base; int nr, tot=0; @@ -1156,6 +1159,7 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob) static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob) { +//XXX no longer used - to be removed - replaced by logicbricks_copy_exec Base *base; for(base= FIRSTBASE; base; base= base->next) { @@ -2203,3 +2207,166 @@ void OBJECT_OT_game_property_remove(wmOperatorType *ot) RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to remove ", 0, INT_MAX); } +static EnumPropertyItem game_properties_copy_types[] ={ + {1, "REPLACE", 0, "Replace Properties", ""}, + {2, "MERGE", 0, "Merge Properties", ""}, + {3, "CLEAR", 0, "Clear All", ""}, + {4, "COPY", 0, "Copy a Property", ""}, + {0, NULL, 0, NULL, NULL}}; + +static int game_property_copy_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + Object *ob= CTX_data_active_object(C); + bProperty *prop; + int tot=0; + uiPopupMenu *pup; + uiLayout *menu; + + /* count number of available properties */ + prop= ob->prop.first; + while(prop) { + tot++; + prop= prop->next; + } + + /* start building */ + pup= uiPupMenuBegin(C, op->type->name, 0); + menu= uiPupMenuLayout(pup); + uiLayoutSetOperatorContext(menu, WM_OP_EXEC_DEFAULT); + + if(!tot) + uiItemEnumO(menu, "OBJECT_OT_game_property_copy", NULL, 0, "type", 3);//CLEAR); + else { + uiItemEnumO(menu, "OBJECT_OT_game_property_copy", NULL, 0, "type", 1);//REPLACE); + uiItemEnumO(menu, "OBJECT_OT_game_property_copy", NULL, 0, "type", 2);//MERGE); + + //Menu Separator + uiItemL(menu, "Copy a Property", 0); + + prop= ob->prop.first; + while(prop) { + uiItemStringO(menu, prop->name, 0, "OBJECT_OT_game_property_copy", "property", prop->name); + prop= prop->next; + } + } + uiPupMenuEnd(C, pup); + + /* this operator is only for a menu, not used further */ + return OPERATOR_CANCELLED; +} + +static int game_property_copy_exec(bContext *C, wmOperator *op) +{ + Object *ob=ED_object_active_context(C); + bProperty *prop; + char prop_name[32]; + + int type = RNA_enum_get(op->ptr, "type"); + RNA_string_get(op->ptr, "property", prop_name); + + if ( type == 1 || type == 2 || type == 3) { + CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) { + if (ob != ob_iter) { + if (ob->data != ob_iter->data){ + if (type == 2) {/* merge */ + for(prop = ob->prop.first; prop; prop= prop->next ) { + set_ob_property(ob_iter, prop); + } + } else /* replace or clear */ + copy_properties( &ob_iter->prop, &ob->prop ); + } + } + } + CTX_DATA_END; + } + else if(strlen(prop_name) > 0) { /* copy */ + prop = (bProperty *) BLI_findstring(&ob->prop, prop_name, offsetof(bProperty, name)); + + if(prop) { + CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) { + if (ob != ob_iter) { + if (ob->data != ob_iter->data) + set_ob_property(ob_iter, prop); + } + } CTX_DATA_END; + } + } + return OPERATOR_FINISHED; +} + +void OBJECT_OT_game_property_copy(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Copy Game Property"; + ot->idname= "OBJECT_OT_game_property_copy"; + + /* api callbacks */ + ot->invoke= game_property_copy_invoke; + ot->exec= game_property_copy_exec; + ot->poll= ED_operator_object_active_editable; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_enum(ot->srna, "type", game_properties_copy_types, 4, "Operation", ""); + RNA_def_string(ot->srna, "property", "", 32, "Name", "Name of the property to copy"); +} + +/************************ Copy Logic Bricks ***********************/ + +static int logicbricks_copy_exec(bContext *C, wmOperator *op) +{ + Object *ob=ED_object_active_context(C); + + CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) { + if(ob != ob_iter) { + if (ob->data != ob_iter->data){ + /* first: free all logic */ + free_sensors(&ob_iter->sensors); + unlink_controllers(&ob_iter->controllers); + free_controllers(&ob_iter->controllers); + unlink_actuators(&ob_iter->actuators); + free_actuators(&ob_iter->actuators); + + /* now copy it, this also works without logicbricks! */ + clear_sca_new_poins_ob(ob); + copy_sensors(&ob_iter->sensors, &ob->sensors); + copy_controllers(&ob_iter->controllers, &ob->controllers); + copy_actuators(&ob_iter->actuators, &ob->actuators); + set_sca_new_poins_ob(ob_iter); + + /* some menu settings */ + ob_iter->scavisflag= ob->scavisflag; + ob_iter->scaflag= ob->scaflag; + + /* set the initial state */ + ob_iter->state= ob->state; + ob_iter->init_state= ob->init_state; + } + if(ob_iter->totcol==ob->totcol) { + ob_iter->actcol= ob->actcol; + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob_iter); + } + } + } + CTX_DATA_END; + + WM_event_add_notifier(C, NC_LOGIC, NULL); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Copy Logic Bricks to Selected"; + ot->description = "Copy logic bricks to other selected objects."; + ot->idname= "OBJECT_OT_logic_bricks_copy"; + + /* api callbacks */ + ot->exec= logicbricks_copy_exec; + ot->poll= ED_operator_object_active_editable; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 7e1f2cbbfdc..2d8faa60bea 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -85,6 +85,11 @@ void OBJECT_OT_shade_flat(struct wmOperatorType *ot); void OBJECT_OT_paths_calculate(struct wmOperatorType *ot); void OBJECT_OT_paths_clear(struct wmOperatorType *ot); +void OBJECT_OT_game_property_new(struct wmOperatorType *ot); +void OBJECT_OT_game_property_remove(struct wmOperatorType *ot); +void OBJECT_OT_game_property_copy(struct wmOperatorType *ot); +void OBJECT_OT_logic_bricks_copy(struct wmOperatorType *ot); + /* object_select.c */ void OBJECT_OT_select_all(struct wmOperatorType *ot); void OBJECT_OT_select_inverse(struct wmOperatorType *ot); @@ -201,9 +206,6 @@ void OBJECT_OT_vertex_group_set_active(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_sort(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_move(struct wmOperatorType *ot); -void OBJECT_OT_game_property_new(struct wmOperatorType *ot); -void OBJECT_OT_game_property_remove(struct wmOperatorType *ot); - /* object_shapekey.c */ void OBJECT_OT_shape_key_add(struct wmOperatorType *ot); void OBJECT_OT_shape_key_remove(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 4cfed57f9c7..3c5928d86c2 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -413,7 +413,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob, multires_force_update(ob); if (mmd && mti->type==eModifierTypeType_OnlyDeform) { - multiresModifier_reshapeFromDeformMod (mmd, ob, md); + multiresModifier_reshapeFromDeformMod (ob, md); } else { dm = mesh_create_derived_for_modifier(scene, ob, md); if (!dm) { @@ -972,7 +972,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - if(!multiresModifier_reshape(mmd, ob, secondob)) { + if(!multiresModifier_reshape(ob, secondob)) { BKE_report(op->reports, RPT_ERROR, "Objects do not have the same number of vertices."); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 759e13bffb0..ce1967a1d44 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -183,6 +183,8 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_game_property_new); WM_operatortype_append(OBJECT_OT_game_property_remove); + WM_operatortype_append(OBJECT_OT_game_property_copy); + WM_operatortype_append(OBJECT_OT_logic_bricks_copy); WM_operatortype_append(OBJECT_OT_shape_key_add); WM_operatortype_append(OBJECT_OT_shape_key_remove); diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 57a123d8f17..5ebbb00939e 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -71,7 +71,7 @@ static int ptcache_bake_all_poll(bContext *C) static int ptcache_poll(bContext *C) { - PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); + PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); return (ptr.data && ptr.id.data); } @@ -89,7 +89,7 @@ void bake_console_progress_end(void *arg) static int ptcache_bake_all_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - wmWindow *win = CTX_wm_window(C); + wmWindow *win = G.background ? NULL : CTX_wm_window(C); PTCacheBaker baker; @@ -171,8 +171,8 @@ void PTCACHE_OT_free_bake_all(wmOperatorType *ot) static int ptcache_bake_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - wmWindow *win = CTX_wm_window(C); - PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); + wmWindow *win = G.background ? NULL : CTX_wm_window(C); + PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); Object *ob= ptr.id.data; PointCache *cache= ptr.data; PTCacheBaker baker; @@ -216,7 +216,7 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op) } static int ptcache_free_bake_exec(bContext *C, wmOperator *op) { - PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); + PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); PointCache *cache= ptr.data; if(cache->edit) { @@ -233,7 +233,7 @@ static int ptcache_free_bake_exec(bContext *C, wmOperator *op) } static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *op) { - PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); + PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); PointCache *cache= ptr.data; cache->flag |= PTCACHE_BAKED; @@ -285,7 +285,7 @@ void PTCACHE_OT_bake_from_cache(wmOperatorType *ot) static int ptcache_add_new_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); + PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); Object *ob= ptr.id.data; PointCache *cache= ptr.data; PTCacheID *pid; @@ -308,7 +308,7 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *op) } static int ptcache_remove_exec(bContext *C, wmOperator *op) { - PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); + PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); Scene *scene= CTX_data_scene(C); Object *ob= ptr.id.data; PointCache *cache= ptr.data; diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index ee5363a00f9..aded83c0d16 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -211,7 +211,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) if(oglrender->timer) { /* exec will not have a timer */ scene->r.cfra= oglrender->cfrao; - scene_update_for_newframe(scene, scene->lay); + scene_update_for_newframe(scene, scene->lay|oglrender->v3d->lay); WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), oglrender->timer); } @@ -268,16 +268,16 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) /* go to next frame */ while(CFRA<oglrender->nfra) { - if(scene->lay & 0xFF000000) - lay= scene->lay & 0xFF000000; - else - lay= scene->lay; + lay = scene->lay | oglrender->v3d->lay; + + if(lay & 0xFF000000) + lay &= 0xFF000000; scene_update_for_newframe(scene, lay); CFRA++; } - - scene_update_for_newframe(scene, scene->lay); + + scene_update_for_newframe(scene, scene->lay | oglrender->v3d->lay); if(oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) { /* since scene_update_for_newframe() is used rather diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 244997775fc..8b1c0045fd3 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3040,7 +3040,8 @@ void ED_keymap_screen(wmKeyConfig *keyconf) RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELDOWNMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", 1); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELUPMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", -1); - WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 1); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 0); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 1); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 0); diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index a0616b5f37b..b6e3327bd12 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -133,7 +133,7 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max) int filter; /* get data to filter, from Action or Dopesheet */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* set large values to try to override */ @@ -284,7 +284,7 @@ static short copy_action_keys (bAnimContext *ac) free_anim_copybuf(); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* copy keyframes */ @@ -303,7 +303,7 @@ static short paste_action_keys (bAnimContext *ac) int filter, ok=0; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* paste keyframes */ @@ -421,7 +421,7 @@ static void insert_action_keys(bAnimContext *ac, short mode) short flag = 0; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); if (mode == 2) filter |= ANIMFILTER_SEL; else if (mode == 3) filter |= ANIMFILTER_ACTGROUPED; @@ -508,9 +508,9 @@ static void duplicate_action_keys (bAnimContext *ac) /* filter data */ if (ac->datatype == ANIMCONT_GPENCIL) - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and delete selected keys */ @@ -586,9 +586,9 @@ static void delete_action_keys (bAnimContext *ac) /* filter data */ if (ac->datatype == ANIMCONT_GPENCIL) - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and delete selected keys */ @@ -659,7 +659,7 @@ static void clean_action_keys (bAnimContext *ac, float thresh) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and clean curves */ @@ -727,7 +727,7 @@ static void sample_action_keys (bAnimContext *ac) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and add keys between selected keyframes on every frame */ @@ -797,7 +797,7 @@ static void setexpo_action_keys(bAnimContext *ac, short mode) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting mode per F-Curve */ @@ -868,7 +868,7 @@ static void setipo_action_keys(bAnimContext *ac, short mode) KeyframeEditFunc set_cb= ANIM_editkeyframes_ipo(mode); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting BezTriple interpolation @@ -952,7 +952,7 @@ static void sethandles_action_keys(bAnimContext *ac, short mode) KeyframeEditFunc sel_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting flags for handles @@ -1036,7 +1036,7 @@ static void setkeytype_action_keys(bAnimContext *ac, short mode) KeyframeEditFunc set_cb= ANIM_editkeyframes_keytype(mode); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting BezTriple interpolation @@ -1118,7 +1118,7 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *op) memset(&ked, 0, sizeof(KeyframeEditData)); /* loop over action data, averaging values */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -1186,7 +1186,7 @@ static void snap_action_keys(bAnimContext *ac, short mode) if (ac->datatype == ANIMCONT_GPENCIL) filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* get beztriple editing callbacks */ @@ -1311,9 +1311,9 @@ static void mirror_action_keys(bAnimContext *ac, short mode) /* filter data */ if (ac->datatype == ANIMCONT_GPENCIL) - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* mirror keyframes */ diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 29a87ec849b..33f918c0711 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -95,9 +95,9 @@ static void deselect_action_keys (bAnimContext *ac, short test, short sel) /* determine type-based settings */ if (ac->datatype == ANIMCONT_GPENCIL) - filter= (ANIMFILTER_VISIBLE); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NODUPLIS); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); /* filter data */ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); @@ -212,7 +212,7 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax-2, &rectf.xmax, &rectf.ymax); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* get filtering flag for dopesheet data (if applicable) */ @@ -389,7 +389,7 @@ static void markers_selectkeys_between (bAnimContext *ac) ked.f2= max; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* select keys in-between */ @@ -572,7 +572,7 @@ static int actkeys_select_linked_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* loop through all of the keys and select additional keyframes based on these */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -627,7 +627,7 @@ static void select_moreless_action_keys (bAnimContext *ac, short mode) memset(&ked, 0, sizeof(KeyframeEditData)); /* loop through all of the keys and select additional keyframes based on these */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -800,9 +800,9 @@ static void actkeys_mselect_leftright (bAnimContext *ac, short leftright, short /* filter data */ if (ac->datatype == ANIMCONT_GPENCIL) - filter= (ANIMFILTER_VISIBLE); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NODUPLIS); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* select keys on the side where most data occurs */ @@ -823,13 +823,14 @@ static void actkeys_mselect_leftright (bAnimContext *ac, short leftright, short /* Sync marker support */ if((select_mode==SELECT_ADD) && (ac->spacetype==SPACE_ACTION) && ELEM(leftright, ACTKEYS_LRSEL_LEFT, ACTKEYS_LRSEL_RIGHT)) { SpaceAction *saction= ac->sa->spacedata.first; + if (saction && saction->flag & SACTION_MARKERS_MOVE) { TimeMarker *marker; - + for (marker= scene->markers.first; marker; marker= marker->next) { - if( ((leftright == ACTKEYS_LRSEL_LEFT) && marker->frame < CFRA) || - ((leftright == ACTKEYS_LRSEL_RIGHT) && marker->frame >= CFRA) - ) { + if( ((leftright == ACTKEYS_LRSEL_LEFT) && (marker->frame < CFRA)) || + ((leftright == ACTKEYS_LRSEL_RIGHT) && (marker->frame >= CFRA)) ) + { marker->flag |= SELECT; } else { @@ -864,9 +865,9 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se * based on the keys found to be selected above */ if (ac->datatype == ANIMCONT_GPENCIL) - filter= (ANIMFILTER_VISIBLE); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NODUPLIS); else - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -997,10 +998,8 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short select_mode, gpl_to_keylist(ads, gpl, &anim_keys, NULL); } - // the call below is not strictly necessary, since we have adjacency info anyway - //BLI_dlrbTree_linkedlist_sync(&anim_keys); - /* loop through keyframes, finding one that was within the range clicked on */ + // TODO: replace this with API calls instead of inlining for (ak= anim_keys.root; ak; ak= akn) { if (IN_RANGE(ak->cfra, rectf.xmin, rectf.xmax)) { /* set the frame to use, and apply inverse-correction for NLA-mapping diff --git a/source/blender/editors/space_file/Makefile b/source/blender/editors/space_file/Makefile index 43b2f09ed2d..29548b51222 100644 --- a/source/blender/editors/space_file/Makefile +++ b/source/blender/editors/space_file/Makefile @@ -63,3 +63,7 @@ ifeq ($(WITH_OPENEXR), true) CPPFLAGS += -DWITH_OPENEXR endif +ifeq ($(WITH_TIFF), true) + CPPFLAGS += -DWITH_TIFF +endif + diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript index b22a265dcbc..9de705e99d3 100644 --- a/source/blender/editors/space_file/SConscript +++ b/source/blender/editors/space_file/SConscript @@ -12,9 +12,13 @@ defs = [] if env['WITH_BF_OPENJPEG']: defs.append('WITH_OPENJPEG') + if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') +if env['WITH_BF_TIFF']: + defs.append('WITH_TIFF') + if env['OURPLATFORM'] == 'linux2': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c index c9b30983b93..05efdc12596 100644 --- a/source/blender/editors/space_file/writeimage.c +++ b/source/blender/editors/space_file/writeimage.c @@ -143,10 +143,11 @@ void save_image_filesel_str(Scene *scene, char *str) case R_BMP: strcpy(str, "Save BMP"); break; +#ifdef WITH_TIFF case R_TIFF: - if (G.have_libtiff) - strcpy(str, "Save TIFF"); + strcpy(str, "Save TIFF"); break; +#endif #ifdef WITH_OPENEXR case R_OPENEXR: strcpy(str, "Save OpenEXR"); diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 5751fb0300e..bf433923707 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -208,11 +208,88 @@ static void graph_panel_properties(const bContext *C, Panel *pa) uiLayoutSetEnabled(subrow, (fcu->color_mode==FCURVE_COLOR_CUSTOM)); uiItemR(subrow, &fcu_ptr, "color", 0, "", 0); - /* TODO: the following settings could be added here - * - Access details (ID-block + RNA-Path + Array Index) - * - ... + MEM_freeN(ale); +} + +/* ******************* active Keyframe ************** */ + +/* get 'active' keyframe for panel editing */ +static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezTriple **prevbezt) +{ + BezTriple *b; + int i; + + /* zero the pointers */ + *bezt = *prevbezt = NULL; + + /* sanity checks */ + if ((fcu->bezt == NULL) || (fcu->totvert == 0)) + return 0; + + /* find first selected keyframe for now, and call it the active one + * - this is a reasonable assumption, given that whenever anyone + * wants to edit numerically, there is likely to only be 1 vert selected */ + for (i=0, b=fcu->bezt; i < fcu->totvert; i++, b++) { + if (BEZSELECTED(b)) { + /* found + * - 'previous' is either the one before, of the keyframe itself (which is still fine) + * XXX: we can just make this null instead if needed + */ + *prevbezt = (i > 0) ? b-1 : b; + *bezt = b; + + return 1; + } + } + + /* not found */ + return 0; +} +static void graph_panel_key_properties(const bContext *C, Panel *pa) +{ + bAnimListElem *ale; + FCurve *fcu; + BezTriple *bezt, *prevbezt; + + uiLayout *layout = pa->layout; + uiLayout *col; + uiBlock *block; + + if (!graph_panel_context(C, &ale, &fcu)) + return; + + block = uiLayoutGetBlock(layout); + uiBlockSetHandleFunc(block, do_graph_region_buttons, NULL); + + /* only show this info if there are keyframes to edit */ + if (get_active_fcurve_keyframe_edit(fcu, &bezt, &prevbezt)) { + PointerRNA bezt_ptr; + + /* RNA pointer to keyframe, to allow editing */ + RNA_pointer_create(ale->id, &RNA_Keyframe, bezt, &bezt_ptr); + + /* interpolation */ + col= uiLayoutColumn(layout, 0); + uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, 0); + + /* numerical coordinate editing */ + col= uiLayoutColumn(layout, 1); + /* keyframe itself */ + uiItemR(col, &bezt_ptr, "co", 0, "Key", 0); + + /* previous handle - only if previous was Bezier interpolation */ + if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) + uiItemR(col, &bezt_ptr, "handle1", 0, NULL, 0); + + /* next handle - only if current is Bezier interpolation */ + if (bezt->ipo == BEZT_IPO_BEZ) + uiItemR(col, &bezt_ptr, "handle2", 0, NULL, 0); + } + else + uiItemL(layout, "No active keyframe on F-Curve", 0); + MEM_freeN(ale); } @@ -631,6 +708,7 @@ void graph_buttons_register(ARegionType *art) strcpy(pt->idname, "GRAPH_PT_view"); strcpy(pt->label, "View Properties"); pt->draw= graph_panel_view; + pt->flag |= PNL_DEFAULT_CLOSED; BLI_addtail(&art->paneltypes, pt); pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel properties"); @@ -639,6 +717,14 @@ void graph_buttons_register(ARegionType *art) pt->draw= graph_panel_properties; pt->poll= graph_panel_poll; BLI_addtail(&art->paneltypes, pt); + + pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel properties"); + strcpy(pt->idname, "GRAPH_PT_key_properties"); + strcpy(pt->label, "Active Keyframe"); + pt->draw= graph_panel_key_properties; + pt->poll= graph_panel_poll; + BLI_addtail(&art->paneltypes, pt); + pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers"); strcpy(pt->idname, "GRAPH_PT_drivers"); diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index c762912b297..9322bae13c9 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -86,7 +86,7 @@ void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, flo int filter; /* get data to filter, from Dopesheet */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* set large values to try to override */ @@ -258,7 +258,7 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end) } /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and add keys between selected keyframes on every frame */ @@ -417,7 +417,7 @@ static void insert_graph_keys(bAnimContext *ac, short mode) short flag = 0; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); if (mode == 2) filter |= ANIMFILTER_SEL; ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); @@ -456,8 +456,6 @@ static int graphkeys_insertkey_exec(bContext *C, wmOperator *op) /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - if (ac.datatype == ANIMCONT_GPENCIL) - return OPERATOR_CANCELLED; /* which channels to affect? */ mode= RNA_enum_get(op->ptr, "type"); @@ -599,7 +597,7 @@ static short copy_graph_keys (bAnimContext *ac) free_anim_copybuf(); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* copy keyframes */ @@ -617,7 +615,7 @@ static short paste_graph_keys (bAnimContext *ac) int filter, ok=0; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* paste keyframes */ @@ -713,7 +711,7 @@ static void duplicate_graph_keys (bAnimContext *ac) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and delete selected keys */ @@ -785,7 +783,7 @@ static void delete_graph_keys (bAnimContext *ac) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and delete selected keys */ @@ -852,7 +850,7 @@ static void clean_graph_keys (bAnimContext *ac, float thresh) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and clean curves */ @@ -919,7 +917,7 @@ static void bake_graph_curves (bAnimContext *ac, int start, int end) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and add keys between selected keyframes on every frame */ @@ -1066,7 +1064,7 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op) end = CFRA + sbi.length - 1; /* filter anim channels */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* loop through all selected F-Curves, replacing its data with the sound samples */ @@ -1144,7 +1142,7 @@ static void sample_graph_keys (bAnimContext *ac) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and add keys between selected keyframes on every frame */ @@ -1213,7 +1211,7 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting mode per F-Curve */ @@ -1282,7 +1280,7 @@ static void setipo_graph_keys(bAnimContext *ac, short mode) KeyframeEditFunc set_cb= ANIM_editkeyframes_ipo(mode); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting BezTriple interpolation @@ -1364,7 +1362,7 @@ static void sethandles_graph_keys(bAnimContext *ac, short mode) KeyframeEditFunc sel_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting flags for handles @@ -1475,7 +1473,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op) */ /* step 1: extract only the rotation f-curves */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_FOREDIT); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -1554,7 +1552,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *op) memset(&ked, 0, sizeof(KeyframeEditData)); /* loop over action data, averaging values */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -1632,7 +1630,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode) KeyframeEditFunc edit_cb; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* get beztriple editing callbacks */ @@ -1770,7 +1768,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode) } /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* mirror keyframes */ @@ -1854,7 +1852,7 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* smooth keyframes */ @@ -1945,7 +1943,7 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op) type= RNA_enum_get(op->ptr, "type"); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); if (RNA_boolean_get(op->ptr, "only_active")) filter |= ANIMFILTER_ACTIVE; else diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 9c898cf1cd7..f347bfea290 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -95,7 +95,7 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel) KeyframeEditFunc test_cb, sel_cb; /* determine type-based settings */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); /* filter data */ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); @@ -213,7 +213,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* get beztriple editing/validation funcs */ @@ -402,7 +402,7 @@ static void markers_selectkeys_between (bAnimContext *ac) ked.f2= max; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* select keys in-between */ @@ -442,7 +442,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode) /* build list of columns */ switch (mode) { case GRAPHKEYS_COLUMNSEL_KEYS: /* list of selected keys */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) @@ -474,7 +474,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode) /* loop through all of the keys and select additional keyframes * based on the keys found to be selected above */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -561,7 +561,7 @@ static int graphkeys_select_linked_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* loop through all of the keys and select additional keyframes based on these */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -616,7 +616,7 @@ static void select_moreless_graph_keys (bAnimContext *ac, short mode) memset(&ked, 0, sizeof(KeyframeEditData)); /* loop through all of the keys and select additional keyframes based on these */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -834,7 +834,7 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, int mval[2], ListBa * - if the option to only show keyframes that belong to selected F-Curves is enabled, * include the 'only selected' flag... */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); if (sipo->flag & SIPO_SELCUVERTSONLY) // FIXME: this should really be check for by the filtering code... filter |= ANIMFILTER_SEL; ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); @@ -1055,7 +1055,7 @@ static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, s /* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */ if (nvi->fcu->flag & FCURVE_SELECTED) { - int filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + int filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nvi->fcu, ANIMTYPE_FCURVE); } } @@ -1107,7 +1107,7 @@ static void graphkeys_mselect_leftright (bAnimContext *ac, short leftright, shor } /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* select keys on the side where most data occurs */ @@ -1180,7 +1180,7 @@ static void graphkeys_mselect_column (bAnimContext *ac, int mval[2], short selec /* loop through all of the keys and select additional keyframes * based on the keys found to be selected above */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) { diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 2c66cb51fba..e7cee30f374 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -521,7 +521,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa) * - we don't include ANIMFILTER_CURVEVISIBLE filter, as that will result in a * mismatch between channel-colors and the drawn curves */ - filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY|ANIMFILTER_NODUPLIS); items= ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* loop over F-Curves, assigning colors */ diff --git a/source/blender/editors/space_image/Makefile b/source/blender/editors/space_image/Makefile index af15b1d9724..4f532166bc7 100644 --- a/source/blender/editors/space_image/Makefile +++ b/source/blender/editors/space_image/Makefile @@ -57,3 +57,7 @@ ifeq ($(WITH_OPENEXR), true) CPPFLAGS += -DWITH_OPENEXR endif +ifeq ($(WHITH_TIFF), true) + CPPFLAGS += -DWITH_TIFF +endif + diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript index dd43559645d..b38e1473a0c 100644 --- a/source/blender/editors/space_image/SConscript +++ b/source/blender/editors/space_image/SConscript @@ -13,6 +13,8 @@ if env['WITH_BF_LCMS']: defs.append('WITH_LCMS') if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') +if env['WITH_BF_TIFF']: + defs.append('WITH_TIFF') if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 1241dbd9f4e..64d24ed578a 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -637,8 +637,9 @@ static const EnumPropertyItem image_file_type_items[] = { {R_JP2, "JPEG_2000", 0, "Jpeg 2000", ""}, #endif {R_IRIS, "IRIS", 0, "Iris", ""}, - //if(G.have_libtiff) +#ifdef WITH_TIFF {R_TIFF, "TIFF", 0, "Tiff", ""}, +#endif {R_RADHDR, "RADIANCE_HDR", 0, "Radiance HDR", ""}, {R_CINEON, "CINEON", 0, "Cineon", ""}, {R_DPX, "DPX", 0, "DPX", ""}, @@ -1155,7 +1156,6 @@ static int reload_exec(bContext *C, wmOperator *op) BKE_image_signal(ima, (sima)? &sima->iuser: NULL, IMA_SIGNAL_RELOAD); WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima); - ED_area_tag_redraw(CTX_wm_area(C)); return OPERATOR_FINISHED; } @@ -1168,7 +1168,6 @@ void IMAGE_OT_reload(wmOperatorType *ot) /* api callbacks */ ot->exec= reload_exec; - ot->poll= space_image_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index f9310909f2c..69fd740d288 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3221,9 +3221,14 @@ static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr) bArmatureSensor *as = (bArmatureSensor *) sens->data; Object *ob = (Object *)ptr->id.data; PointerRNA pose_ptr, pchan_ptr; - PropertyRNA *bones_prop; + PropertyRNA *bones_prop= NULL; uiLayout *row; + if(ob->type != OB_ARMATURE){ + uiItemL(layout, "Sensor only available for armatures", 0); + return; + } + if (ob->pose) { RNA_pointer_create((ID *)ob, &RNA_Pose, ob->pose, &pose_ptr); bones_prop = RNA_struct_find_property(&pose_ptr, "bones"); @@ -3588,6 +3593,10 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) PointerRNA settings_ptr; uiLayout *row; + if(ob->type != OB_ARMATURE){ + uiItemL(layout, "Actuator only available for armatures", 0); + return; + } RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); row= uiLayoutRow(layout, 0); @@ -3623,6 +3632,11 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) Object *ob = (Object *)ptr->id.data; PointerRNA pose_ptr, pchan_ptr; PropertyRNA *bones_prop; + + if(ob->type != OB_ARMATURE){ + uiItemL(layout, "Actuator only available for armatures", 0); + return; + } if (ob->pose) { RNA_pointer_create((ID *)ob, &RNA_Pose, ob->pose, &pose_ptr); @@ -3782,6 +3796,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr) static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) { + Object *ob = (Object *)ptr->id.data; uiLayout *row, *split, *subsplit; uiItemR(layout, ptr, "mode", 0, NULL, 0); @@ -3805,6 +3820,10 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) case ACT_EDOB_END_OBJECT: break; case ACT_EDOB_REPLACE_MESH: + if(ob->type != OB_MESH) { + uiItemL(layout, "Mode only available for mesh objects", 0); + break; + } split = uiLayoutSplit(layout, 0.6, 0); uiItemR(split, ptr, "mesh", 0, NULL, 0); row = uiLayoutRow(split, 0); @@ -3819,6 +3838,10 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) uiItemR(subsplit, ptr, "enable_3d_tracking", UI_ITEM_R_TOGGLE, NULL, 0); break; case ACT_EDOB_DYNAMICS: + if(ob->type != OB_MESH) { + uiItemL(layout, "Mode only available for mesh objects", 0); + break; + } uiItemR(layout, ptr, "dynamic_operation", 0, NULL, 0); if (RNA_enum_get(ptr, "dynamic_operation") == ACT_EDOB_SET_MASS) uiItemR(layout, ptr, "mass", 0, NULL, 0); @@ -4144,6 +4167,11 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr) PointerRNA settings_ptr; uiLayout *row; + if(ob->type != OB_MESH){ + uiItemL(layout, "Actuator only available for mesh objects", 0); + return; + } + RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); row= uiLayoutRow(layout, 0); diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 89eff3beb0c..ed3d956ce01 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -182,6 +182,7 @@ void logic_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "LOGIC_OT_links_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_menu(keymap, "LOGIC_MT_logicbricks_add", AKEY, KM_PRESS, KM_SHIFT, 0); } static void logic_refresh(const bContext *C, ScrArea *sa) diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index b76d90bd0f9..1416e0afdc9 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -70,7 +70,7 @@ static short selmodes_to_flagmodes (short sel) break; case SELECT_INVERT: - return ACHANNEL_SETFLAG_TOGGLE; + return ACHANNEL_SETFLAG_INVERT; break; case SELECT_ADD: diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 164ca6c21b0..9deb0ba4a0a 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1650,10 +1650,10 @@ static int sequencer_cut_invoke(bContext *C, wmOperator *op, wmEvent *event) Scene *scene = CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); View2D *v2d= UI_view2d_fromcontext(C); - - int cut_side, cut_frame; - - cut_frame= CFRA; + + int cut_side= SEQ_SIDE_BOTH; + int cut_frame= CFRA; + if (ED_operator_sequencer_active(C) && v2d) cut_side= mouse_frame_side(v2d, event->x - ar->winrct.xmin, cut_frame); diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index 0a8f19493fa..1bc51de4471 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -199,6 +199,21 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar, glVertex3fv(mpv->co); glEnd(); + /* Draw big green dot where the current frame is */ + // NOTE: only do this when drawing keyframes for now... + if (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) { + UI_ThemeColor(TH_CFRAME); + glPointSize(6.0f); + + glBegin(GL_POINTS); + mpv = mpv_start + (CFRA - sfra); + glVertex3fv(mpv->co); + glEnd(); + + glPointSize(1.0f); + UI_ThemeColor(TH_TEXT_HI); + } + /* Draw frame numbers at each framestep value */ if (avs->path_viewflag & MOTIONPATH_VIEW_FNUMS) { for (i=0, mpv=mpv_start; i < len; i+=stepsize, mpv+=stepsize) { @@ -220,9 +235,9 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar, } } } - + /* Keyframes - dots and numbers */ - if (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) { + if (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) { AnimData *adt= BKE_animdata_from_id(&ob->id); DLRBT_Tree keys; @@ -230,8 +245,10 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar, BLI_dlrbTree_init(&keys); if (adt) { - /* for now, it is assumed that keyframes for bones are all grouped in a single group */ - if (pchan) { + /* it is assumed that keyframes for bones are all grouped in a single group + * unless an option is set to always use the whole action + */ + if ((pchan) && (avs->path_viewflag & MOTIONPATH_VIEW_KFACT)==0) { bActionGroup *agrp= action_groups_find_named(adt->action, pchan->name); if (agrp) { @@ -261,7 +278,7 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar, glPointSize(1.0f); /* Draw frame numbers of keyframes */ - if (avs->path_viewflag & MOTIONPATH_VIEW_FNUMS) { + if (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) { for (i=0, mpv=mpv_start; i < len; i++, mpv++) { float mframe= (float)(sfra + i); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 70f20df507b..7c0ccfa770c 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -30,10 +30,6 @@ #include "MEM_guardedalloc.h" - - - - #include "DNA_camera_types.h" #include "DNA_curve_types.h" #include "DNA_constraint_types.h" // for drawing constraint @@ -2488,7 +2484,8 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D if (ob==OBACT && paint_facesel_test(ob)) draw_wire = 0; if(dt==OB_BOUNDBOX) { - draw_bounding_volume(scene, ob); + if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) + draw_bounding_volume(scene, ob); } else if(hasHaloMat || (totface==0 && totedge==0)) { glPointSize(1.5); @@ -2714,8 +2711,9 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D glDepthMask(0); // disable write in zbuffer, selected edge wires show better } - dm->drawEdges(dm, (dt==OB_WIRE || totface==0), 0); - + if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0) + dm->drawEdges(dm, (dt==OB_WIRE || totface==0), 0); + if (dt!=OB_WIRE && draw_wire==2) { glDepthMask(1); bglPolygonOffset(rv3d->dist, 0.0); @@ -3082,7 +3080,8 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B glDisable(GL_LIGHTING); GPU_end_object_materials(); } else { - drawCurveDMWired (ob); + if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0) + drawCurveDMWired (ob); } return 0; @@ -5839,8 +5838,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) set_inverted_drawing(0); } } - else if(dt==OB_BOUNDBOX) - draw_bounding_volume(scene, ob); + else if(dt==OB_BOUNDBOX) { + if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) + draw_bounding_volume(scene, ob); + } else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) empty_object= drawDispList(scene, v3d, rv3d, base, dt); @@ -5852,8 +5853,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(cu->editnurb) { drawnurb(scene, v3d, rv3d, base, cu->editnurb->first, dt); } - else if(dt==OB_BOUNDBOX) - draw_bounding_volume(scene, ob); + else if(dt==OB_BOUNDBOX) { + if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) + draw_bounding_volume(scene, ob); + } else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { empty_object= drawDispList(scene, v3d, rv3d, base, dt); @@ -5867,8 +5870,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(mb->editelems) drawmball(scene, v3d, rv3d, base, dt); - else if(dt==OB_BOUNDBOX) - draw_bounding_volume(scene, ob); + else if(dt==OB_BOUNDBOX) { + if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) + draw_bounding_volume(scene, ob); + } else empty_object= drawmball(scene, v3d, rv3d, base, dt); break; @@ -5905,7 +5910,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } } - if((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { + if((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { if(ob->soft /*&& flag & OB_SBMOTION*/){ float mrt[3][3],msc[3][3],mtr[3][3]; @@ -6103,7 +6108,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(dtx & OB_AXIS) { drawaxes(rv3d, rv3d->viewmatob, 1.0f, flag, OB_ARROWS); } - if(dtx & OB_BOUNDBOX) draw_bounding_volume(scene, ob); + if(dtx & OB_BOUNDBOX) { + if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) + draw_bounding_volume(scene, ob); + } if(dtx & OB_TEXSPACE) drawtexspace(ob); if(dtx & OB_DRAWNAME) { /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */ diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 9f9733bc80c..53fd0125329 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1965,7 +1965,10 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, /* set flags */ G.f |= G_RENDER_OGL; - GPU_free_images(); + + /* free images which can have changed on frame-change + * warning! can be slow so only free animated images - campbell */ + GPU_free_images_anim(); /* set background color, fallback on the view background color */ if(scene->world) { @@ -2030,7 +2033,8 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */ draw_gpencil_view3d_ext(scene, ar, 0); - GPU_free_images(); + /* freeing the images again here could be done after the operator runs, leaving for now */ + GPU_free_images_anim(); /* restore size */ ar->winx= bwinx; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 6a661f18959..31ddc442cc2 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1719,7 +1719,8 @@ int ED_view3d_context_activate(bContext *C) ARegion *ar; RegionView3D *rv3d; - if(sa->spacetype != SPACE_VIEW3D) + /* sa can be NULL when called from python */ + if(sa==NULL || sa->spacetype != SPACE_VIEW3D) for(sa=sc->areabase.first; sa; sa= sa->next) if(sa->spacetype==SPACE_VIEW3D) break; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 2002eb5a549..aab9f0d5d62 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -258,9 +258,8 @@ void projectFloatView(TransInfo *t, float *vec, float *adr) void applyAspectRatio(TransInfo *t, float *vec) { - SpaceImage *sima= t->sa->spacedata.first; - if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) { + SpaceImage *sima= t->sa->spacedata.first; float aspx, aspy; if((sima->flag & SI_COORDFLOATS)==0) { @@ -279,9 +278,8 @@ void applyAspectRatio(TransInfo *t, float *vec) void removeAspectRatio(TransInfo *t, float *vec) { - SpaceImage *sima= t->sa->spacedata.first; - if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) { + SpaceImage *sima= t->sa->spacedata.first; float aspx, aspy; if((sima->flag & SI_COORDFLOATS)==0) { diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index d1b6838c517..499631ff755 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3256,7 +3256,9 @@ static void createTransActionData(bContext *C, TransInfo *t) /* Helper function for createTransGraphEditData, which is reponsible for associating * source data with transform data */ -static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, BezTriple *bezt, int bi, short selected, short ishandle, short intvals) +static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, BezTriple *bezt, + int bi, short selected, short ishandle, short intvals, + float mtx[3][3], float smtx[3][3]) { float *loc = bezt->vec[bi]; float *cent = bezt->vec[1]; @@ -3326,8 +3328,9 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, if (intvals) td->flag |= TD_INTVALUES; - unit_m3(td->mtx); - unit_m3(td->smtx); + /* copy space-conversion matrices for dealing with non-uniform scales */ + copy_m3_m3(td->mtx, mtx); + copy_m3_m3(td->smtx, smtx); } static void createTransGraphEditData(bContext *C, TransInfo *t) @@ -3348,6 +3351,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) BezTriple *bezt; int count=0, i; float cfra; + float mtx[3][3], smtx[3][3]; /* determine what type of data we are operating on */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -3387,7 +3391,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) /* F-Curve may not have any keyframes */ if (fcu->bezt == NULL) continue; - + /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse */ for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) { @@ -3409,7 +3413,8 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) if (bezt->f1 & SELECT) count++; if (bezt->f3 & SELECT) count++; } - } else { + } + else { /* for 'normal' pivots - just include anything that is selected */ if (bezt->f1 & SELECT) count++; if (bezt->f2 & SELECT) count++; @@ -3436,12 +3441,31 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) td= t->data; td2d= t->data2d; + /* precompute space-conversion matrices for dealing with non-uniform scaling of Graph Editor */ + unit_m3(mtx); + unit_m3(smtx); + + if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) { + float xscale, yscale; + + /* apply scale factors to x and y axes of space-conversion matrices */ + UI_view2d_getscale(v2d, &xscale, &yscale); + + /* mtx is data to global (i.e. view) conversion */ + mul_v3_fl(mtx[0], xscale); + mul_v3_fl(mtx[1], yscale); + + /* smtx is global (i.e. view) to data conversion */ + if (IS_EQ(xscale, 0.0f) == 0) mul_v3_fl(smtx[0], 1.0f/xscale); + if (IS_EQ(yscale, 0.0f) == 0) mul_v3_fl(smtx[1], 1.0f/yscale); + } + /* loop 2: build transdata arrays */ for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(&ac, ale); FCurve *fcu= (FCurve *)ale->key_data; short intvals= (fcu->flag & FCURVE_INT_VALUES); - + /* convert current-frame to action-time (slightly less accurate, espcially under * higher scaling ratios, but is faster than converting all points) */ @@ -3463,31 +3487,33 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) short h1=1, h2=1; /* only include handles if selected, irrespective of the interpolation modes. - also, only treat handles specially if the center point isn't selected. */ + * also, only treat handles specially if the center point isn't selected. + */ if (!ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE) || !(bezt->f2 & SELECT)) { if (bezt->f1 & SELECT) { hdata = initTransDataCurveHandles(td, bezt); - bezt_to_transdata(td++, td2d++, adt, bezt, 0, 1, 1, intvals); - } else + bezt_to_transdata(td++, td2d++, adt, bezt, 0, 1, 1, intvals, mtx, smtx); + } + else h1= 0; - + if (bezt->f3 & SELECT) { if (hdata==NULL) hdata = initTransDataCurveHandles(td, bezt); - bezt_to_transdata(td++, td2d++, adt, bezt, 2, 1, 1, intvals); - } else + bezt_to_transdata(td++, td2d++, adt, bezt, 2, 1, 1, intvals, mtx, smtx); + } + else h2= 0; } - + + /* only include main vert if selected */ if (bezt->f2 & SELECT) { - /*move handles relative to center*/ + /* move handles relative to center */ if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) { if (bezt->f1 & SELECT) td->flag |= TD_MOVEHANDLE1; if (bezt->f3 & SELECT) td->flag |= TD_MOVEHANDLE2; } - - /* only include main vert if selected */ - + /* if scaling around individuals centers, do not include keyframes */ if (sipo->around != V3D_LOCAL) { /* if handles were not selected, store their selection status */ @@ -3496,7 +3522,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) hdata = initTransDataCurveHandles(td, bezt); } - bezt_to_transdata(td++, td2d++, adt, bezt, 1, 1, 0, intvals); + bezt_to_transdata(td++, td2d++, adt, bezt, 1, 1, 0, intvals, mtx, smtx); } /* special hack (must be done after initTransDataCurveHandles(), as that stores handle settings to restore...): @@ -4473,7 +4499,7 @@ static void clear_trans_object_base_flags(TransInfo *t) if(base->flag & BA_WAS_SEL) base->flag |= SELECT; - base->flag &= ~(BA_WAS_SEL|BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA|BA_DO_IPO|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT); + base->flag &= ~(BA_WAS_SEL|BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA|BA_TEMP_TAG|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT); } } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 99793f4010a..58fc93de745 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -960,7 +960,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) { t->current_orientation = RNA_enum_get(op->ptr, "constraint_orientation"); - if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C) - 1) + if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) { t->current_orientation = V3D_MANIP_GLOBAL; } diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index e9d372abfec..739aac86713 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -516,6 +516,7 @@ void initTransformOrientation(bContext *C, TransInfo *t) case V3D_MANIP_GIMBAL: unit_m3(t->spacemtx); if (gimbal_axis(ob, t->spacemtx)) { + strcpy(t->spacename, "gimbal"); break; } /* no gimbal fallthrough to normal */ diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h index e233a3f3d94..92bf43e9a5a 100644 --- a/source/blender/gpu/GPU_draw.h +++ b/source/blender/gpu/GPU_draw.h @@ -117,6 +117,7 @@ int GPU_update_image_time(struct Image *ima, double time); int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int tfmode, int compare, int mipmap); void GPU_free_image(struct Image *ima); void GPU_free_images(void); +void GPU_free_images_anim(void); /* smoke drawing functions */ void GPU_free_smoke(struct SmokeModifierData *smd); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 6eb3e13c4e2..9a5a6704428 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -851,6 +851,17 @@ void GPU_free_images(void) GPU_free_image(ima); } +/* same as above but only free animated images */ +void GPU_free_images_anim(void) +{ + Image* ima; + + if(G.main) + for(ima=G.main->image.first; ima; ima=ima->id.next) + if(ELEM(ima->type, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) + GPU_free_image(ima); +} + /* OpenGL Materials */ #define FIXEDMAT 8 diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index 5af39cea832..98cb3dcefd9 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -28,13 +28,16 @@ FILE(GLOB SRC intern/*.c) SET(INC - . ../makesdna ../../../intern/guardedalloc ../../../intern/memutil ../blenlib - ../avi ../blenkernel + . + ../makesdna + ../../../intern/guardedalloc + ../../../intern/memutil + ../blenlib + ../avi + ../blenkernel ${JPEG_INC} ${PNG_INC} - ${TIFF_INC} ${ZLIB_INC} - ${OPENJPEG_INC} ) IF(WIN32) @@ -45,7 +48,13 @@ IF(WITH_OPENEXR) ADD_DEFINITIONS(-DWITH_OPENEXR) ENDIF(WITH_OPENEXR) +IF(WITH_TIFF) + SET(INC ${INC} ${TIFF_INCLUDE_DIR}) + ADD_DEFINITIONS(-DWITH_TIFF) +ENDIF(WITH_TIFF) + IF(WITH_OPENJPEG) + SET(INC ${INC} ${OPENJPEG_INC}) ADD_DEFINITIONS(-DWITH_OPENJPEG) ENDIF(WITH_OPENJPEG) diff --git a/source/blender/imbuf/SConscript b/source/blender/imbuf/SConscript index b4f56df9ec0..439cdecdf5b 100644 --- a/source/blender/imbuf/SConscript +++ b/source/blender/imbuf/SConscript @@ -20,6 +20,9 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') +if env['WITH_BF_TIFF']: + defs.append('WITH_TIFF') + if env['WITH_BF_DDS']: defs.append('WITH_DDS') diff --git a/source/blender/imbuf/intern/Makefile b/source/blender/imbuf/intern/Makefile index 0f2020c799a..5f8029ddf72 100644 --- a/source/blender/imbuf/intern/Makefile +++ b/source/blender/imbuf/intern/Makefile @@ -61,7 +61,6 @@ CFLAGS += $(LEVEL_1_C_WARNINGS) CPPFLAGS += -I$(NAN_JPEG)/include CPPFLAGS += -I$(NAN_PNG)/include CPPFLAGS += -I$(NAN_ZLIB)/include -CPPFLAGS += -I$(NAN_TIFF)/include CPPFLAGS += -I../../include CPPFLAGS += -I../../blenkernel CPPFLAGS += -I../../blenlib @@ -85,3 +84,8 @@ ifeq ($(WITH_FFMPEG), true) CPPFLAGS += -DWITH_FFMPEG CPPFLAGS += $(NAN_FFMPEGCFLAGS) endif + +ifeq ($(WITH_TIFF), true) + CPPFLAGS += -DWITH_TIFF + CPPFLAGS += -I$(NAN_TIFF)/include +endif diff --git a/source/blender/imbuf/intern/dynlibtiff.c b/source/blender/imbuf/intern/dynlibtiff.c deleted file mode 100644 index eb1b5f8e10a..00000000000 --- a/source/blender/imbuf/intern/dynlibtiff.c +++ /dev/null @@ -1,280 +0,0 @@ -/** - * Dynamically loaded libtiff support. - * - * This file is automatically generated by the gen_dynlibtiff.py script. - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor(s): Jonathan Merritt. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** - * To use the dynamic libtiff support, you must initialize the library using: - * libtiff_init() - * This attempts to load libtiff dynamically at runtime. G.have_libtiff will - * be set to indicate whether or not libtiff is available. If libtiff is - * not available, Blender can proceed with no ill effects, provided that - * it does not attempt to use any of the libtiff_ functions. When you're - * finished, close the library with: - * libtiff_exit() - * These functions are both declared in IMB_imbuf.h - * - * The functions provided by dyn_libtiff.h are the same as those in the - * normal static / shared libtiff, except that they are prefixed by the - * string "libtiff_" to indicate that they belong to a dynamically-loaded - * version. - */ -#include "dynlibtiff.h" - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> - -#include "BLI_blenlib.h" - -#include "imbuf.h" -#include "IMB_imbuf.h" - -#include "BKE_global.h" -#include "PIL_dynlib.h" - -/********************* - * LOCAL DEFINITIONS * - *********************/ -PILdynlib *libtiff = NULL; -void libtiff_loadlibtiff(void); -void* libtiff_findsymbol(char*); -int libtiff_load_symbols(void); - - -/************************** - * LIBRARY INITIALIZATION * - **************************/ - -void libtiff_loadlibtiff(void) -{ - char *filename; - libtiff = NULL; - - filename = getenv("BF_TIFF_LIB"); - if (filename) libtiff = PIL_dynlib_open(filename); - if (libtiff != NULL) return; - - /* Try to find libtiff in a couple of standard places */ -#ifdef __APPLE__ - /* OSX has version specific library */ - //standard install location - libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.3.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.4.dylib"); - if (libtiff != NULL) return; - //inside the blender app package contents/resources - libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.3.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.4.dylib"); - if (libtiff != NULL) return; - //inside the blender app package contents/frameworks - libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.3.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.4.dylib"); - if (libtiff != NULL) return; - //along side the blender app package - libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.3.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.4.dylib"); - if (libtiff != NULL) return; - //inside the blender app package contents/MacOS - libtiff = PIL_dynlib_open("@executable_path/libtiff.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/libtiff.3.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/libtiff.4.dylib"); - if (libtiff != NULL) return; -#else - libtiff = PIL_dynlib_open("libtiff.so"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("libtiff.so.3"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("libtiff.so.4"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("libtiff.dll"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/lib/libtiff.so"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/lib/libtiff.so.3"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/lib/libtiff.so.4"); - if (libtiff != NULL) return; -#ifdef __x86_64__ - libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so.3"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so.4"); - if (libtiff != NULL) return; -#endif - libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.so"); - if (libtiff != NULL) return; - /* For solaris */ - libtiff = PIL_dynlib_open("/usr/openwin/lib/libtiff.so"); -#endif - -} - -void *libtiff_findsymbol(char *name) -{ - void *symbol = NULL; - assert(libtiff != NULL); - symbol = PIL_dynlib_find_symbol(libtiff, name); - if (symbol == NULL) { - char *err = PIL_dynlib_get_error_as_string(libtiff); - - if (err) printf("libtiff_findsymbol: error %s\n",err); - else printf("libtiff_findsymbol: error Unknown.\n"); - - libtiff = NULL; - G.have_libtiff = (0); - return NULL; - } - return symbol; -} - -void libtiff_init(void) -{ - if (libtiff != NULL) { - printf("libtiff_init: Attempted to load libtiff twice!\n"); - return; - } - libtiff_loadlibtiff(); - G.have_libtiff = ((libtiff != NULL) && (libtiff_load_symbols())); - - if (!G.have_libtiff && (G.f & G_DEBUG)) { - printf("Unable to load: libtiff.\n"); - printf("Try setting the BF_TIFF_LIB environment variable if you want this support.\n"); - printf("Example: setenv BF_TIFF_LIB /usr/lib/libtiff.so\n"); - } -} - -void libtiff_exit(void) -{ - if (libtiff != NULL) { - PIL_dynlib_close(libtiff); - libtiff = NULL; - } -} - - -int libtiff_load_symbols(void) -{ - /* Attempt to load TIFFClientOpen */ - libtiff_TIFFClientOpen = libtiff_findsymbol("TIFFClientOpen"); - if (libtiff_TIFFClientOpen == NULL) { - return (0); - } - /* Attempt to load TIFFClose */ - libtiff_TIFFClose = libtiff_findsymbol("TIFFClose"); - if (libtiff_TIFFClose == NULL) { - return (0); - } - /* Attempt to load TIFFGetField */ - libtiff_TIFFGetField = libtiff_findsymbol("TIFFGetField"); - if (libtiff_TIFFGetField == NULL) { - return (0); - } - /* Attempt to load TIFFOpen */ - libtiff_TIFFOpen = libtiff_findsymbol("TIFFOpen"); - if (libtiff_TIFFOpen == NULL) { - return (0); - } - /* Attempt to load TIFFReadRGBAImage */ - libtiff_TIFFReadRGBAImage = libtiff_findsymbol("TIFFReadRGBAImage"); - if (libtiff_TIFFReadRGBAImage == NULL) { - return (0); - } - /* Attempt to load TIFFSetField */ - libtiff_TIFFSetField = libtiff_findsymbol("TIFFSetField"); - if (libtiff_TIFFSetField == NULL) { - return (0); - } - /* Attempt to load TIFFWriteEncodedStrip */ - libtiff_TIFFWriteEncodedStrip = libtiff_findsymbol("TIFFWriteEncodedStrip"); - if (libtiff_TIFFWriteEncodedStrip == NULL) { - return (0); - } - /* Attempt to load _TIFFfree */ - libtiff__TIFFfree = libtiff_findsymbol("_TIFFfree"); - if (libtiff__TIFFfree == NULL) { - return (0); - } - /* Attempt to load _TIFFmalloc */ - libtiff__TIFFmalloc = libtiff_findsymbol("_TIFFmalloc"); - if (libtiff__TIFFmalloc == NULL) { - return (0); - } - /* Attempt to load TIFFSetDirectory */ - libtiff_TIFFSetDirectory = libtiff_findsymbol("TIFFSetDirectory"); - if (libtiff_TIFFSetDirectory == NULL) { - return (0); - } - /* Attempt to load TIFFNumberOfDirectories */ - libtiff_TIFFNumberOfDirectories = libtiff_findsymbol("TIFFNumberOfDirectories"); - if (libtiff_TIFFNumberOfDirectories == NULL) { - return (0); - } - /* Attempt to load TIFFIsTiled */ - libtiff_TIFFIsTiled = libtiff_findsymbol("TIFFIsTiled"); - if (libtiff_TIFFIsTiled == NULL) { - return (0); - } - /* Attempt to load TIFFReadRGBATile */ - libtiff_TIFFReadRGBATile = libtiff_findsymbol("TIFFReadRGBATile"); - if (libtiff_TIFFReadRGBATile == NULL) { - return (0); - } - return (1); -} - - -/******************* - * SYMBOL POINTERS * - *******************/ - -TIFF* (*libtiff_TIFFClientOpen)(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc) = NULL; -void (*libtiff_TIFFClose)(TIFF*) = NULL; -int (*libtiff_TIFFGetField)(TIFF*, ttag_t, ...) = NULL; -TIFF* (*libtiff_TIFFOpen)(const char*, const char*) = NULL; -int (*libtiff_TIFFReadRGBAImage)(TIFF*, uint32, uint32, uint32*, int) = NULL; -int (*libtiff_TIFFSetField)(TIFF*, ttag_t, ...) = NULL; -tsize_t (*libtiff_TIFFWriteEncodedStrip)(TIFF*, tstrip_t, tdata_t, tsize_t) = NULL; -void (*libtiff__TIFFfree)(tdata_t) = NULL; -tdata_t (*libtiff__TIFFmalloc)(tsize_t) = NULL; -int (*libtiff_TIFFSetDirectory)(TIFF*, tdir_t) = NULL; -tdir_t (*libtiff_TIFFNumberOfDirectories)(TIFF*) = NULL; -int (*libtiff_TIFFIsTiled)(TIFF*) = NULL; -int (*libtiff_TIFFReadRGBATile)(TIFF*, uint32, uint32, uint32 * ) = NULL; - - diff --git a/source/blender/imbuf/intern/dynlibtiff.h b/source/blender/imbuf/intern/dynlibtiff.h deleted file mode 100644 index 5fafafbcf94..00000000000 --- a/source/blender/imbuf/intern/dynlibtiff.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Dynamically loaded libtiff support. - * - * This file is automatically generated by the gen_dynlibtiff.py script. - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor(s): Jonathan Merritt. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** - * To use the dynamic libtiff support, you must initialize the library using: - * libtiff_init() - * This attempts to load libtiff dynamically at runtime. G.have_libtiff will - * be set to indicate whether or not libtiff is available. If libtiff is - * not available, Blender can proceed with no ill effects, provided that - * it does not attempt to use any of the libtiff_ functions. When you're - * finished, close the library with: - * libtiff_exit() - * These functions are both declared in IMB_imbuf.h - * - * The functions provided by dyn_libtiff.h are the same as those in the - * normal static / shared libtiff, except that they are prefixed by the - * string "libtiff_" to indicate that they belong to a dynamically-loaded - * version. - */ -#ifndef DYN_LIBTIFF_H -#include "tiffio.h" -extern TIFF* (*libtiff_TIFFClientOpen)(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc); -extern void (*libtiff_TIFFClose)(TIFF*); -extern int (*libtiff_TIFFGetField)(TIFF*, ttag_t, ...); -extern TIFF* (*libtiff_TIFFOpen)(const char*, const char*); -extern int (*libtiff_TIFFReadRGBAImage)(TIFF*, uint32, uint32, uint32*, int); -extern int (*libtiff_TIFFSetField)(TIFF*, ttag_t, ...); -extern tsize_t (*libtiff_TIFFWriteEncodedStrip)(TIFF*, tstrip_t, tdata_t, tsize_t); -extern void (*libtiff__TIFFfree)(tdata_t); -extern tdata_t (*libtiff__TIFFmalloc)(tsize_t); -extern int (*libtiff_TIFFSetDirectory)(TIFF*, tdir_t); -extern tdir_t (*libtiff_TIFFNumberOfDirectories)(TIFF*); -extern int (*libtiff_TIFFIsTiled)(TIFF*); -extern int (*libtiff_TIFFReadRGBATile)(TIFF*, uint32, uint32, uint32 * ); -#endif /* DYN_LIBTIFF_H */ - diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c index 4a491ceba22..a0ff4476556 100644 --- a/source/blender/imbuf/intern/filetype.c +++ b/source/blender/imbuf/intern/filetype.c @@ -65,10 +65,10 @@ ImFileType IMB_FILE_TYPES[]= { {NULL, NULL, imb_is_a_targa, imb_ftype_default, imb_loadtarga, imb_savetarga, NULL, 0, TGA}, {NULL, NULL, imb_is_dpx, imb_ftype_default, imb_loaddpx, imb_save_dpx, NULL, IM_FTYPE_FLOAT, DPX}, {NULL, NULL, imb_is_cineon, imb_ftype_default, imb_loadcineon, imb_savecineon, NULL, IM_FTYPE_FLOAT, CINEON}, -#if defined(__APPLE__) && defined(IMBUF_COCOA) +#ifdef WITH_TIFF + {NULL, NULL, imb_is_a_tiff, imb_ftype_default, imb_loadtiff, imb_savetiff, imb_loadtiletiff, 0, TIF}, +#elif defined(__APPLE__) && defined(IMBUF_COCOA) {NULL, NULL, imb_is_a_cocoa, imb_ftype_cocoa, imb_imb_cocoaLoadImage, imb_savecocoa, NULL, 0, TIF}, -#else - {libtiff_init, libtiff_exit, imb_is_a_tiff, imb_ftype_default, imb_loadtiff, imb_savetiff, imb_loadtiletiff, 0, TIF}, #endif {NULL, NULL, imb_is_a_hdr, imb_ftype_default, imb_loadhdr, imb_savehdr, NULL, IM_FTYPE_FLOAT, RADHDR}, #ifdef WITH_OPENEXR diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 9d045aff3bf..a76c6e780ca 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -24,6 +24,7 @@ #ifdef WITH_OPENJPEG #include "BLI_blenlib.h" +#include "BLI_math.h" #include "imbuf.h" @@ -532,16 +533,23 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) { if (rect_float) { + float rgb[3]; + switch (prec) { case 8: /* Convert blenders float color channels to 8,12 or 16bit ints */ for(y=h-1; y>=0; y--) { y_row = y*w; for(x=0; x<w; x++, rect_float+=4) { i = y_row + x; + + if (ibuf->profile == IB_PROFILE_LINEAR_RGB) + linearrgb_to_srgb_v3_v3(rgb, rect_float); + else + copy_v3_v3(rgb, rect_float); - image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[0]); - image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[1]); - image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[2]); + image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rgb[0]); + image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rgb[1]); + image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rgb[2]); if (numcomps>3) image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[3]); } @@ -553,10 +561,15 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) { y_row = y*w; for(x=0; x<w; x++, rect_float+=4) { i = y_row + x; + + if (ibuf->profile == IB_PROFILE_LINEAR_RGB) + linearrgb_to_srgb_v3_v3(rgb, rect_float); + else + copy_v3_v3(rgb, rect_float); - image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[0]); - image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[1]); - image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[2]); + image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rgb[0]); + image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rgb[1]); + image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rgb[2]); if (numcomps>3) image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[3]); } @@ -567,10 +580,15 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) { y_row = y*w; for(x=0; x<w; x++, rect_float+=4) { i = y_row + x; + + if (ibuf->profile == IB_PROFILE_LINEAR_RGB) + linearrgb_to_srgb_v3_v3(rgb, rect_float); + else + copy_v3_v3(rgb, rect_float); - image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[0]); - image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[1]); - image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[2]); + image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rgb[0]); + image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rgb[1]); + image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rgb[2]); if (numcomps>3) image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[3]); } diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index c495508558e..fd505115994 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -531,12 +531,9 @@ void IMB_exr_set_channel(void *handle, char *layname, char *passname, int xstrid } else BLI_strncpy(name, passname, EXR_TOT_MAXNAME-1); - - - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) - if(strcmp(echan->name, name)==0) - break; - + + echan= (ExrChannel *)BLI_findstring(&data->channels, name, offsetof(ExrChannel, name)); + if(echan) { echan->xstride= xstride; echan->ystride= ystride; @@ -724,35 +721,30 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa static ExrLayer *imb_exr_get_layer(ListBase *lb, char *layname) { - ExrLayer *lay; - - for(lay= (ExrLayer *)lb->first; lay; lay= lay->next) { - if( strcmp(lay->name, layname)==0 ) - return lay; + ExrLayer *lay= (ExrLayer *)BLI_findstring(lb, layname, offsetof(ExrLayer, name)); + + if(lay==NULL) { + lay= (ExrLayer *)MEM_callocN(sizeof(ExrLayer), "exr layer"); + BLI_addtail(lb, lay); + BLI_strncpy(lay->name, layname, EXR_LAY_MAXNAME); } - lay= (ExrLayer *)MEM_callocN(sizeof(ExrLayer), "exr layer"); - BLI_addtail(lb, lay); - BLI_strncpy(lay->name, layname, EXR_LAY_MAXNAME); - + return lay; } static ExrPass *imb_exr_get_pass(ListBase *lb, char *passname) { - ExrPass *pass; + ExrPass *pass= (ExrPass *)BLI_findstring(lb, passname, offsetof(ExrPass, name)); - for(pass= (ExrPass *)lb->first; pass; pass= pass->next) { - if( strcmp(pass->name, passname)==0 ) - return pass; + if(pass==NULL) { + pass= (ExrPass *)MEM_callocN(sizeof(ExrPass), "exr pass"); + + if(strcmp(passname, "Combined")==0) + BLI_addhead(lb, pass); + else + BLI_addtail(lb, pass); } - - pass= (ExrPass *)MEM_callocN(sizeof(ExrPass), "exr pass"); - if(strcmp(passname, "Combined")==0) - BLI_addhead(lb, pass); - else - BLI_addtail(lb, pass); - BLI_strncpy(pass->name, passname, EXR_LAY_MAXNAME); return pass; @@ -904,14 +896,7 @@ static const char *exr_rgba_channelname(InputFile *file, const char *chan) static int exr_has_zbuffer(InputFile *file) { - const ChannelList &channels = file->header().channels(); - - for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i) - { - if(strcmp("Z", i.name())==0) - return 1; - } - return 0; + return !(file->header().channels().findChannel("Z") == NULL); } static int exr_is_renderresult(InputFile *file) diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index e7309eefb56..1e4b2ea7110 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -40,12 +40,16 @@ * used to compress images. */ +#ifdef WITH_TIFF + #include <string.h> #include "imbuf.h" - + #include "BKE_global.h" +#include "BKE_utildefines.h" +#include "BLI_math.h" #include "BLI_string.h" #include "IMB_imbuf_types.h" @@ -55,7 +59,7 @@ #include "IMB_filetype.h" #include "IMB_filter.h" -#include "dynlibtiff.h" +#include "tiffio.h" @@ -265,7 +269,7 @@ static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, unsigned char *mem, i memFile->offset = 0; memFile->size = size; - return libtiff_TIFFClientOpen("(Blender TIFF Interface Layer)", + return TIFFClientOpen("(Blender TIFF Interface Layer)", "r", (thandle_t)(memFile), imb_tiff_ReadProc, imb_tiff_WriteProc, imb_tiff_SeekProc, imb_tiff_CloseProc, @@ -297,16 +301,77 @@ int imb_is_a_tiff(unsigned char *mem) (memcmp(lil_endian, mem, IMB_TIFF_NCB) == 0) ); } -static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) +static void scanline_contig_8bit(unsigned char *rect, unsigned char *cbuf, int scanline_w, int spp) +{ + int i; + for (i=0; i < scanline_w; i++) { + rect[i*4 + 0] = cbuf[i*spp + 0]; + rect[i*4 + 1] = cbuf[i*spp + 1]; + rect[i*4 + 2] = cbuf[i*spp + 2]; + rect[i*4 + 3] = (spp==4)?cbuf[i*spp + 3]:255; + } +} + +static void scanline_contig_16bit(float *rectf, unsigned short *sbuf, int scanline_w, int spp) +{ + int i; + for (i=0; i < scanline_w; i++) { + rectf[i*4 + 0] = sbuf[i*spp + 0] / 65535.0; + rectf[i*4 + 1] = sbuf[i*spp + 1] / 65535.0; + rectf[i*4 + 2] = sbuf[i*spp + 2] / 65535.0; + rectf[i*4 + 3] = (spp==4)?(sbuf[i*spp + 3] / 65535.0):1.0; + } +} + +static void scanline_contig_32bit(float *rectf, float *fbuf, int scanline_w, int spp) +{ + int i; + for (i=0; i < scanline_w; i++) { + rectf[i*4 + 0] = fbuf[i*spp + 0]; + rectf[i*4 + 1] = fbuf[i*spp + 1]; + rectf[i*4 + 2] = fbuf[i*spp + 2]; + rectf[i*4 + 3] = (spp==4)?fbuf[i*spp + 3]:1.0; + } +} + +static void scanline_separate_8bit(unsigned char *rect, unsigned char *cbuf, int scanline_w, int chan) +{ + int i; + for (i=0; i < scanline_w; i++) + rect[i*4 + chan] = cbuf[i]; +} + +static void scanline_separate_16bit(float *rectf, unsigned short *sbuf, int scanline_w, int chan) +{ + int i; + for (i=0; i < scanline_w; i++) + rectf[i*4 + chan] = sbuf[i] / 65535.0; +} + +static void scanline_separate_32bit(float *rectf, float *fbuf, int scanline_w, int chan) +{ + int i; + for (i=0; i < scanline_w; i++) + rectf[i*4 + chan] = fbuf[i]; +} + + +/* + * Use the libTIFF RGBAImage API to read a TIFF image. + * This function uses the "RGBA Image" support from libtiff, which enables + * it to load most commonly-encountered TIFF formats. libtiff handles format + * conversion, color depth conversion, etc. + */ +static int imb_read_tiff_pixels_rgba(ImBuf *ibuf, TIFF *image, int premul) { ImBuf *tmpibuf; int success; - + tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, 32, IB_rect, 0); - success= libtiff_TIFFReadRGBAImage(image, ibuf->x, ibuf->y, tmpibuf->rect, 0); + success= TIFFReadRGBAImage(image, ibuf->x, ibuf->y, tmpibuf->rect, 0); if(ENDIAN_ORDER == B_ENDIAN) - IMB_convert_rgba_to_abgr(tmpibuf); + IMB_convert_rgba_to_abgr(tmpibuf); if(premul) { IMB_premultiply_alpha(tmpibuf); ibuf->flags |= IB_premul; @@ -323,12 +388,133 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) return success; } +/* + * Use the libTIFF scanline API to read a TIFF image. + * This method is most flexible and can handle multiple different bit depths + * and RGB channel orderings. + */ +static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) +{ + ImBuf *tmpibuf; + int success; + short bitspersample, spp, config; + size_t scanline; + int ib_flag=0, row, chan; + float *fbuf=NULL; + unsigned short *sbuf=NULL; + unsigned char *cbuf=NULL; + + TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bitspersample); + TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp); /* number of 'channels' */ + TIFFGetField(image, TIFFTAG_PLANARCONFIG, &config); + scanline = TIFFScanlineSize(image); + + /* if file has an unsupported channel count, use libTIFF to + * convert to an 8 bit RGBA image */ + if (!ELEM(spp, 3, 4)) + return imb_read_tiff_pixels_rgba(ibuf, image, premul); + + + if (bitspersample == 32) { + ib_flag = IB_rectfloat; + fbuf = (float *)_TIFFmalloc(scanline); + } else if (bitspersample == 16) { + ib_flag = IB_rectfloat; + sbuf = (unsigned short *)_TIFFmalloc(scanline); + } else if (bitspersample == 8) { + ib_flag = IB_rect; + cbuf = (unsigned char *)_TIFFmalloc(scanline); + } + + tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag, 0); + + /* contiguous channels: RGBRGBRGB */ + if (config == PLANARCONFIG_CONTIG) { + for (row = 0; row < ibuf->y; row++) { + int ib_offset = ibuf->x*ibuf->y*4 - ibuf->x*4 * (row+1); + + if (bitspersample == 32) { + success = TIFFReadScanline(image, fbuf, row, 0); + scanline_contig_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, spp); + + } else if (bitspersample == 16) { + success = TIFFReadScanline(image, sbuf, row, 0); + scanline_contig_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, spp); + + } else if (bitspersample == 8) { + unsigned char *crect = (unsigned char*)tmpibuf->rect; + success = TIFFReadScanline(image, cbuf, row, 0); + scanline_contig_8bit(crect+ib_offset, cbuf, ibuf->x, spp); + } + } + /* separate channels: RRRGGGBBB */ + } else if (config == PLANARCONFIG_SEPARATE) { + + /* imbufs always have 4 channels of data, so we iterate over all of them + * but only fill in from the TIFF scanline where necessary. */ + for (chan = 0; chan < 4; chan++) { + for (row = 0; row < ibuf->y; row++) { + int ib_offset = ibuf->x*ibuf->y*4 - ibuf->x*4 * (row+1); + + if (bitspersample == 32) { + if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ + memset(fbuf, 1.0, sizeof(fbuf)); + else + success = TIFFReadScanline(image, fbuf, row, chan); + scanline_separate_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, chan); + + } else if (bitspersample == 16) { + if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ + memset(sbuf, 65535, sizeof(sbuf)); + else + success = TIFFReadScanline(image, sbuf, row, chan); + scanline_separate_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, chan); + + } else if (bitspersample == 8) { + unsigned char *crect = (unsigned char*)tmpibuf->rect; + if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ + memset(cbuf, 255, sizeof(cbuf)); + else + success = TIFFReadScanline(image, cbuf, row, chan); + scanline_separate_8bit(crect+ib_offset, cbuf, ibuf->x, chan); + } + } + } + } + + ibuf->profile = (bitspersample==32)?IB_PROFILE_LINEAR_RGB:IB_PROFILE_SRGB; + + if (bitspersample == 32) + _TIFFfree(fbuf); + else if (bitspersample == 16) + _TIFFfree(sbuf); + else if (bitspersample == 8) + _TIFFfree(cbuf); + + if(ENDIAN_ORDER == B_ENDIAN) + IMB_convert_rgba_to_abgr(tmpibuf); + if(premul) { + IMB_premultiply_alpha(tmpibuf); + ibuf->flags |= IB_premul; + } + + /* assign rect last */ + if (tmpibuf->rect_float) + ibuf->rect_float= tmpibuf->rect_float; + else + ibuf->rect= tmpibuf->rect; + ibuf->mall |= ib_flag; + ibuf->flags |= ib_flag; + + tmpibuf->mall &= ~ib_flag; + IMB_freeImBuf(tmpibuf); + + return success; +} + /** * Loads a TIFF file. * - * This function uses the "RGBA Image" support from libtiff, which enables - * it to load most commonly-encountered TIFF formats. libtiff handles format - * conversion, color depth conversion, etc. * * @param mem: Memory containing the TIFF file. * @param size: Size of the mem buffer. @@ -345,9 +531,8 @@ ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags) uint32 width, height; char *format = NULL; int level; - - if(!G.have_libtiff) - return NULL; + short spp; + int ib_depth; /* check whether or not we have a TIFF file */ if(size < IMB_TIFF_NCB) { @@ -365,24 +550,27 @@ ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags) } /* allocate the image buffer */ - libtiff_TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width); - libtiff_TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height); - ibuf = IMB_allocImBuf(width, height, 32, 0, 0); + TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width); + TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height); + TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp); + + ib_depth = (spp==3)?24:32; + + ibuf = IMB_allocImBuf(width, height, ib_depth, 0, 0); if(ibuf) { ibuf->ftype = TIF; - ibuf->profile = IB_PROFILE_SRGB; } else { fprintf(stderr, "imb_loadtiff: could not allocate memory for TIFF " \ "image.\n"); - libtiff_TIFFClose(image); + TIFFClose(image); return NULL; } /* if testing, we're done */ if(flags & IB_test) { - libtiff_TIFFClose(image); + TIFFClose(image); return ibuf; } @@ -390,14 +578,14 @@ ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags) we don't read pixels but leave it to the cache to load tiles */ if(flags & IB_tilecache) { format= NULL; - libtiff_TIFFGetField(image, TIFFTAG_PIXAR_TEXTUREFORMAT, &format); + TIFFGetField(image, TIFFTAG_PIXAR_TEXTUREFORMAT, &format); - if(format && strcmp(format, "Plain Texture")==0 && libtiff_TIFFIsTiled(image)) { - int numlevel = libtiff_TIFFNumberOfDirectories(image); + if(format && strcmp(format, "Plain Texture")==0 && TIFFIsTiled(image)) { + int numlevel = TIFFNumberOfDirectories(image); /* create empty mipmap levels in advance */ for(level=0; level<numlevel; level++) { - if(!libtiff_TIFFSetDirectory(image, level)) + if(!TIFFSetDirectory(image, level)) break; if(level > 0) { @@ -416,8 +604,8 @@ ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags) else hbuf= ibuf; - libtiff_TIFFGetField(image, TIFFTAG_TILEWIDTH, &hbuf->tilex); - libtiff_TIFFGetField(image, TIFFTAG_TILELENGTH, &hbuf->tiley); + TIFFGetField(image, TIFFTAG_TILEWIDTH, &hbuf->tilex); + TIFFGetField(image, TIFFTAG_TILELENGTH, &hbuf->tiley); hbuf->xtiles= ceil(hbuf->x/(float)hbuf->tilex); hbuf->ytiles= ceil(hbuf->y/(float)hbuf->tiley); @@ -432,12 +620,12 @@ ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags) /* read pixels */ if(!(ibuf->flags & IB_tilecache) && !imb_read_tiff_pixels(ibuf, image, 0)) { fprintf(stderr, "imb_loadtiff: Failed to read tiff image.\n"); - libtiff_TIFFClose(image); + TIFFClose(image); return NULL; } /* close the client layer interface to the in-memory file */ - libtiff_TIFFClose(image); + TIFFClose(image); /* return successfully */ return ibuf; @@ -456,15 +644,15 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, int size, int tx, int ty, return; } - if(libtiff_TIFFSetDirectory(image, ibuf->miplevel)) { + if(TIFFSetDirectory(image, ibuf->miplevel)) { /* allocate the image buffer */ - libtiff_TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width); - libtiff_TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height); + TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width); + TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height); if(width == ibuf->x && height == ibuf->y) { if(rect) { /* tiff pixels are bottom to top, tiles are top to bottom */ - if(libtiff_TIFFReadRGBATile(image, tx*ibuf->tilex, (ibuf->ytiles - 1 - ty)*ibuf->tiley, rect) == 1) { + if(TIFFReadRGBATile(image, tx*ibuf->tilex, (ibuf->ytiles - 1 - ty)*ibuf->tiley, rect) == 1) { if(ibuf->tiley > ibuf->y) memmove(rect, rect+ibuf->tilex*(ibuf->tiley - ibuf->y), sizeof(int)*ibuf->tilex*ibuf->y); @@ -482,7 +670,7 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, int size, int tx, int ty, printf("imb_loadtiff: could not find mipmap level %d\n", ibuf->miplevel); /* close the client layer interface to the in-memory file */ - libtiff_TIFFClose(image); + TIFFClose(image); } /** @@ -501,8 +689,6 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, int size, int tx, int ty, * @return: 1 if the function is successful, 0 on failure. */ -#define FTOUSHORT(val) ((val >= 1.0f-0.5f/65535)? 65535: (val <= 0.0f)? 0: (unsigned short)(val*65535.0f + 0.5f)) - int imb_savetiff(ImBuf *ibuf, char *name, int flags) { TIFF *image = NULL; @@ -515,10 +701,6 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags) int x, y, from_i, to_i, i; int extraSampleTypes[1] = { EXTRASAMPLE_ASSOCALPHA }; - if(!G.have_libtiff) { - fprintf(stderr, "imb_savetiff: no tiff library available.\n"); - return (0); - } /* check for a valid number of bytes per pixel. Like the PNG writer, * the TIFF writer supports 1, 3 or 4 bytes per pixel, corresponding @@ -546,7 +728,7 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags) } else { /* create image as a file */ - image = libtiff_TIFFOpen(name, "w"); + image = TIFFOpen(name, "w"); } if(image == NULL) { fprintf(stderr, @@ -557,16 +739,16 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags) /* allocate array for pixel data */ npixels = ibuf->x * ibuf->y; if(bitspersample == 16) - pixels16 = (unsigned short*)libtiff__TIFFmalloc(npixels * + pixels16 = (unsigned short*)_TIFFmalloc(npixels * samplesperpixel * sizeof(unsigned short)); else - pixels = (unsigned char*)libtiff__TIFFmalloc(npixels * + pixels = (unsigned char*)_TIFFmalloc(npixels * samplesperpixel * sizeof(unsigned char)); if(pixels == NULL && pixels16 == NULL) { fprintf(stderr, "imb_savetiff: could not allocate pixels array.\n"); - libtiff_TIFFClose(image); + TIFFClose(image); return (0); } @@ -581,24 +763,24 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags) } /* setup samples per pixel */ - libtiff_TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, bitspersample); - libtiff_TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel); + TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, bitspersample); + TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel); if(samplesperpixel == 4) { /* RGBA images */ - libtiff_TIFFSetField(image, TIFFTAG_EXTRASAMPLES, 1, + TIFFSetField(image, TIFFTAG_EXTRASAMPLES, 1, extraSampleTypes); - libtiff_TIFFSetField(image, TIFFTAG_PHOTOMETRIC, + TIFFSetField(image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); } else if(samplesperpixel == 3) { /* RGB images */ - libtiff_TIFFSetField(image, TIFFTAG_PHOTOMETRIC, + TIFFSetField(image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); } else if(samplesperpixel == 1) { /* greyscale images, 1 channel */ - libtiff_TIFFSetField(image, TIFFTAG_PHOTOMETRIC, + TIFFSetField(image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK); } @@ -609,8 +791,23 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags) to_i = samplesperpixel*((ibuf->y-y-1)*ibuf->x+x); if(pixels16) { - for(i = 0; i < samplesperpixel; i++, to_i++, from_i++) - to16[to_i] = FTOUSHORT(fromf[from_i]); + /* convert from float source */ + float rgb[3]; + + if (ibuf->profile == IB_PROFILE_LINEAR_RGB) + linearrgb_to_srgb_v3_v3(rgb, &fromf[from_i]); + else + copy_v3_v3(rgb, &fromf[from_i]); + + to16[to_i+0] = FTOUSHORT(rgb[0]); + to16[to_i+1] = FTOUSHORT(rgb[1]); + to16[to_i+2] = FTOUSHORT(rgb[2]); + to_i += 3; from_i+=3; + + if (samplesperpixel == 4) { + to16[to_i+3] = FTOUSHORT(fromf[from_i+3]); + to_i++; from_i++; + } } else { for(i = 0; i < samplesperpixel; i++, to_i++, from_i++) @@ -620,30 +817,31 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags) } /* write the actual TIFF file */ - libtiff_TIFFSetField(image, TIFFTAG_IMAGEWIDTH, ibuf->x); - libtiff_TIFFSetField(image, TIFFTAG_IMAGELENGTH, ibuf->y); - libtiff_TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, ibuf->y); - libtiff_TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE); - libtiff_TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB); - libtiff_TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); - libtiff_TIFFSetField(image, TIFFTAG_XRESOLUTION, 150.0); - libtiff_TIFFSetField(image, TIFFTAG_YRESOLUTION, 150.0); - libtiff_TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); - if(libtiff_TIFFWriteEncodedStrip(image, 0, + TIFFSetField(image, TIFFTAG_IMAGEWIDTH, ibuf->x); + TIFFSetField(image, TIFFTAG_IMAGELENGTH, ibuf->y); + TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, ibuf->y); + TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE); + TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB); + TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + TIFFSetField(image, TIFFTAG_XRESOLUTION, 150.0); + TIFFSetField(image, TIFFTAG_YRESOLUTION, 150.0); + TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); + if(TIFFWriteEncodedStrip(image, 0, (bitspersample == 16)? (unsigned char*)pixels16: pixels, ibuf->x*ibuf->y*samplesperpixel*bitspersample/8) == -1) { fprintf(stderr, "imb_savetiff: Could not write encoded TIFF.\n"); - libtiff_TIFFClose(image); - if(pixels) libtiff__TIFFfree(pixels); - if(pixels16) libtiff__TIFFfree(pixels16); + TIFFClose(image); + if(pixels) _TIFFfree(pixels); + if(pixels16) _TIFFfree(pixels16); return (1); } /* close the TIFF file */ - libtiff_TIFFClose(image); - if(pixels) libtiff__TIFFfree(pixels); - if(pixels16) libtiff__TIFFfree(pixels16); + TIFFClose(image); + if(pixels) _TIFFfree(pixels); + if(pixels16) _TIFFfree(pixels16); return (1); } +#endif /* WITH_TIFF */
\ No newline at end of file diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index aff05b4eaff..e6f4e226caa 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -105,17 +105,19 @@ static int IMB_ispic_name(char *name) int IMB_ispic(char *filename) { if(U.uiflag & USER_FILTERFILEEXTS) { - if (G.have_libtiff && (BLI_testextensie(filename, ".tif") + if (BLI_testextensie(filename, ".tif") || BLI_testextensie(filename, ".tiff") - || BLI_testextensie(filename, ".tx"))) { + || BLI_testextensie(filename, ".tx")) { return IMB_ispic_name(filename); } if (G.have_quicktime){ if( BLI_testextensie(filename, ".jpg") || BLI_testextensie(filename, ".jpeg") +#ifdef WITH_TIFF || BLI_testextensie(filename, ".tif") || BLI_testextensie(filename, ".tiff") || BLI_testextensie(filename, ".tx") +#endif || BLI_testextensie(filename, ".hdr") || BLI_testextensie(filename, ".tga") || BLI_testextensie(filename, ".rgb") @@ -144,9 +146,14 @@ int IMB_ispic(char *filename) } else { return(FALSE); } - } else { /* no quicktime or libtiff */ + } else { /* no quicktime */ if( BLI_testextensie(filename, ".jpg") || BLI_testextensie(filename, ".jpeg") +#ifdef WITH_TIFF + || BLI_testextensie(filename, ".tif") + || BLI_testextensie(filename, ".tiff") + || BLI_testextensie(filename, ".tx") +#endif || BLI_testextensie(filename, ".hdr") || BLI_testextensie(filename, ".tga") || BLI_testextensie(filename, ".rgb") diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 181ab6f0afa..210bb6a9af0 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -154,6 +154,8 @@ typedef enum eMotionPaths_ViewFlag { MOTIONPATH_VIEW_KFRAS = (1<<1), /* show keyframe/frame numbers */ MOTIONPATH_VIEW_KFNOS = (1<<2), + /* find keyframes in whole action (instead of just in matching group name) */ + MOTIONPATH_VIEW_KFACT = (1<<3), } eMotionPath_ViewFlag; /* bAnimVizSettings->path_bakeflag */ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index f50909e641b..9649b8351a6 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -412,14 +412,15 @@ extern Object workob; #define BA_HAS_RECALC_OB 4 #define BA_HAS_RECALC_DATA 8 - // XXX DEPRECEATED SETTING... -#define BA_DO_IPO 32 + /* NOTE: this was used as a proper setting in past, so nullify before using */ +#define BA_TEMP_TAG 32 #define BA_FROMSET 128 #define BA_TRANSFORM_CHILD 256 /* child of a transformed object */ #define BA_TRANSFORM_PARENT 8192 /* parent of a transformed object */ + /* an initial attempt as making selection more specific! */ #define BA_DESELECT 0 #define BA_SELECT 1 diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 933ccf1bdd0..091c05a8b98 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -362,6 +362,8 @@ typedef struct UserDef { short scrcastfps; /* frame rate for screencast to be played back */ short scrcastwait; /* milliseconds between screencast snapshots */ + + short propwidth, pad[3]; /* Value for Dual/Single Column UI */ char versemaster[160]; char verseuser[160]; diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 6102ccb0f34..1f066a7209d 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -330,22 +330,31 @@ typedef struct ExtensionRNA { /* fake struct definitions, needed otherwise collections end up owning the C * structs like 'Object' when defined first */ -#define MainCameras Main -#define MainScenes Main -#define MainArmatures Main -#define MainMaterials Main -#define MainMeshes Main -#define MainLamps Main -#define MainImages Main -#define MainObjects Main -#define MainTexts Main -#define MainActions Main -#define MainGroups Main -#define MainTextures Main -#define MainCurves Main -#define MainBrushes Main -#define MainLattices Main -#define MainMetaBall Main +#define MainActions Main +#define MainArmatures Main +#define MainBrushes Main +#define MainCameras Main +#define MainCurves Main +#define MainFonts Main +#define MainGreasePencils Main +#define MainGroups Main +#define MainImages Main +#define MainLamps Main +#define MainLattices Main +#define MainLibraries Main +#define MainMaterials Main +#define MainMeshes Main +#define MainMetaBalls Main +#define MainNodeTrees Main +#define MainObjects Main +#define MainParticles Main +#define MainScenes Main +#define MainScreens Main +#define MainSounds Main +#define MainTexts Main +#define MainTextures Main +#define MainWindowManagers Main +#define MainWorlds Main #ifdef __cplusplus } diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index 71cfc3c7da4..c4ee90dde16 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -15,6 +15,9 @@ defs = [] if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') +if env['WITH_BF_TIFF']: + defs.append('WITH_TIFF') + if env['WITH_BF_OPENJPEG']: defs.append('WITH_OPENJPEG') diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 0e25160cdff..e9fc5c10f9e 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -58,6 +58,10 @@ IF(WITH_OPENEXR) ADD_DEFINITIONS(-DWITH_OPENEXR) ENDIF(WITH_OPENEXR) +IF(WITH_TIFF) + ADD_DEFINITIONS(-DWITH_TIFF) +ENDIF(WITH_TIFF) + IF(WITH_OPENJPEG) ADD_DEFINITIONS(-DWITH_OPENJPEG) ENDIF(WITH_OPENJPEG) diff --git a/source/blender/makesrna/intern/Makefile b/source/blender/makesrna/intern/Makefile index c26593100f8..8aef06e762d 100644 --- a/source/blender/makesrna/intern/Makefile +++ b/source/blender/makesrna/intern/Makefile @@ -92,6 +92,10 @@ ifeq ($(WITH_OPENAL),true) CPPFLAGS += -DWITH_OPENAL endif +ifeq ($(WITH_TIFF),true) + CPPFLAGS += -DWITH_TIFF +endif + ifeq ($(OS),windows) # Windows needs these extra libs because of winstuff... It is not # _really_ needed, but it is the easiest fix for now. If you have diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index df0159d22a4..4f37195068a 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -127,6 +127,27 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve * } } +static TimeMarker *rna_Action_pose_markers_new(bAction *act, ReportList *reports, char name[]) +{ + TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); + marker->flag= 1; + marker->frame= 1; + BLI_strncpy(marker->name, name, sizeof(marker->name)); + BLI_addtail(&act->markers, marker); + return marker; +} + +static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, TimeMarker *marker) +{ + if (!BLI_remlink_safe(&act->markers, marker)) { + BKE_reportf(reports, RPT_ERROR, "TimelineMarker '%s' not found in action '%s'", marker->name, act->id.name+2); + return; + } + + /* XXX, invalidates PyObject */ + MEM_freeN(marker); +} + #else static void rna_def_dopesheet(BlenderRNA *brna) @@ -379,6 +400,34 @@ static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } +static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "ActionPoseMarkers"); + srna= RNA_def_struct(brna, "ActionPoseMarkers", NULL); + RNA_def_struct_sdna(srna, "bAction"); + RNA_def_struct_ui_text(srna, "Action Pose Markers", "Collection of timeline markers"); + + func= RNA_def_function(srna, "new", "rna_Action_pose_markers_new"); + RNA_def_function_ui_description(func, "Add a pose marker to the action."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)."); + RNA_def_property_flag(parm, PROP_REQUIRED); + + parm= RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created marker"); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "rna_Action_pose_markers_remove"); + RNA_def_function_ui_description(func, "Remove a timeline marker."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); +} + static void rna_def_action(BlenderRNA *brna) { StructRNA *srna; @@ -405,6 +454,7 @@ static void rna_def_action(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "markers", NULL); RNA_def_property_struct_type(prop, "TimelineMarker"); RNA_def_property_ui_text(prop, "Pose Markers", "Markers specific to this Action, for labeling poses"); + rna_def_action_pose_markers(brna, prop); RNA_api_action(srna); } diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index b3800b2d68d..e9da96e0960 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -56,14 +56,6 @@ EnumPropertyItem actuator_type_items[] ={ {ACT_VISIBILITY, "VISIBILITY", 0, "Visibility", ""}, {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem edit_object_type_items[] ={ - {ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""}, - {ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""}, - {ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""}, - {ACT_EDOB_TRACK_TO, "TRACKTO", 0, "Track to", ""}, - {ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""}, - {0, NULL, 0, NULL, NULL} }; - #ifdef RNA_RUNTIME #include "BKE_sca.h" @@ -346,28 +338,6 @@ static void rna_StateActuator_state_set(PointerRNA *ptr, const int *values) } } -static EnumPropertyItem *rna_EditObjectActuator_mode_itemf(bContext *C, PointerRNA *ptr, int *free) -{ - EnumPropertyItem *item= NULL; - Object *ob = (Object *)ptr->id.data; - - int totitem= 0; - if (ob->type!=OB_ARMATURE) - { - RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_REPLACE_MESH); - RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_DYNAMICS); - } - - RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_ADD_OBJECT); - RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_END_OBJECT); - RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_TRACK_TO); - - RNA_enum_item_end(&item, &totitem); - *free= 1; - - return item; -} - /* Always keep in alphabetical order */ EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, int *free) { @@ -1209,14 +1179,21 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) {ACT_EDOB_SET_MASS, "SETMASS", 0, "Set Mass", ""}, {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem prop_type_items[] ={ + {ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""}, + {ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""}, + {ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""}, + {ACT_EDOB_TRACK_TO, "TRACKTO", 0, "Track to", ""}, + {ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""}, + {0, NULL, 0, NULL, NULL} }; + srna= RNA_def_struct(brna, "EditObjectActuator", "Actuator"); RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator used to edit objects"); RNA_def_struct_sdna_from(srna, "bEditObjectActuator", "data"); prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, edit_object_type_items); - RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_EditObjectActuator_mode_itemf"); + RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Edit Object", "The mode of the actuator"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -1834,7 +1811,7 @@ static void rna_def_armature_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Secondary Target", "Set weight of this constraint"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "weight"); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "Weight", "Set weight of this constraint"); diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index d791bde3054..e0cf4f912b1 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -557,7 +557,7 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop) parm= RNA_def_string(func, "data_path", "", 256, "Data-Path", "RNA-Path to destination property."); // xxx hopefully this is long enough RNA_def_property_flag(parm, PROP_REQUIRED); /* index (defaults to -1 for entire array) */ - parm=RNA_def_int(func, "index", -1, 0, INT_MAX, "Index", "The index of the destination property (i.e. axis of Location/Rotation/etc.), or -1 for the entire array.", 0, INT_MAX); + parm=RNA_def_int(func, "index", -1, -1, INT_MAX, "Index", "The index of the destination property (i.e. axis of Location/Rotation/etc.), or -1 for the entire array.", 0, INT_MAX); /* grouping */ parm=RNA_def_enum(func, "grouping_method", keyingset_path_grouping_items, KSP_GROUP_KSNAME, "Grouping Method", "Method used to define which Group-name to use."); parm=RNA_def_string(func, "group_name", "", 64, "Group Name", "Name of Action Group to assign destination to (only if grouping mode is to use this name)."); diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c index c5172c4e59c..985521fe2c6 100644 --- a/source/blender/makesrna/intern/rna_animviz.c +++ b/source/blender/makesrna/intern/rna_animviz.c @@ -158,7 +158,7 @@ static void rna_def_animviz_ghosts(BlenderRNA *brna) PropertyRNA *prop; static const EnumPropertyItem prop_type_items[] = { - {GHOST_TYPE_NONE, "NONE", 0, "No Ghosts", "Don not show any ghosts"}, + {GHOST_TYPE_NONE, "NONE", 0, "No Ghosts", "Do not show any ghosts"}, {GHOST_TYPE_ACFRA, "CURRENT_FRAME", 0, "Around Current Frame", "Show ghosts from around the current frame"}, {GHOST_TYPE_RANGE, "RANGE", 0, "In Range", "Show ghosts for the specified frame range"}, {GHOST_TYPE_KEYS, "KEYS", 0, "On Keyframes", "Show ghosts on keyframes"}, @@ -222,8 +222,8 @@ static void rna_def_animviz_paths(BlenderRNA *brna) PropertyRNA *prop; static const EnumPropertyItem prop_type_items[]= { - {MOTIONPATH_TYPE_RANGE, "RANGE", 0, "In Range", "Display Paths of poses within specified range"}, {MOTIONPATH_TYPE_ACFRA, "CURRENT_FRAME", 0, "Around Frame", "Display Paths of poses within a fixed number of frames around the current frame"}, + {MOTIONPATH_TYPE_RANGE, "RANGE", 0, "In Range", "Display Paths of poses within specified range"}, {0, NULL, 0, NULL, NULL}}; static const EnumPropertyItem prop_location_items[]= { {MOTIONPATH_BAKE_HEADS, "HEADS", 0, "Heads", "Calculate bone paths from heads"}, @@ -264,6 +264,11 @@ static void rna_def_animviz_paths(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Keyframe Numbers", "Show frame numbers of Keyframes on Motion Paths"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */ + prop= RNA_def_property(srna, "search_all_action_keyframes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFACT); + RNA_def_property_ui_text(prop, "All Action Keyframes", "For bone motion paths, search whole Action for keyframes instead of in group with matching name only (is slower)"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */ + prop= RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "path_step"); RNA_def_property_range(prop, 1, 100); diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index b12fe3a018b..563fdbf8236 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -1256,13 +1256,13 @@ static void rna_def_curve_nurb(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Type", "The interpolation type for this curve element"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); - prop= RNA_def_property(srna, "point_count_u", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "point_count_u", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/ RNA_def_property_int_sdna(prop, NULL, "pntsu"); RNA_def_property_ui_text(prop, "Points U", "Total number points for the curve or surface in the U direction"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); - prop= RNA_def_property(srna, "point_count_v", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "point_count_v", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/ RNA_def_property_int_sdna(prop, NULL, "pntsv"); RNA_def_property_ui_text(prop, "Points V", "Total number points for the surface on the V direction"); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index a8a73d15c9d..1fe22e8fdd8 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -546,6 +546,11 @@ static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, BezTri delete_fcurve_key(fcu, index, !do_fast); } +static void rna_fcurve_range(FCurve *fcu, float range[2]) +{ + calc_fcurve_range(fcu, range, range+1); +} + #else static void rna_def_fmodifier_generator(BlenderRNA *brna) @@ -852,7 +857,7 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Phase", "A random seed for the noise effect"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); - prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "depth"); RNA_def_property_ui_text(prop, "Depth", "Amount of fine level detail present in the noise"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL); @@ -1321,7 +1326,9 @@ static void rna_def_fcurve(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - + FunctionRNA *func; + PropertyRNA *parm; + static EnumPropertyItem prop_mode_extend_items[] = { {FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant", ""}, {FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear", ""}, @@ -1423,8 +1430,23 @@ static void rna_def_fcurve(BlenderRNA *brna) prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "FModifier"); RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the shape of the F-Curve"); - rna_def_fcurve_modifiers(brna, prop); + + /* Functions */ + func= RNA_def_function(srna, "evaluate", "evaluate_fcurve"); /* calls the C/API direct */ + RNA_def_function_ui_description(func, "Evaluate fcurve."); + parm= RNA_def_float(func, "frame", 1.0f, -FLT_MAX, FLT_MAX, "Frame", "Evaluate fcurve at given frame", -FLT_MAX, FLT_MAX); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return value */ + parm= RNA_def_float(func, "position", 0, -FLT_MAX, FLT_MAX, "Position", "Fcurve position", -FLT_MAX, FLT_MAX); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "range", "rna_fcurve_range"); + RNA_def_function_ui_description(func, "Get the time extents for F-Curve."); + /* return value */ + parm= RNA_def_float_vector(func, "range", 2, NULL, -FLT_MAX, FLT_MAX, "Range", "Min/Max values", -FLT_MAX, FLT_MAX); + RNA_def_property_flag(parm, PROP_THICK_WRAP); + RNA_def_function_output(func, parm); } /* *********************** */ diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 52f4b289368..c4137d5379b 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -441,7 +441,7 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Has data", "True if this image has data"); - prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Image_depth_get", NULL, NULL); RNA_def_property_ui_text(prop, "Depth", "Image bit depth"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index ba1bc29ebf1..d2acb49bae2 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -53,6 +53,10 @@ #include "BKE_brush.h" #include "BKE_lattice.h" #include "BKE_mball.h" +#include "BKE_world.h" +#include "BKE_particle.h" +#include "BKE_font.h" +#include "BKE_node.h" #include "DNA_armature_types.h" #include "DNA_camera_types.h" @@ -67,6 +71,10 @@ #include "DNA_brush_types.h" #include "DNA_lattice_types.h" #include "DNA_meta_types.h" +#include "DNA_world_types.h" +#include "DNA_particle_types.h" +#include "DNA_vfont_types.h" +#include "DNA_node_types.h" #include "ED_screen.h" @@ -196,6 +204,23 @@ void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material /* XXX python now has invalid pointer? */ } +// XXX, commended for now, need to see how this can be used with node groups. +struct bNodeTree *rna_Main_nodetree_new(Main *bmain, int type) +{ + bNodeTree *tree = ntreeAddTree(type); + tree->id.us--; + return tree; +} +void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree) +{ + if(ID_REAL_USERS(tree) <= 0) + free_libblock(&bmain->nodetree, tree); + else + BKE_reportf(reports, RPT_ERROR, "Node Tree \"%s\" must have zero users to be removed, found %d.", tree->id.name+2, ID_REAL_USERS(tree)); + + /* XXX python now has invalid pointer? */ +} + Mesh *rna_Main_meshes_new(Main *bmain, char* name) { Mesh *me= add_mesh(name); @@ -291,6 +316,20 @@ void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" must have zero users to be removed, found %d.", mb->id.name+2, ID_REAL_USERS(mb)); } +VFont *rna_Main_fonts_load(Main *bmain, char *filename) +{ + return load_vfont(filename); +} +void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont) +{ + if(ID_REAL_USERS(vfont) <= 0) + free_libblock(&bmain->vfont, vfont); + else + BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d.", vfont->id.name+2, ID_REAL_USERS(vfont)); + + /* XXX python now has invalid pointer? */ +} + Tex *rna_Main_textures_new(Main *bmain, char* name) { Tex *tex= add_texture(name); @@ -319,6 +358,20 @@ void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *bru BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d.", brush->id.name+2, ID_REAL_USERS(brush)); } +World *rna_Main_worlds_new(Main *bmain, char* name) +{ + World *world = add_world(name); + world->id.us--; + return world; +} +void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world) +{ + if(ID_REAL_USERS(world) <= 0) + free_libblock(&bmain->world, world); + else + BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d.", world->id.name+2, ID_REAL_USERS(world)); +} + Group *rna_Main_groups_new(Main *bmain, char* name) { return add_group(name); @@ -383,6 +436,22 @@ void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act) /* XXX python now has invalid pointer? */ } +ParticleSettings *rna_Main_particles_new(Main *bmain, char* name) +{ + ParticleSettings *part = psys_new_settings(name, bmain); + part->id.us--; + return part; +} +void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part) +{ + if(ID_REAL_USERS(part) <= 0) + free_libblock(&bmain->particle, part); + else + BKE_reportf(reports, RPT_ERROR, "Particle Settings \"%s\" must have zero users to be removed, found %d.", part->id.name+2, ID_REAL_USERS(part)); + + /* XXX python now has invalid pointer? */ +} + #else void RNA_api_main(StructRNA *srna) @@ -510,7 +579,35 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) } void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) { + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + static EnumPropertyItem node_nodetree_items[] = { + {0, "SHADER", 0, "Shader", ""}, + {1, "COMPOSITE", 0, "Composite", ""}, + {2, "TEXTURE", 0, "Texture", ""}, + {0, NULL, 0, NULL, NULL}}; + + RNA_def_property_srna(cprop, "MainNodeTrees"); + srna= RNA_def_struct(brna, "MainNodeTrees", NULL); + RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees"); + +#if 0 // need to see some examples of using these functions before enabling. + func= RNA_def_function(srna, "new", "rna_Main_nodetree_new"); + RNA_def_function_ui_description(func, "Add a new node tree to the main database"); + parm= RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of curve object to add"); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm= RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock."); + RNA_def_function_return(func, parm); + func= RNA_def_function(srna, "remove", "rna_Main_nodetree_remove"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile."); + parm= RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); +#endif } void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) { @@ -664,8 +761,8 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) FunctionRNA *func; PropertyRNA *parm; - RNA_def_property_srna(cprop, "MainMetaBall"); - srna= RNA_def_struct(brna, "MainMetaBall", NULL); + RNA_def_property_srna(cprop, "MainMetaBalls"); + srna= RNA_def_struct(brna, "MainMetaBalls", NULL); RNA_def_struct_ui_text(srna, "Main MetaBall", "Collection of metaballs"); func= RNA_def_function(srna, "new", "rna_Main_metaballs_new"); @@ -684,7 +781,27 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) } void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) { + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + RNA_def_property_srna(cprop, "MainFonts"); + srna= RNA_def_struct(brna, "MainFonts", NULL); + RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts"); + + func= RNA_def_function(srna, "load", "rna_Main_fonts_load"); + RNA_def_function_ui_description(func, "Load a new font into the main database"); + parm= RNA_def_string(func, "filename", "File Name", 0, "", "path of the font to load."); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "rna_Main_fonts_remove"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove a font from the current blendfile."); + parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) { @@ -734,10 +851,32 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) parm= RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove."); RNA_def_property_flag(parm, PROP_REQUIRED); } + void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) { + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + RNA_def_property_srna(cprop, "MainWorlds"); + srna= RNA_def_struct(brna, "MainWorlds", NULL); + RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds"); + + func= RNA_def_function(srna, "new", "rna_Main_worlds_new"); + RNA_def_function_ui_description(func, "Add a new world to the main database"); + parm= RNA_def_string(func, "name", "World", 0, "", "New name for the datablock."); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm= RNA_def_pointer(func, "world", "World", "", "New world datablock."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "rna_Main_worlds_remove"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove a world from the current blendfile."); + parm= RNA_def_pointer(func, "world", "World", "", "World to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); } + void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; @@ -850,7 +989,27 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) } void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) { + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "MainParticles"); + srna= RNA_def_struct(brna, "MainParticles", NULL); + RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings"); + func= RNA_def_function(srna, "new", "rna_Main_particles_new"); + RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database"); + parm= RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock."); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "rna_Main_particles_remove"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile."); + parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); } void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) { diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index f360fa7012d..1c790898ef2 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -870,7 +870,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Gloss Threshold", "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped"); RNA_def_property_update(prop, 0, "rna_Material_update"); - prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "ray_depth"); RNA_def_property_range(prop, 0, 10); RNA_def_property_ui_text(prop, "Depth", "Maximum allowed number of light inter-reflections"); @@ -935,7 +935,7 @@ static void rna_def_material_raytra(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Gloss Threshold", "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped"); RNA_def_property_update(prop, 0, "rna_Material_update"); - prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "ray_depth_tra"); RNA_def_property_range(prop, 0, 10); RNA_def_property_ui_text(prop, "Depth", "Maximum allowed number of light inter-refractions"); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index ebf3f660dc3..d2bf791fb67 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -55,8 +55,8 @@ EnumPropertyItem modifier_type_items[] ={ {eModifierType_EdgeSplit, "EDGE_SPLIT", ICON_MOD_EDGESPLIT, "Edge Split", ""}, {eModifierType_Mask, "MASK", ICON_MOD_MASK, "Mask", ""}, {eModifierType_Mirror, "MIRROR", ICON_MOD_MIRROR, "Mirror", ""}, - {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""}, {eModifierType_Multires, "MULTIRES", ICON_MOD_MULTIRES, "Multiresolution", ""}, + {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""}, {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""}, {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""}, {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""}, diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 95f142d299d..93a133bf380 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -859,6 +859,17 @@ static void rna_Base_layer_set(PointerRNA *ptr, const int *values) /* rna_Base_layer_update updates the objects layer */ } +static void rna_GameObjectSettings_state_get(PointerRNA *ptr, int *values) +{ + Object *ob= (Object*)ptr->data; + int i; + int all_states = (ob->scaflag & OB_ALLSTATE?1:0); + + memset(values, 0, sizeof(int)*OB_MAX_STATES); + for(i=0; i<OB_MAX_STATES; i++) + values[i] = (ob->state & (1<<i)) | all_states; +} + static void rna_GameObjectSettings_state_set(PointerRNA *ptr, const int *values) { Object *ob= (Object*)ptr->data; @@ -1257,7 +1268,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "state", 1); RNA_def_property_array(prop, OB_MAX_STATES); RNA_def_property_ui_text(prop, "State", "State determining which controllers are displayed"); - RNA_def_property_boolean_funcs(prop, NULL, "rna_GameObjectSettings_state_set"); + RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_state_get", "rna_GameObjectSettings_state_set"); prop= RNA_def_property(srna, "used_state", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_array(prop, OB_MAX_STATES); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 90372dfb819..22cfb1c0a78 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -93,31 +93,38 @@ EnumPropertyItem snap_element_items[] = { EnumPropertyItem image_type_items[] = { {0, "", 0, "Image", NULL}, + {R_BMP, "BMP", ICON_FILE_IMAGE, "BMP", ""}, + //{R_DDS, "DDS", ICON_FILE_IMAGE, "DDS", ""}, // XXX not yet implemented + {R_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", ""}, {R_PNG, "PNG", ICON_FILE_IMAGE, "PNG", ""}, {R_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", ""}, #ifdef WITH_OPENJPEG {R_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", ""}, #endif - {R_BMP, "BMP", ICON_FILE_IMAGE, "BMP", ""}, {R_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", ""}, {R_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", ""}, - //{R_DDS, "DDS", ICON_FILE_IMAGE, "DDS", ""}, // XXX not yet implemented - //{R_HAMX, "HAMX", ICON_FILE_IMAGE, "HamX", ""}, // should remove this format, 8bits are so 80's - {R_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", ""}, {0, "", 0, " ", NULL}, + {R_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", ""}, + {R_DPX, "DPX",ICON_FILE_IMAGE, "DPX", ""}, #ifdef WITH_OPENEXR - {R_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", ""}, {R_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", ""}, + {R_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", ""}, #endif - {R_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", ""}, // XXX only with G.have_libtiff {R_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", ""}, - {R_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", ""}, - {R_DPX, "DPX", ICON_FILE_IMAGE, "DPX", ""}, +#ifdef WITH_TIFF + {R_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", ""}, +#endif {0, "", 0, "Movie", NULL}, - {R_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", ""}, - {R_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", ""}, #ifdef _WIN32 - {R_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", ""}, + {R_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", ""}, // XXX Missing codec menu +#endif + {R_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", ""}, + {R_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", ""}, + {R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", ""}, +#ifdef WITH_FFMPEG + {R_H264, "H264", ICON_FILE_MOVIE, "H.264", ""}, + {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", ""}, + {R_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", ""}, #endif #ifdef WITH_QUICKTIME # ifdef USE_QTKIT @@ -126,16 +133,9 @@ EnumPropertyItem image_type_items[] = { {R_QUICKTIME, "QUICKTIME_CARBON", ICON_FILE_MOVIE, "QuickTime", ""}, # endif #endif -#ifdef __sgi - {R_MOVIE, "MOVIE", ICON_FILE_MOVIE, "Movie", ""}, -#endif #ifdef WITH_FFMPEG - {R_H264, "H264", ICON_FILE_MOVIE, "H.264", ""}, {R_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", ""}, - {R_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", ""}, - {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", ""}, #endif - {R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", ""}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME @@ -376,16 +376,24 @@ static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value) scene->active_keyingset= ANIM_scene_get_keyingset_index(scene, ks); } -#if 0 // XXX: these need to be fixed up first... -static void rna_Scene_active_keying_set_index_range(PointerRNA *ptr, int *min, int *max) +/* get KeyingSet index stuff for list of Keying Sets editing UI + * - active_keyingset-1 since 0 is reserved for 'none' + * - don't clamp, otherwise can never set builtins types as active... + */ +static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr) { - Scene *scene= (Scene *)ptr->data; - - // FIXME: would need access to builtin keyingsets list to count min... - *min= 0; - *max= 0; + Scene *scene= (Scene *)ptr->data; + return scene->active_keyingset-1; +} + +/* get KeyingSet index stuff for list of Keying Sets editing UI + * - value+1 since 0 is reserved for 'none'= + */ +static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value) +{ + Scene *scene= (Scene *)ptr->data; + scene->active_keyingset= value+1; } -#endif // XXX: evil... builtin_keyingsets is defined in keyingsets.c! // TODO: make API function to retrieve this... @@ -1582,7 +1590,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen"); RNA_def_property_update(prop, NC_SCENE, NULL); - prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "depth"); RNA_def_property_range(prop, 8, 32); RNA_def_property_ui_text(prop, "Bits", "Displays bit depth of full screen display"); @@ -2376,7 +2384,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Local Coords", "Vertex coordinates are stored localy on each primitive. Increases memory usage, but may have impact on speed"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - prop= RNA_def_property(srna, "antialiasing", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "render_antialiasing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_OSA); RNA_def_property_ui_text(prop, "Anti-Aliasing", "Render and combine multiple samples per pixel to prevent jagged edges"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); @@ -2403,34 +2411,35 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Fields Still", "Disable the time difference between fields"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - prop= RNA_def_property(srna, "render_shadows", PROP_BOOLEAN, PROP_NONE); + /* rendering features */ + prop= RNA_def_property(srna, "use_shadows", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SHADOW); - RNA_def_property_ui_text(prop, "Render Shadows", "Calculate shadows while rendering"); + RNA_def_property_ui_text(prop, "Shadows", "Calculate shadows while rendering"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - prop= RNA_def_property(srna, "render_envmaps", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_envmaps", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_ENVMAP); - RNA_def_property_ui_text(prop, "Render Environment Maps", "Calculate environment maps while rendering"); + RNA_def_property_ui_text(prop, "Environment Maps", "Calculate environment maps while rendering"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - prop= RNA_def_property(srna, "render_radiosity", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_radiosity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_RADIO); - RNA_def_property_ui_text(prop, "Render Radiosity", "Calculate radiosity in a pre-process before rendering"); + RNA_def_property_ui_text(prop, "Radiosity", "Calculate radiosity in a pre-process before rendering"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - prop= RNA_def_property(srna, "render_sss", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_sss", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SSS); - RNA_def_property_ui_text(prop, "Render SSS", "Calculate sub-surface scattering in materials rendering"); + RNA_def_property_ui_text(prop, "Subsurface Scattering", "Calculate sub-surface scattering in materials rendering"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - prop= RNA_def_property(srna, "render_raytracing", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_raytracing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_RAYTRACE); - RNA_def_property_ui_text(prop, "Render Raytracing", "Pre-calculate the raytrace accelerator and render raytracing effects"); + RNA_def_property_ui_text(prop, "Raytracing", "Pre-calculate the raytrace accelerator and render raytracing effects"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - prop= RNA_def_property(srna, "render_textures", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "scemode", R_NO_TEX); - RNA_def_property_ui_text(prop, "Render Textures", "Use textures to affect material properties"); + RNA_def_property_ui_text(prop, "Textures", "Use textures to affect material properties"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "edge", PROP_BOOLEAN, PROP_NONE); @@ -2797,7 +2806,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Simplify", "Enable simplification of scene for quicker preview renders"); RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); - prop= RNA_def_property(srna, "simplify_subdivision", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "simplify_subdivision", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf"); RNA_def_property_ui_range(prop, 0, 6, 1, 0); RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level"); @@ -3116,7 +3125,7 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "active_keying_set_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_keyingset"); - //RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Scene_active_keying_set_index_range"); // XXX + RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL); RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index ff0f6ab7b30..85fcba286dd 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -128,11 +128,9 @@ EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, int *free) if (ob != NULL) { if (ob->type==OB_ARMATURE) { RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ARMATURE); - } else if(ob->type==OB_MESH) { - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION); } } - + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION); RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_DELAY); RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_JOYSTICK); RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_KEYBOARD); @@ -143,12 +141,7 @@ EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, int *free) RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RADAR); RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RANDOM); RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RAY); - - if (ob != NULL) { - if(ob->type==OB_MESH) { - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_TOUCH); - } - } + RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_TOUCH); RNA_enum_item_end(&item, &totitem); *free= 1; diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 7ba56d77801..500ea6ee429 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -338,6 +338,18 @@ static void rna_RegionView3D_quadview_update(Main *main, Scene *scene, PointerRN ED_view3d_quadview_update(sa, ar); } +static void rna_RegionView3D_view_location_get(PointerRNA *ptr, float *values) +{ + RegionView3D *rv3d= (RegionView3D *)(ptr->data); + negate_v3_v3(values, rv3d->ofs); +} + +static void rna_RegionView3D_view_location_set(PointerRNA *ptr, const float *values) +{ + RegionView3D *rv3d= (RegionView3D *)(ptr->data); + negate_v3_v3(rv3d->ofs, values); +} + /* Space Image Editor */ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) @@ -509,6 +521,28 @@ static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr) return &RNA_ID; } +static void rna_SpaceProperties_pin_id_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + SpaceButs *sbuts= (SpaceButs*)(ptr->data); + ID *id = sbuts->pinid; + + switch (GS(id->name)) { + case ID_MA: + WM_main_add_notifier(NC_MATERIAL|ND_SHADING, NULL); + break; + case ID_TE: + WM_main_add_notifier(NC_TEXTURE, NULL); + break; + case ID_WO: + WM_main_add_notifier(NC_WORLD, NULL); + break; + case ID_LA: + WM_main_add_notifier(NC_LAMP, NULL); + break; + } +} + + static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value) { SpaceButs *sbuts= (SpaceButs*)(ptr->data); @@ -899,7 +933,13 @@ static void rna_def_space_view3d(BlenderRNA *brna) {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", ""}, {V3D_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", ""}, {0, NULL, 0, NULL, NULL}}; - + + static EnumPropertyItem rv3d_persp_items[] = { + {RV3D_PERSP, "PERSP", 0, "Perspective", ""}, + {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""}, + {RV3D_CAMOB, "CAMERA", 0, "Camera", ""}, + {0, NULL, 0, NULL, NULL}}; + srna= RNA_def_struct(brna, "SpaceView3D", "Space"); RNA_def_struct_sdna(srna, "View3D"); RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data"); @@ -1146,6 +1186,34 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX: for now, it's too risky for users to do this RNA_def_property_multi_array(prop, 2, matrix_dimsize); RNA_def_property_ui_text(prop, "View Matrix", "Current view matrix of the 3D region"); + + prop= RNA_def_property(srna, "view_perspective", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "persp"); + RNA_def_property_enum_items(prop, rv3d_persp_items); + RNA_def_property_ui_text(prop, "Perspective", "View Perspective"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + + prop= RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION); +#if 0 + RNA_def_property_float_sdna(prop, NULL, "ofs"); // cant use because its negated +#else + RNA_def_property_array(prop, 3); + RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_location_get", "rna_RegionView3D_view_location_set", NULL); +#endif + RNA_def_property_ui_text(prop, "View Location", "View pivot location"); + RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4); + RNA_def_property_update(prop, NC_WINDOW, NULL); + + prop= RNA_def_property(srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION); + RNA_def_property_float_sdna(prop, NULL, "viewquat"); + RNA_def_property_ui_text(prop, "View Rotation", "Rotation in quaternions (keep normalized)"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + + /* not sure we need rna access to these but adding anyway */ + prop= RNA_def_property(srna, "view_distance", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "dist"); + RNA_def_property_ui_text(prop, "Distance", "Distance to the view location"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); } static void rna_def_space_buttons(BlenderRNA *brna) @@ -1203,7 +1271,7 @@ static void rna_def_space_buttons(BlenderRNA *brna) /* note: custom set function is ONLY to avoid rna setting a user for this. */ RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set", "rna_SpaceProperties_pin_id_typef"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update"); prop= RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index b2d613f83bf..5e58403e41b 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -620,13 +620,13 @@ static void rna_def_environment_map(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Ignore Layers", "Hide objects on these layers when generating the Environment Map"); RNA_def_property_update(prop, 0, "rna_Texture_update"); - prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "cuberes"); RNA_def_property_range(prop, 50, 4096); RNA_def_property_ui_text(prop, "Resolution", "Pixel resolution of the rendered environment map"); RNA_def_property_update(prop, 0, "rna_Texture_update"); - prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_range(prop, 0, 5); RNA_def_property_ui_text(prop, "Depth", "Number of times a map will be rendered recursively (mirror effects.)"); RNA_def_property_update(prop, 0, "rna_Texture_update"); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index aa152fbf2b0..e19efd745d8 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2052,6 +2052,13 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_timecode_style_set", NULL); RNA_def_property_ui_text(prop, "TimeCode Style", "Format of Time Codes displayed when not displaying timing in terms of frames"); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + /* Properties Window */ + prop= RNA_def_property(srna, "properties_width_check", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "propwidth"); + RNA_def_property_range(prop, 150, 400); + RNA_def_property_ui_text(prop, "Width Check", "Dual Column layout will change to single column layout when the width of the area gets below this value (needs restart to take effect)"); + RNA_def_property_update(prop, 0, "rna_userdef_update"); } static void rna_def_userdef_edit(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 3b0f53df43b..8d5e2291724 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -362,9 +362,9 @@ static void rna_def_world_mist(BlenderRNA *brna) RNA_def_struct_nested(brna, srna, "World"); RNA_def_struct_ui_text(srna, "World Mist", "Mist settings for a World data-block"); - prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_MIST); - RNA_def_property_ui_text(prop, "Enabled", "Occlude objects with the environment color as they are further away"); + RNA_def_property_ui_text(prop, "Use Mist", "Occlude objects with the environment color as they are further away"); RNA_def_property_update(prop, 0, "rna_World_draw_update"); prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE); @@ -410,9 +410,9 @@ static void rna_def_world_stars(BlenderRNA *brna) RNA_def_struct_nested(brna, srna, "World"); RNA_def_struct_ui_text(srna, "World Stars", "Stars setting for a World data-block"); - prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_stars", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_STARS); - RNA_def_property_ui_text(prop, "Enabled", "Enable starfield generation"); + RNA_def_property_ui_text(prop, "Use Stars", "Enable starfield generation"); RNA_def_property_update(prop, 0, "rna_World_draw_update"); prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py index 5de7ea0652d..69aa68acdc9 100644 --- a/source/blender/python/doc/sphinx_doc_gen.py +++ b/source/blender/python/doc/sphinx_doc_gen.py @@ -331,6 +331,11 @@ def rna2sphinx(BASEPATH): fw(" * user interface functions for defining buttons, creation of menus, headers, panels\n") fw(" * modules: bgl, mathutils and geometry\n") fw("\n") + + fw("===================\n") + fw("Application Modules\n") + fw("===================\n") + fw("\n") fw(".. toctree::\n") fw(" :maxdepth: 1\n\n") fw(" bpy.ops.rst\n\n") @@ -342,10 +347,31 @@ def rna2sphinx(BASEPATH): # C modules fw(" bpy.props.rst\n\n") - + + fw("==================\n") + fw("Standalone Modules\n") + fw("==================\n") + fw("\n") + fw(".. toctree::\n") + fw(" :maxdepth: 1\n\n") + + fw(" mathutils.rst\n\n") fw(" Freestyle.rst\n\n") fw(" blf.rst\n\n") + + # game engine + fw("===================\n") + fw("Game Engine Modules\n") + fw("===================\n") + fw("\n") + fw(".. toctree::\n") + fw(" :maxdepth: 1\n\n") + fw(" bge.types.rst\n\n") + fw(" bge.logic.rst\n\n") + fw(" bge.render.rst\n\n") + fw(" bge.events.rst\n\n") + file.close() @@ -371,7 +397,6 @@ def rna2sphinx(BASEPATH): file.close() - # python modules from bpy import utils as module pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)") @@ -395,6 +420,15 @@ def rna2sphinx(BASEPATH): pymodule2sphinx(BASEPATH, "blf", module, "Blender Font Drawing (blf)") del module + # game engine + import shutil + # copy2 keeps time/date stamps + shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.types.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.logic.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.render.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.events.rst"), BASEPATH) + + if 0: filepath = os.path.join(BASEPATH, "bpy.rst") file = open(filepath, "w") diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 63c518c8721..806b5a5b3ce 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -64,13 +64,16 @@ static int Buffer_ass_slice( PyObject * self, int begin, int end, PyObject * seq ); static PySequenceMethods Buffer_SeqMethods = { - ( lenfunc ) Buffer_len, /*sq_length */ - ( binaryfunc ) 0, /*sq_concat */ - ( ssizeargfunc ) 0, /*sq_repeat */ - ( ssizeargfunc ) Buffer_item, /*sq_item */ - ( ssizessizeargfunc ) Buffer_slice, /*sq_slice */ - ( ssizeobjargproc ) Buffer_ass_item, /*sq_ass_item */ - ( ssizessizeobjargproc ) Buffer_ass_slice, /*sq_ass_slice */ + ( lenfunc ) Buffer_len, /*sq_length */ + ( binaryfunc ) NULL, /*sq_concat */ + ( ssizeargfunc ) NULL, /*sq_repeat */ + ( ssizeargfunc ) Buffer_item, /*sq_item */ + ( ssizessizeargfunc ) Buffer_slice, /*sq_slice, deprecated TODO, replace */ + ( ssizeobjargproc ) Buffer_ass_item, /*sq_ass_item */ + ( ssizessizeobjargproc ) Buffer_ass_slice, /*sq_ass_slice, deprecated TODO, replace */ + (objobjproc) NULL, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; static void Buffer_dealloc( PyObject * self ); diff --git a/source/blender/python/generic/blf_api.c b/source/blender/python/generic/blf_api.c index a16481d760c..67f07ad8378 100644 --- a/source/blender/python/generic/blf_api.c +++ b/source/blender/python/generic/blf_api.c @@ -290,7 +290,9 @@ static char py_blf_shadow_doc[] = " :arg g: Shadow color (green channel 0.0 - 1.0).\n" " :type g: float\n" " :arg b: Shadow color (blue channel 0.0 - 1.0).\n" -" :type b: float\n"; +" :type b: float\n" +" :arg a: Shadow color (alpha channel 0.0 - 1.0).\n" +" :type a: float\n"; static PyObject *py_blf_shadow(PyObject *self, PyObject *args) { @@ -340,7 +342,7 @@ static char py_blf_load_doc[] = " Load a new font.\n" "\n" " :arg filename: the filename of the font.\n" -" :type text: string\n" +" :type filename: string\n" " :return: the new font's fontid or -1 if there was an error.\n" " :rtype: integer\n"; diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c index 34c8dd88b4b..5acd03060d4 100644 --- a/source/blender/python/generic/mathutils_color.c +++ b/source/blender/python/generic/mathutils_color.c @@ -326,12 +326,15 @@ static int Color_ass_subscript(ColorObject *self, PyObject *item, PyObject *valu //-----------------PROTCOL DECLARATIONS-------------------------- static PySequenceMethods Color_SeqMethods = { (lenfunc) Color_len, /* sq_length */ - (binaryfunc) 0, /* sq_concat */ - (ssizeargfunc) 0, /* sq_repeat */ + (binaryfunc) NULL, /* sq_concat */ + (ssizeargfunc) NULL, /* sq_repeat */ (ssizeargfunc) Color_item, /* sq_item */ (ssizessizeargfunc) NULL, /* sq_slice, deprecated */ (ssizeobjargproc) Color_ass_item, /* sq_ass_item */ (ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */ + (objobjproc) NULL, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; static PyMappingMethods Color_AsMapping = { diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c index 3bda1b3a991..aac65043a0a 100644 --- a/source/blender/python/generic/mathutils_euler.c +++ b/source/blender/python/generic/mathutils_euler.c @@ -557,12 +557,15 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu //-----------------PROTCOL DECLARATIONS-------------------------- static PySequenceMethods Euler_SeqMethods = { (lenfunc) Euler_len, /* sq_length */ - (binaryfunc) 0, /* sq_concat */ - (ssizeargfunc) 0, /* sq_repeat */ + (binaryfunc) NULL, /* sq_concat */ + (ssizeargfunc) NULL, /* sq_repeat */ (ssizeargfunc) Euler_item, /* sq_item */ (ssizessizeargfunc) NULL, /* sq_slice, deprecated */ (ssizeobjargproc) Euler_ass_item, /* sq_ass_item */ (ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */ + (objobjproc) NULL, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; static PyMappingMethods Euler_AsMapping = { diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c index 8bb46d8c966..a211386f503 100644 --- a/source/blender/python/generic/mathutils_matrix.c +++ b/source/blender/python/generic/mathutils_matrix.c @@ -1126,13 +1126,16 @@ static PyObject* Matrix_inv(MatrixObject *self) /*-----------------PROTOCOL DECLARATIONS--------------------------*/ static PySequenceMethods Matrix_SeqMethods = { - (lenfunc) Matrix_len, /* sq_length */ - (binaryfunc) 0, /* sq_concat */ - (ssizeargfunc) 0, /* sq_repeat */ - (ssizeargfunc) Matrix_item, /* sq_item */ - (ssizessizeargfunc) Matrix_slice, /* sq_slice */ - (ssizeobjargproc) Matrix_ass_item, /* sq_ass_item */ - (ssizessizeobjargproc) Matrix_ass_slice, /* sq_ass_slice */ + (lenfunc) Matrix_len, /* sq_length */ + (binaryfunc) NULL, /* sq_concat */ + (ssizeargfunc) NULL, /* sq_repeat */ + (ssizeargfunc) Matrix_item, /* sq_item */ + (ssizessizeargfunc) Matrix_slice, /* sq_slice, deprecated TODO, replace */ + (ssizeobjargproc) Matrix_ass_item, /* sq_ass_item */ + (ssizessizeobjargproc) Matrix_ass_slice, /* sq_ass_slice, deprecated TODO, replace */ + (objobjproc) NULL, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c index c39e6ee5587..f94e5e2a03a 100644 --- a/source/blender/python/generic/mathutils_quat.c +++ b/source/blender/python/generic/mathutils_quat.c @@ -707,13 +707,16 @@ static PyObject *Quaternion_mul(PyObject * q1, PyObject * q2) //-----------------PROTOCOL DECLARATIONS-------------------------- static PySequenceMethods Quaternion_SeqMethods = { - (lenfunc) Quaternion_len, /* sq_length */ - (binaryfunc) 0, /* sq_concat */ - (ssizeargfunc) 0, /* sq_repeat */ - (ssizeargfunc) Quaternion_item, /* sq_item */ - (ssizessizeargfunc) NULL, /* sq_slice, deprecated */ - (ssizeobjargproc) Quaternion_ass_item, /* sq_ass_item */ - (ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */ + (lenfunc) Quaternion_len, /* sq_length */ + (binaryfunc) NULL, /* sq_concat */ + (ssizeargfunc) NULL, /* sq_repeat */ + (ssizeargfunc) Quaternion_item, /* sq_item */ + (ssizessizeargfunc) NULL, /* sq_slice, deprecated */ + (ssizeobjargproc) Quaternion_ass_item, /* sq_ass_item */ + (ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */ + (objobjproc) NULL, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; static PyMappingMethods Quaternion_AsMapping = { diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c index c9e151167de..af549762756 100644 --- a/source/blender/python/generic/mathutils_vector.c +++ b/source/blender/python/generic/mathutils_vector.c @@ -279,7 +279,7 @@ static char Vector_ToTrackQuat_doc[] = " :type track: string\n" " :arg up: Up axis in ['X', 'Y', 'Z'].\n" " :type up: string\n" -" :return: rotation from the vector and the track and up axis." +" :return: rotation from the vector and the track and up axis.\n" " :rtype: :class:`Quaternion`\n"; static PyObject *Vector_ToTrackQuat(VectorObject *self, PyObject *args ) @@ -1258,13 +1258,16 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa /*-----------------PROTCOL DECLARATIONS--------------------------*/ static PySequenceMethods Vector_SeqMethods = { - (lenfunc) Vector_len, /* sq_length */ - (binaryfunc) 0, /* sq_concat */ - (ssizeargfunc) 0, /* sq_repeat */ - (ssizeargfunc) Vector_item, /* sq_item */ - NULL, /* py3 deprecated slice func */ - (ssizeobjargproc) Vector_ass_item, /* sq_ass_item */ - NULL, /* py3 deprecated slice assign func */ + (lenfunc) Vector_len, /* sq_length */ + (binaryfunc) 0, /* sq_concat */ + (ssizeargfunc) 0, /* sq_repeat */ + (ssizeargfunc) Vector_item, /* sq_item */ + NULL, /* py3 deprecated slice func */ + (ssizeobjargproc) Vector_ass_item, /* sq_ass_item */ + NULL, /* py3 deprecated slice assign func */ + (objobjproc) NULL, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; static PyObject *Vector_subscript(VectorObject* self, PyObject* item) diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 15c6ad09e69..4a2ac0c9252 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -46,6 +46,7 @@ static PyStructSequence_Field app_info_fields[] = { {"home", "The blender home directory, normally matching $HOME"}, {"binary_path", "The location of blenders executable, useful for utilities that spawn new instances"}, {"debug", "Boolean, set when blender is running in debug mode (started with -d)"}, + {"background", "Boolean, True when blender is running without a user interface (started with -b)"}, /* buildinfo */ {"build_date", "The date this blender instance was built"}, @@ -60,7 +61,7 @@ static PyStructSequence_Desc app_info_desc = { "bpy.app", /* name */ "This module contains application values that remain unchanged during runtime.", /* doc */ app_info_fields, /* fields */ - 10 + (sizeof(app_info_fields)/sizeof(PyStructSequence_Field)) - 1 }; static PyObject *make_app_info(void) @@ -87,6 +88,7 @@ static PyObject *make_app_info(void) SetStrItem(BLI_gethome()); SetStrItem(bprogname); SetObjItem(PyBool_FromLong(G.f & G_DEBUG)); + SetObjItem(PyBool_FromLong(G.background)); /* build info */ #ifdef BUILD_DATE diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 5b1a8958247..afe6b63458f 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -109,7 +109,11 @@ static int bpy_pydriver_create_dict(void) */ void BPY_pydriver_update(void) { - PyGILState_STATE gilstate = PyGILState_Ensure(); + PyGILState_STATE gilstate; + int use_gil= 1; // (PyThreadState_Get()==NULL); + + if(use_gil) + gilstate = PyGILState_Ensure(); if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */ PyDict_Clear(bpy_pydriver_Dict); @@ -117,7 +121,8 @@ void BPY_pydriver_update(void) bpy_pydriver_Dict = NULL; } - PyGILState_Release(gilstate); + if(use_gil) + PyGILState_Release(gilstate); return; } @@ -143,6 +148,10 @@ static float pydriver_error(ChannelDriver *driver) /* This evals py driver expressions, 'expr' is a Python expression that * should evaluate to a float number, which is returned. + * + * note: PyGILState_Ensure() isnt always called because python can call the + * bake operator which intern starts a thread which calls scene update which + * does a driver update. to avoid a deadlock check PyThreadState_Get() if PyGILState_Ensure() is needed. */ float BPY_pydriver_eval (ChannelDriver *driver) { @@ -151,6 +160,7 @@ float BPY_pydriver_eval (ChannelDriver *driver) PyObject *expr_vars; /* speed up by pre-hashing string & avoids re-converting unicode strings for every execution */ PyObject *expr_code; PyGILState_STATE gilstate; + int use_gil; DriverVar *dvar; double result = 0.0; /* default return */ @@ -168,13 +178,17 @@ float BPY_pydriver_eval (ChannelDriver *driver) return 0.0f; } - gilstate = PyGILState_Ensure(); + use_gil= 1; //(PyThreadState_Get()==NULL); + + if(use_gil) + gilstate = PyGILState_Ensure(); /* init global dictionary for py-driver evaluation settings */ if (!bpy_pydriver_Dict) { if (bpy_pydriver_create_dict() != 0) { fprintf(stderr, "Pydriver error: couldn't create Python dictionary"); - PyGILState_Release(gilstate); + if(use_gil) + PyGILState_Release(gilstate); return 0.0f; } } @@ -269,7 +283,8 @@ float BPY_pydriver_eval (ChannelDriver *driver) Py_DECREF(retval); } - PyGILState_Release(gilstate); + if(use_gil) + PyGILState_Release(gilstate); if(finite(result)) { return (float)result; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index f047ca7341e..3aed5a8c7cc 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1194,17 +1194,17 @@ static Py_ssize_t pyrna_prop_collection_length( BPy_PropertyRNA *self ) static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum) { PointerRNA newptr; - int len= RNA_property_collection_length(&self->ptr, self->prop); + int len= RNA_property_collection_length(&self->ptr, self->prop); if(keynum < 0) keynum += len; - if(keynum >= 0 && keynum < len) { - if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum, &newptr)) { - return pyrna_struct_CreatePyObject(&newptr); - } - PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d could not be found", keynum); - return NULL; - } + if(keynum >= 0 && keynum < len) { + if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum, &newptr)) { + return pyrna_struct_CreatePyObject(&newptr); + } + PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d could not be found", keynum); + return NULL; + } PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d out of range", keynum); return NULL; } @@ -1637,6 +1637,8 @@ static PySequenceMethods pyrna_prop_array_as_sequence = { (ssizeobjargproc)prop_subscript_ass_array_int, /* sq_ass_item */ NULL, /* *was* sq_ass_slice */ (objobjproc)pyrna_prop_array_contains, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; static PySequenceMethods pyrna_prop_collection_as_sequence = { @@ -1648,6 +1650,8 @@ static PySequenceMethods pyrna_prop_collection_as_sequence = { NULL, /* sq_ass_item */ NULL, /* *was* sq_ass_slice */ (objobjproc)pyrna_prop_collection_contains, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; static PySequenceMethods pyrna_struct_as_sequence = { @@ -1659,6 +1663,8 @@ static PySequenceMethods pyrna_struct_as_sequence = { NULL, /* sq_ass_item */ NULL, /* *was* sq_ass_slice */ (objobjproc)pyrna_struct_contains, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; static PyObject *pyrna_struct_subscript( BPy_StructRNA *self, PyObject *key ) @@ -1886,7 +1892,7 @@ static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *arg char *path_full= NULL; int index= -1; float cfra= FLT_MAX; - char *group_name= NULL; + char *group_name= NULL; if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()", &path_full, &index, &cfra, &group_name) == -1) return NULL; @@ -1920,7 +1926,7 @@ static PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *arg char *path_full= NULL; int index= -1; float cfra= FLT_MAX; - char *group_name= NULL; + char *group_name= NULL; if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_delete()", "bpy_struct.keyframe_insert()", &path_full, &index, &cfra, &group_name) == -1) return NULL; @@ -3550,7 +3556,7 @@ PyTypeObject pyrna_prop_Type = { 0, /* tp_itemsize */ /* methods */ NULL, /* tp_dealloc */ - NULL, /* printfunc tp_print; */ + NULL, /* printfunc tp_print; */ NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 047bbd7629f..760ce5636bb 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -2634,7 +2634,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up get_next_bake_face(NULL); /* do we need a mask? */ - if (re->r.bake_filter && (re->r.bake_flag & R_BAKE_CLEAR)==0) + if (re->r.bake_filter) usemask = 1; /* baker uses this flag to detect if image was initialized */ |