diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-11-30 13:38:59 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-11-30 13:38:59 +0300 |
commit | a4c17c7c88dfdb1f4694a70f9be4639fe892e43b (patch) | |
tree | 132e48dbb2a7aeb45c99e59a160f283b79deddfe /source | |
parent | 04a009b047e13f6696b6780419b1561ef29c9854 (diff) |
anim.c, buttons_object.c, readfile.c, BKE_blender.h - dupliFace scale option, needed for leaves.
modifier.c, BKE_modifier.h - flag for modifiers to say they use pointcache, also new func modifiers_usesPointCache
renamed //pointcache to //blendcache_blendfilename so blendfiles in the same dir dont conflict, and other to show this dir isnt limited to pointcache only (nodes way want to use this)
wizard_curve2tree.py - better defaults for pretty tree's
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_pointcache.h | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 19 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 18 | ||||
-rw-r--r-- | source/blender/blenlib/intern/util.c | 1 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 11 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_types.h | 3 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 14 |
10 files changed, 69 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 075405b1097..1f8d5e44c96 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -44,7 +44,7 @@ struct ListBase; struct MemFile; #define BLENDER_VERSION 245 -#define BLENDER_SUBVERSION 9 +#define BLENDER_SUBVERSION 10 #define BLENDER_MINVERSION 240 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 24da941db90..931f0e12fd4 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -85,6 +85,10 @@ typedef enum { * be placed after any non-deformative modifier. */ eModifierTypeFlag_RequiresOriginalData = (1<<5), + + /* For modifiers that support pointcache, so we can check to see if it has files we need to deal with + */ + eModifierTypeFlag_UsesPointCache = (1<<6), } ModifierTypeFlag; typedef void (*ObjectWalkFunc)(void *userData, struct Object *ob, struct Object **obpoin); diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index efd727d2141..52cc0ddcaa7 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -38,9 +38,15 @@ #define PTCACHE_CLEAR_BEFORE 2 #define PTCACHE_CLEAR_AFTER 3 +/* Add the blendfile name after blendcache_ */ #define PTCACHE_EXT ".bphys" -#define PTCACHE_PATH "//pointcache/" +#define PTCACHE_PATH "//blendcache_" +/* Global funcs */ +/* void BKE_ptcache_clean(void); - not implimented yet! */ + + +/* Object spesific funcs */ int BKE_ptcache_id_filename(struct ID *id, char *filename, int cfra, int stack_index, short do_path, short do_ext); FILE * BKE_ptcache_id_fopen(struct ID *id, char mode, int cfra, int stack_index); void BKE_ptcache_id_clear(struct ID *id, char mode, int cfra, int stack_index); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 43168733b3f..87bba6abca8 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -538,7 +538,7 @@ static void face_duplilist(ListBase *lb, Scene *sce, Object *par) /* scale */ if(par->transflag & OB_DUPLIFACES_SCALE) { float size= v4?AreaQ3Dfl(v1, v2, v3, v4):AreaT3Dfl(v1, v2, v3); - size= sqrt(size); + size= sqrt(size) * par->dupfacesca; Mat3MulFloat(mat[0], size); } diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 6fa4fb6b3cc..fadc41b3042 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -6739,7 +6739,9 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) mti = INIT_TYPE(Boolean); mti->type = eModifierTypeType_Nonconstructive; - mti->flags = eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_RequiresOriginalData; + mti->flags = eModifierTypeFlag_AcceptsMesh + | eModifierTypeFlag_RequiresOriginalData + | eModifierTypeFlag_UsesPointCache; mti->copyData = booleanModifier_copyData; mti->isDisabled = booleanModifier_isDisabled; mti->applyModifier = booleanModifier_applyModifier; @@ -6763,7 +6765,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) mti = INIT_TYPE(ParticleSystem); mti->type = eModifierTypeType_OnlyDeform; mti->flags = eModifierTypeFlag_AcceptsMesh - | eModifierTypeFlag_SupportsMapping; + | eModifierTypeFlag_SupportsMapping + | eModifierTypeFlag_UsesPointCache; #if 0 | eModifierTypeFlag_SupportsEditmode; |eModifierTypeFlag_EnableInEditmode; @@ -7192,3 +7195,15 @@ int modifiers_indexInObject(Object *ob, ModifierData *md_seek) return i; } +int modifiers_usesPointCache(Object *ob) +{ + ModifierData *md = ob->modifiers.first; + + for (; md; md=md->next) { + ModifierTypeInfo *mti = modifierType_getInfo(md->type); + if (mti->flags & eModifierTypeFlag_UsesPointCache) { + return 1; + } + } + return 0; +}
\ No newline at end of file diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index c4ef437019e..2afcf19427c 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -59,7 +59,17 @@ static int ptcache_path(char *filename) { - sprintf(filename, PTCACHE_PATH); + char dir[FILE_MAX], file[FILE_MAX]; /* we dont want the dir, only the file */ + int i; + + BLI_split_dirfile(G.sce, dir, file); + i = strlen(file); + + /* remove .blend */ + if (i > 6) + file[i-6] = '\0'; + + sprintf(filename, PTCACHE_PATH"%s/", file); /* add blend file name to pointcache dir */ BLI_convertstringcode(filename, G.sce, 0); return strlen(filename); } @@ -72,6 +82,8 @@ int BKE_ptcache_id_filename(struct ID *id, char *filename, int cfra, int stack_i filename[0] = '\0'; newname = filename; + if (!G.relbase_valid) return 0; /* save blend fiel before using pointcache */ + /* start with temp dir */ if (do_path) { len = ptcache_path(filename); @@ -100,6 +112,8 @@ FILE *BKE_ptcache_id_fopen(struct ID *id, char mode, int cfra, int stack_index) FILE *fp = NULL; char filename[(FILE_MAXDIR+FILE_MAXFILE)*2]; + if (!G.relbase_valid) return NULL; /* save blend fiel before using pointcache */ + BKE_ptcache_id_filename(id, filename, cfra, stack_index, 1, 1); if (mode=='r') { @@ -135,6 +149,8 @@ void BKE_ptcache_id_clear(struct ID *id, char mode, int cfra, int stack_index) char filename[(FILE_MAXDIR+FILE_MAXFILE)*2]; char path_full[(FILE_MAXDIR+FILE_MAXFILE)*2]; + if (!G.relbase_valid) return; /* save blend fiel before using pointcache */ + /* clear all files in the temp dir with the prefix of the ID and the ".bphys" suffix */ switch (mode) { case PTCACHE_CLEAR_ALL: diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index 9e8fe80ae30..9ababcae39d 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -1023,6 +1023,7 @@ int BLI_convertstringcode(char *path, const char *basepath, int framenum) return wasrelative; } +/* copy di to fi without directory only */ void BLI_splitdirstring(char *di, char *fi) { char *lslash= BLI_last_slash(di); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ff2a4edab9d..1e947e56711 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7180,6 +7180,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if(ma->mtex[a] && ma->mtex[a]->tex) ma->mtex[a]->normapspace = MTEX_NSPACE_TANGENT; } + + if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 10)) { + Object *ob; + /* dupliface scale */ + for(ob= main->object.first; ob; ob= ob->id.next) { + ob->dupfacesca = 1.0f; + } + + } + + /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 5b875780f8b..f2c8b57571b 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -141,8 +141,9 @@ typedef struct Object { char dt, dtx; char totcol; /* copy of mesh or curve or meta */ char actcol; /* currently selected material in the user interface */ - char empty_drawtype, pad1[7]; + char empty_drawtype, pad1[3]; float empty_drawsize; + float dupfacesca; /* dupliface scale */ ScriptLink scriptlink; ListBase prop; diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index a6651e4a77c..45f1cbe3e9f 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -2416,15 +2416,17 @@ static void object_panel_anim(Object *ob) uiDefButBitS(block, TOG, OB_DUPLIVERTS, B_DUPLI_VERTS, "DupliVerts", 119,130,95,20, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices"); uiDefButBitS(block, TOG, OB_DUPLIFACES, B_DUPLI_FACES, "DupliFaces", 214,130,102,20, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all faces"); uiDefButBitS(block, TOG, OB_DUPLIGROUP, B_DUPLI_GROUP, "DupliGroup", 24,110,150,20, &ob->transflag, 0, 0, 0, 0, "Enable group instancing"); - if(ob->transflag & OB_DUPLIFRAMES) + if(ob->transflag & OB_DUPLIFRAMES) { uiDefButBitS(block, TOG, OB_DUPLINOSPEED, REDRAWVIEW3D, "No Speed", 174,110,142,20, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame"); - else if(ob->transflag & OB_DUPLIVERTS) + } else if(ob->transflag & OB_DUPLIVERTS) { uiDefButBitS(block, TOG, OB_DUPLIROT, REDRAWVIEW3D, "Rot", 174,110,142,20, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to vertex normal"); - else if(ob->transflag & OB_DUPLIFACES) - uiDefButBitS(block, TOG, OB_DUPLIFACES_SCALE, REDRAWVIEW3D, "Scale", 174,110,142,20, &ob->transflag, 0, 0, 0, 0, "Scale dupli based on face size"); - else + } else if(ob->transflag & OB_DUPLIFACES) { + uiDefButBitS(block, TOG, OB_DUPLIFACES_SCALE, REDRAWVIEW3D, "Scale", 174,110,80,20, &ob->transflag, 0, 0, 0, 0, "Scale dupli based on face size"); + uiDefButF(block, NUM, REDRAWVIEW3D, "", 254,110,62,20, &ob->dupfacesca, 0.001, 10000.0, 0, 0, "Scale the DupliFace objects"); + } else { uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, B_GROUP_RELINK, "GR:", 174,110,142,20, &ob->dup_group, "Instance an existing group"); - + } + uiBlockBeginAlign(block); /* DupSta and DupEnd are both shorts, so the maxframe is greater then their range just limit the buttons to the max short */ |