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
This commit is contained in:
Campbell Barton 2007-11-30 10:38:59 +00:00
parent 04a009b047
commit a4c17c7c88
11 changed files with 77 additions and 21 deletions

View File

@ -325,7 +325,7 @@ class tree:
do_twigs_fill = 0,\
twig_fill_levels=4,\
twig_fill_rand_scale=0.0,\
twig_fill_fork_angle_max=60.0,\
twig_fill_fork_angle_max=180.0,\
twig_fill_radius_min=0.1,\
twig_fill_radius_factor=0.75,\
twig_fill_shape_type=0,\
@ -1795,7 +1795,7 @@ class tree:
leaf_branch_limit_type_grow = False,\
leaf_branch_limit_type_fill = False,\
leaf_size = 0.5,\
leaf_size_rand = 0.0,\
leaf_size_rand = 0.5,\
leaf_branch_density = 0.2,\
leaf_branch_pitch_angle = 0.0,\
leaf_branch_pitch_rand = 0.2,\
@ -3061,13 +3061,13 @@ PREFS['anim_offset_scale'] = Draw.Create(1.0)
PREFS['do_twigs_fill'] = Draw.Create(0)
PREFS['twig_fill_levels'] = Draw.Create(4)
PREFS['twig_fill_rand_scale'] = Draw.Create(0.0)
PREFS['twig_fill_fork_angle_max'] = Draw.Create(60.0)
PREFS['twig_fill_rand_scale'] = Draw.Create(0.1)
PREFS['twig_fill_fork_angle_max'] = Draw.Create(180.0)
PREFS['twig_fill_radius_min'] = Draw.Create(0.001)
PREFS['twig_fill_radius_factor'] = Draw.Create(0.75)
PREFS['twig_fill_shape_type'] = Draw.Create(0)
PREFS['twig_fill_shape_rand'] = Draw.Create(0.0)
PREFS['twig_fill_shape_power'] = Draw.Create(0.3)
PREFS['twig_fill_shape_type'] = Draw.Create(1)
PREFS['twig_fill_shape_rand'] = Draw.Create(0.5)
PREFS['twig_fill_shape_power'] = Draw.Create(0.5)
PREFS['do_twigs'] = Draw.Create(0)
PREFS['twig_ratio'] = Draw.Create(2.0)
@ -3100,7 +3100,7 @@ PREFS['leaf_branch_roll_rand'] = Draw.Create(0.2)
PREFS['leaf_branch_angle'] = Draw.Create(75.0)
PREFS['leaf_rand_seed'] = Draw.Create(1.0)
PREFS['leaf_size'] = Draw.Create(0.5)
PREFS['leaf_size_rand'] = Draw.Create(0.0)
PREFS['leaf_size_rand'] = Draw.Create(0.5)
PREFS['leaf_object'] = Draw.Create('')

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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:

View File

@ -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);

View File

@ -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! */

View File

@ -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;

View File

@ -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 */