diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2015-09-24 18:24:20 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2015-09-24 18:24:20 +0300 |
commit | 27b3ea622f8bd313a8e2827dfec752bf2125566c (patch) | |
tree | f212e49d224ce8e1cfc3b17a64ae524711494391 /source/blender/makesrna/intern/rna_smoke.c | |
parent | 372dff8d1dc7e24d4b2cd37de245588ecfce8bfa (diff) | |
parent | de80e687689032cb85179a1f7e89750573631d5d (diff) |
Merge remote-tracking branch 'origin/master' into cycles_camera_nodescycles_camera_nodes
Note: the branch currently crashes in blender_camera_nodes.cpp:
BL::NodeTree b_ntree = b_data.node_groups[nodes_tree_name];
The crash was introduced in:
cb7cf523e5c000609f32a382e2c0fcc57f635a42
Conflicts:
intern/cycles/SConscript
intern/cycles/blender/addon/__init__.py
intern/cycles/blender/addon/properties.py
intern/cycles/blender/blender_camera.cpp
intern/cycles/kernel/kernel_types.h
intern/cycles/kernel/svm/svm.h
intern/cycles/kernel/svm/svm_types.h
intern/cycles/render/camera.cpp
intern/cycles/render/camera.h
Diffstat (limited to 'source/blender/makesrna/intern/rna_smoke.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_smoke.c | 71 |
1 files changed, 64 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 887670eb5ff..539f3c192be 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -165,6 +165,31 @@ static int rna_SmokeModifier_color_grid_get_length(PointerRNA *ptr, int length[R return length[0]; } +static int rna_SmokeModifier_velocity_grid_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) +{ +#ifdef WITH_SMOKE + SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; + float *vx = NULL; + float *vy = NULL; + float *vz = NULL; + int size = 0; + + /* Velocity data is always low-resolution. */ + if (sds->fluid) { + size = 3 * sds->res[0] * sds->res[1] * sds->res[2]; + vx = smoke_get_velocity_x(sds->fluid); + vy = smoke_get_velocity_y(sds->fluid); + vz = smoke_get_velocity_z(sds->fluid); + } + + length[0] = (vx && vy && vz) ? size : 0; +#else + (void)ptr; + length[0] = 0; +#endif + return length[0]; +} + static void rna_SmokeModifier_density_grid_get(PointerRNA *ptr, float *values) { #ifdef WITH_SMOKE @@ -184,8 +209,34 @@ static void rna_SmokeModifier_density_grid_get(PointerRNA *ptr, float *values) BLI_rw_mutex_unlock(sds->fluid_mutex); #else - (void)ptr; - (void)values; + UNUSED_VARS(ptr, values); +#endif +} + +static void rna_SmokeModifier_velocity_grid_get(PointerRNA *ptr, float *values) +{ +#ifdef WITH_SMOKE + SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; + int length[RNA_MAX_ARRAY_DIMENSION]; + int size = rna_SmokeModifier_velocity_grid_get_length(ptr, length); + float *vx, *vy, *vz; + int i; + + BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ); + + vx = smoke_get_velocity_x(sds->fluid); + vy = smoke_get_velocity_y(sds->fluid); + vz = smoke_get_velocity_z(sds->fluid); + + for (i = 0; i < size; i += 3) { + *(values++) = *(vx++); + *(values++) = *(vy++); + *(values++) = *(vz++); + } + + BLI_rw_mutex_unlock(sds->fluid_mutex); +#else + UNUSED_VARS(ptr, values); #endif } @@ -211,8 +262,7 @@ static void rna_SmokeModifier_color_grid_get(PointerRNA *ptr, float *values) BLI_rw_mutex_unlock(sds->fluid_mutex); #else - (void)ptr; - memset(values, 0, 4 * sizeof(float)); + UNUSED_VARS(ptr, values); #endif } @@ -238,8 +288,7 @@ static void rna_SmokeModifier_flame_grid_get(PointerRNA *ptr, float *values) BLI_rw_mutex_unlock(sds->fluid_mutex); #else - (void)ptr; - (void)values; + UNUSED_VARS(ptr, values); #endif } @@ -311,7 +360,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "resolution_max", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "maxres"); - RNA_def_property_range(prop, 24, 512); + RNA_def_property_range(prop, 6, 512); RNA_def_property_ui_range(prop, 24, 512, 2, -1); RNA_def_property_ui_text(prop, "Max Res", "Maximal resolution used in the fluid domain"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); @@ -453,6 +502,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_float_funcs(prop, "rna_SmokeModifier_density_grid_get", NULL, NULL); RNA_def_property_ui_text(prop, "Density Grid", "Smoke density grid"); + prop = RNA_def_property(srna, "velocity_grid", PROP_FLOAT, PROP_NONE); + RNA_def_property_array(prop, 32); + RNA_def_property_flag(prop, PROP_DYNAMIC); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_velocity_grid_get_length"); + RNA_def_property_float_funcs(prop, "rna_SmokeModifier_velocity_grid_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Velocity Grid", "Smoke velocity grid"); + prop = RNA_def_property(srna, "flame_grid", PROP_FLOAT, PROP_NONE); RNA_def_property_array(prop, 32); RNA_def_property_flag(prop, PROP_DYNAMIC); |