Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_object_force.c')
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c85
1 files changed, 47 insertions, 38 deletions
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 3a8f66a3773..fe69fefa879 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -110,15 +110,19 @@ static void rna_Cache_change(Main *bmain, Scene *scene, PointerRNA *ptr)
BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
- DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
for(pid=pidlist.first; pid; pid=pid->next) {
if(pid->cache==cache)
break;
}
- if(pid)
+ if(pid) {
+ /* Just make sure this wasn't changed. */
+ if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
+ cache->step = 1;
BKE_ptcache_update_info(pid);
+ }
BLI_freelistN(&pidlist);
}
@@ -140,8 +144,11 @@ static void rna_Cache_toggle_disk_cache(Main *bmain, Scene *scene, PointerRNA *p
break;
}
- if(pid)
+ /* smoke can only use disk cache */
+ if(pid && pid->type != PTCACHE_TYPE_SMOKE_DOMAIN)
BKE_ptcache_toggle_disk_cache(pid);
+ else
+ cache->flag ^= PTCACHE_DISK_CACHE;
BLI_freelistN(&pidlist);
}
@@ -153,7 +160,6 @@ static void rna_Cache_idname_change(Main *bmain, Scene *scene, PointerRNA *ptr)
PTCacheID *pid = NULL, *pid2= NULL;
ListBase pidlist;
int new_name = 1;
- char name[80];
if(!ob)
return;
@@ -171,11 +177,9 @@ static void rna_Cache_idname_change(Main *bmain, Scene *scene, PointerRNA *ptr)
if(!pid)
return;
- cache->flag |= (PTCACHE_BAKED|PTCACHE_DISK_CACHE|PTCACHE_SIMULATION_VALID);
- cache->flag &= ~(PTCACHE_OUTDATED|PTCACHE_FRAMES_SKIPPED);
-
BKE_ptcache_load_external(pid);
- DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else {
for(pid=pidlist.first; pid; pid=pid->next) {
@@ -190,19 +194,13 @@ static void rna_Cache_idname_change(Main *bmain, Scene *scene, PointerRNA *ptr)
if(new_name) {
if(pid2 && cache->flag & PTCACHE_DISK_CACHE) {
- /* TODO: change to simple file rename */
- strcpy(name, cache->name);
- strcpy(cache->name, cache->prev_name);
-
- cache->flag &= ~PTCACHE_DISK_CACHE;
+ char old_name[80];
+ char new_name[80];
- BKE_ptcache_toggle_disk_cache(pid2);
+ strcpy(old_name, cache->prev_name);
+ strcpy(new_name, cache->name);
- strcpy(cache->name, name);
-
- cache->flag |= PTCACHE_DISK_CACHE;
-
- BKE_ptcache_toggle_disk_cache(pid2);
+ BKE_ptcache_disk_cache_rename(pid2, old_name, new_name);
}
strcpy(cache->prev_name, cache->name);
@@ -482,7 +480,7 @@ static void rna_FieldSettings_update(Main *bmain, Scene *scene, PointerRNA *ptr)
part->pd2->tex= 0;
}
- DAG_id_flush_update(&part->id, OB_RECALC_ALL|PSYS_RECALC_RESET);
+ DAG_id_tag_update(&part->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME|PSYS_RECALC_RESET);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
}
@@ -494,7 +492,7 @@ static void rna_FieldSettings_update(Main *bmain, Scene *scene, PointerRNA *ptr)
ob->pd->tex= 0;
}
- DAG_id_flush_update(&ob->id, OB_RECALC_OB);
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
}
}
@@ -524,7 +522,7 @@ static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA
static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
if(particle_id_check(ptr)) {
- DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_ALL|PSYS_RECALC_RESET);
+ DAG_id_tag_update((ID*)ptr->id.data, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME|PSYS_RECALC_RESET);
}
else {
Object *ob= (Object*)ptr->id.data;
@@ -541,9 +539,9 @@ static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, Point
DAG_scene_sort(bmain, scene);
if(ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE)
- DAG_id_flush_update(&ob->id, OB_RECALC_ALL);
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME);
else
- DAG_id_flush_update(&ob->id, OB_RECALC_OB);
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
}
@@ -575,7 +573,7 @@ static char *rna_FieldSettings_path(PointerRNA *ptr)
static void rna_EffectorWeight_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET);
+ DAG_id_tag_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
}
@@ -584,7 +582,7 @@ static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *scene, Poin
{
DAG_scene_sort(bmain, scene);
- DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET);
+ DAG_id_tag_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
}
@@ -651,7 +649,7 @@ static void rna_CollisionSettings_update(Main *bmain, Scene *scene, PointerRNA *
{
Object *ob= (Object*)ptr->id.data;
- DAG_id_flush_update(&ob->id, OB_RECALC_ALL);
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
}
@@ -659,7 +657,7 @@ static void rna_softbody_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
- DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
}
@@ -720,6 +718,12 @@ static void rna_def_pointcache(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
+ static EnumPropertyItem point_cache_compress_items[] = {
+ {PTCACHE_COMPRESS_NO, "NO", 0, "No", "No compression"},
+ {PTCACHE_COMPRESS_LZO, "LIGHT", 0, "Light", "Fast but not so effective compression"},
+ {PTCACHE_COMPRESS_LZMA, "HEAVY", 0, "Heavy", "Effective but slow compression"},
+ {0, NULL, 0, NULL, NULL}};
+
srna= RNA_def_struct(brna, "PointCache", NULL);
RNA_def_struct_ui_text(srna, "Point Cache", "Point cache for physics simulations");
RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
@@ -747,6 +751,11 @@ static void rna_def_pointcache(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Cache Index", "Index number of cache files");
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+ prop= RNA_def_property(srna, "compression", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, point_cache_compress_items);
+ RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
+ RNA_def_property_update(prop, 0, NULL);
+
/* flags */
prop= RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED);
@@ -1160,7 +1169,7 @@ static void rna_def_field(BlenderRNA *brna)
prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "f_size");
RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Size", "Size of the noise");
+ RNA_def_property_ui_text(prop, "Size", "Size of the turbulence");
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
@@ -1214,7 +1223,7 @@ static void rna_def_field(BlenderRNA *brna)
prop= RNA_def_property(srna, "noise", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "f_noise");
RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Noise", "Noise of the force");
+ RNA_def_property_ui_text(prop, "Noise", "Amount of noise for the force strength");
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
@@ -1439,7 +1448,7 @@ static void rna_def_softbody(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- int matrix_dimsize[]= {3, 3};
+ const int matrix_dimsize[]= {3, 3};
static EnumPropertyItem collision_type_items[] = {
@@ -1552,20 +1561,20 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Damp", "Edge spring friction");
RNA_def_property_update(prop, 0, "rna_softbody_update");
- prop= RNA_def_property(srna, "spring_length", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "springpreload");
+ prop= RNA_def_property(srna, "spring_length", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "springpreload");
RNA_def_property_range(prop, 0.0f, 200.0f);
RNA_def_property_ui_text(prop, "SL", "Alter spring length to shrink/blow up (unit %) 0 to disable");
RNA_def_property_update(prop, 0, "rna_softbody_update");
- prop= RNA_def_property(srna, "aero", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "aeroedge");
+ prop= RNA_def_property(srna, "aero", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "aeroedge");
RNA_def_property_range(prop, 0.0f, 30000.0f);
RNA_def_property_ui_text(prop, "Aero", "Make edges 'sail'");
RNA_def_property_update(prop, 0, "rna_softbody_update");
- prop= RNA_def_property(srna, "plastic", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "plastic");
+ prop= RNA_def_property(srna, "plastic", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "plastic");
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Plastic", "Permanent deform");
RNA_def_property_update(prop, 0, "rna_softbody_update");