diff options
author | Matt Ebb <matt@mke3.net> | 2011-05-13 02:52:30 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2011-05-13 02:52:30 +0400 |
commit | b73fe01295636aea92bf3076874b5e3cbcba9057 (patch) | |
tree | 9e9d6688e346e5c3b1b09db6e02932cceb6eb8ed /source/blender/makesrna/intern/rna_fluidsim.c | |
parent | 57c626d11c0b2d0ed7cce7e60c863477f87d8ebd (diff) |
* Enabled rna access to fluid sim velocity vectors
The main purpose for this is to allow rendering motion blurred blender fluids in external renderers (eg. http://vimeo.com/21870635 ).
Python code snippet for interpreting this data here: http://www.pasteall.org/21577 . Cleaned up some ugly hacks in this area too
* Also added read-only access to scene.subframe to RNA - setting current frame and subframe should still go via scene.frame_set()
Diffstat (limited to 'source/blender/makesrna/intern/rna_fluidsim.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_fluidsim.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index acec2ca7a24..7c93ae4168b 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -195,6 +195,18 @@ static char *rna_FluidSettings_path(PointerRNA *ptr) return BLI_sprintfN("modifiers[\"%s\"].settings", md->name); } +static void rna_FluidMeshVertex_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + FluidsimSettings *fss = (FluidsimSettings*)ptr->data; + rna_iterator_array_begin(iter, fss->meshVelocities, sizeof(float)*3, fss->totvert, 0, NULL); +} + +static int rna_FluidMeshVertex_data_length(PointerRNA *ptr) +{ + FluidsimSettings *fss = (FluidsimSettings*)ptr->data; + return fss->totvert; +} + #else static void rna_def_fluidsim_slip(StructRNA *srna) @@ -219,6 +231,24 @@ static void rna_def_fluidsim_slip(StructRNA *srna) RNA_def_property_ui_text(prop, "Partial Slip Amount", "Amount of mixing between no- and free-slip, 0 is no slip and 1 is free slip"); } +static void rna_def_fluid_mesh_vertices(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "FluidMeshVertex", NULL); + RNA_def_struct_sdna(srna, "FluidVertexVelocity"); + RNA_def_struct_ui_text(srna, "Fluid Mesh Vertex", "Vertex of a simulated fluid mesh"); + RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL); + + prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY); + RNA_def_property_array(prop, 3); + RNA_def_property_float_sdna(prop, NULL, "vel"); + RNA_def_property_ui_text(prop, "Velocity", ""); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); +} + + static void rna_def_fluidsim_domain(BlenderRNA *brna) { StructRNA *srna; @@ -367,6 +397,13 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0, 10.0); RNA_def_property_ui_text(prop, "Generate Particles", "Amount of particles to generate (0=off, 1=normal, >1=more)"); + + /* simulated fluid mesh data */ + prop= RNA_def_property(srna, "fluid_mesh_vertices", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "FluidMeshVertex"); + RNA_def_property_ui_text(prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation"); + RNA_def_property_collection_funcs(prop, "rna_FluidMeshVertex_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_FluidMeshVertex_data_length", 0, 0); + rna_def_fluid_mesh_vertices(brna); } static void rna_def_fluidsim_volume(StructRNA *srna) |