diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-29 07:42:19 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-29 07:42:19 +0400 |
commit | fe26492538edefe60a342bce109e17b9536e5a16 (patch) | |
tree | df81d2485abd06be9cd2f4536a661b05153dff94 /source/blender/blenkernel | |
parent | 8f969fdc40cded16ec58f6810585411adbb5538d (diff) | |
parent | cf9e619889fdcdc457e44d4b384cda091de55673 (diff) |
Merged changes in the trunk up to revision 54171.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_packedFile.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/packedFile.c | 74 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 2 |
8 files changed, 89 insertions, 19 deletions
diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index 9dcbb41c7dc..b19a2092206 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -35,6 +35,7 @@ #define RET_OK 0 #define RET_ERROR 1 +struct ID; struct bSound; struct Image; struct Main; @@ -72,5 +73,10 @@ int seekPackedFile(struct PackedFile *pf, int offset, int whence); void rewindPackedFile(struct PackedFile *pf); int readPackedFile(struct PackedFile *pf, void *data, int size); +/* ID should be not NULL, return 1 if there's a packed file */ +int BKE_pack_check(struct ID *id); +/* ID should be not NULL, throws error when ID is Library */ +void BKE_unpack_id(struct Main *bmain, struct ID *id, struct ReportList *reports, int how); + #endif diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index dab54756c82..bc9c8a7ad50 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -312,7 +312,7 @@ static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets) BLI_addhead(&scene->base, base); mpt->ob->flag |= BA_TEMP_TAG; - + /* we really don't need to continue anymore once this happens, but this line might really 'break' */ break; } diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index aecf6e5e437..c8fd8aa93e5 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -507,7 +507,7 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths else if (dstAdt->action == srcAdt->action) { printf("Argh! Source and Destination share animation! ('%s' and '%s' both use '%s') Making new empty action\n", srcID->name, dstID->name, srcAdt->action->id.name); - + /* TODO: review this... */ id_us_min(&dstAdt->action->id); dstAdt->action = add_empty_action(dstAdt->action->id.name + 2); @@ -536,9 +536,9 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths /* just need to change lists */ BLI_remlink(&srcAdt->drivers, fcu); BLI_addtail(&dstAdt->drivers, fcu); - + /* TODO: add depsgraph flushing calls? */ - + /* can stop now, as moved already */ break; } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index ad14dee168a..3a705a07e22 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2258,7 +2258,7 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha { bActionModifier *amod; bActionStrip *strip, *strip2; - float scene_cfra = (float)scene->r.cfra; + float scene_cfra = BKE_scene_frame_get(scene); int do_modif; for (strip = armob->nlastrips.first; strip; strip = strip->next) { diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 803b1e68915..cb0a11a16e0 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1065,7 +1065,7 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int if (key->slurph && key->type != KEY_RELATIVE) { const float ctime_scaled = key->ctime / 100.0f; float delta = (float)key->slurph / tot; - float cfra = (float)scene->r.cfra + scene->r.subframe; + float cfra = BKE_scene_frame_get(scene); int step, a; if (tot > 100 && slurph_opt) { @@ -1163,7 +1163,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in if (key->slurph && key->type != KEY_RELATIVE) { const float ctime_scaled = key->ctime / 100.0f; float delta = (float)key->slurph / tot; - float cfra = (float)scene->r.cfra + scene->r.subframe; + float cfra = BKE_scene_frame_get(scene); Nurb *nu; int i = 0, remain = 0; int step, a; @@ -1245,7 +1245,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int if (key->slurph && key->type != KEY_RELATIVE) { const float ctime_scaled = key->ctime / 100.0f; float delta = (float)key->slurph / tot; - float cfra = (float)scene->r.cfra + scene->r.subframe; + float cfra = BKE_scene_frame_get(scene); int a; for (a = 0; a < tot; a++, cfra += delta) { @@ -1360,7 +1360,7 @@ float *BKE_key_evaluate_object(Scene *scene, Object *ob, int *r_totelem) } else { /* do shapekey local drivers */ - float ctime = (float)scene->r.cfra + scene->r.subframe; + float ctime = BKE_scene_frame_get(scene); BKE_animsys_evaluate_animdata(scene, &key->id, key->adt, ctime, ADT_RECALC_DRIVERS); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 8a6309593f1..a46196f38d8 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1822,7 +1822,7 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4]) CLAMP(ctime, 0.0f, 1.0f); } else { - ctime = scene->r.cfra; + ctime = BKE_scene_frame_get(scene); if (IS_EQF(cu->pathlen, 0.0f) == 0) ctime /= cu->pathlen; @@ -2201,7 +2201,7 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) void BKE_object_where_is_calc(struct Scene *scene, Object *ob) { - BKE_object_where_is_calc_time(scene, ob, (float)scene->r.cfra); + BKE_object_where_is_calc_time(scene, ob, BKE_scene_frame_get(scene)); } void BKE_object_where_is_calc_simul(Scene *scene, Object *ob) @@ -2240,7 +2240,7 @@ void BKE_object_where_is_calc_simul(Scene *scene, Object *ob) bConstraintOb *cob; cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); - BKE_solve_constraints(&ob->constraints, cob, (float)scene->r.cfra); + BKE_solve_constraints(&ob->constraints, cob, BKE_scene_frame_get(scene)); BKE_constraints_clear_evalob(cob); } } @@ -2684,7 +2684,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob) if (ob->recalc & OB_RECALC_DATA) { ID *data_id = (ID *)ob->data; AnimData *adt = BKE_animdata_from_id(data_id); - float ctime = (float)scene->r.cfra; /* XXX this is bad... */ + float ctime = BKE_scene_frame_get(scene); if (G.debug & G_DEBUG) printf("recalcdata %s\n", ob->id.name + 2); diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 9fab052f80c..288e4ccde5d 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -44,9 +44,9 @@ #include "DNA_image_types.h" #include "DNA_ID.h" +#include "DNA_packedFile_types.h" #include "DNA_sound_types.h" #include "DNA_vfont_types.h" -#include "DNA_packedFile_types.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -233,11 +233,13 @@ void packAll(Main *bmain, ReportList *reports) Image *ima; VFont *vfont; bSound *sound; + int tot = 0; for (ima = bmain->image.first; ima; ima = ima->id.next) { if (ima->packedfile == NULL && ima->id.lib == NULL) { if (ima->source == IMA_SRC_FILE) { ima->packedfile = newPackedFile(reports, ima->name, ID_BLEND_PATH(bmain, &ima->id)); + tot ++; } else if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported", @@ -246,13 +248,26 @@ void packAll(Main *bmain, ReportList *reports) } } - for (vfont = bmain->vfont.first; vfont; vfont = vfont->id.next) - if (vfont->packedfile == NULL && vfont->id.lib == NULL && BKE_vfont_is_builtin(vfont) == FALSE) + for (vfont = bmain->vfont.first; vfont; vfont = vfont->id.next) { + if (vfont->packedfile == NULL && vfont->id.lib == NULL && BKE_vfont_is_builtin(vfont) == FALSE) { vfont->packedfile = newPackedFile(reports, vfont->name, bmain->name); + tot ++; + } + } - for (sound = bmain->sound.first; sound; sound = sound->id.next) - if (sound->packedfile == NULL && sound->id.lib == NULL) + for (sound = bmain->sound.first; sound; sound = sound->id.next) { + if (sound->packedfile == NULL && sound->id.lib == NULL) { sound->packedfile = newPackedFile(reports, sound->name, bmain->name); + tot++; + } + } + + if (tot == 0) + BKE_report(reports, RPT_INFO, "No files have been packed"); + else + BKE_reportf(reports, RPT_INFO, "Packed %d files", tot); + + } @@ -316,6 +331,9 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i BKE_reportf(reports, RPT_ERROR, "Error writing file '%s'", name); ret_value = RET_ERROR; } + else + BKE_reportf(reports, RPT_INFO, "Saved packed file to: %s", name); + close(file); } else { @@ -439,6 +457,7 @@ char *unpackFile(ReportList *reports, const char *abs_name, const char *local_na case PF_USE_ORIGINAL: /* if file exists use it */ if (BLI_exists(abs_name)) { + BKE_reportf(reports, RPT_INFO, "Use existing file (instead of packed): %s", abs_name); temp = abs_name; break; } @@ -604,3 +623,48 @@ void unpackAll(Main *bmain, ReportList *reports, int how) unpackSound(bmain, reports, sound, how); } +/* ID should be not NULL, return 1 if there's a packed file */ +int BKE_pack_check(ID *id) +{ + if (GS(id->name) == ID_IM) { + Image *ima = (Image *)id; + return ima->packedfile != NULL; + } + if (GS(id->name) == ID_VF) { + VFont *vf = (VFont *)id; + return vf->packedfile != NULL; + } + if (GS(id->name) == ID_SO) { + bSound *snd = (bSound *)id; + return snd->packedfile != NULL; + } + if (GS(id->name) == ID_LI) { + Library *li = (Library *)id; + return li->packedfile != NULL; + } + return 0; +} + +/* ID should be not NULL */ +void BKE_unpack_id(Main *bmain, ID *id, ReportList *reports, int how) +{ + if (GS(id->name) == ID_IM) { + Image *ima = (Image *)id; + if (ima->packedfile) + unpackImage(reports, ima, how); + } + if (GS(id->name) == ID_VF) { + VFont *vf = (VFont *)id; + if (vf->packedfile) + unpackVFont(reports, vf, how); + } + if (GS(id->name) == ID_SO) { + bSound *snd = (bSound *)id; + if (snd->packedfile) + unpackSound(bmain, reports, snd, how); + } + if (GS(id->name) == ID_LI) { + Library *li = (Library *)id; + BKE_reportf(reports, RPT_ERROR, "Cannot unpack individual Library file, '%s'", li->name); + } +} diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index ce6e158b6d9..0d0944d6ea7 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1720,7 +1720,7 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes) if (ccgdm->pbvh && ccgdm->multires.mmd && !fast) { if (dm->numTessFaceData) { BKE_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL, - setMaterial, FALSE); + setMaterial, FALSE); glShadeModel(GL_FLAT); } |