* Added RNA path functionality to fluidsim modifier settings, to allow keying of...
authorMatt Ebb <matt@mke3.net>
Tue, 15 Sep 2009 03:54:13 +0000 (03:54 +0000)
committerMatt Ebb <matt@mke3.net>
Tue, 15 Sep 2009 03:54:13 +0000 (03:54 +0000)
Note: Although the properties can be animated with the RNA system, the values are not exported to the actual fluid sim yet, that can come later.

source/blender/blenkernel/intern/fluidsim.c
source/blender/blenloader/intern/readfile.c
source/blender/makesdna/DNA_object_fluidsim.h
source/blender/makesrna/intern/rna_fluidsim.c

index ad9e481ffd29ffc4eba8985e8c9b5b456c6a6f11..aa163b821c8b2d413b99a2a91d08e24706a96865 100644 (file)
@@ -80,6 +80,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
                if(!fss)
                        return;
                
+               fss->fmd = fluidmd;
                fss->type = OB_FLUIDSIM_ENABLE;
                fss->show_advancedoptions = 0;
 
index d02640022145fbb04dbeb944475cb11fdcd0de7b..bb7262c01d49a82ad437f884ab210c168bf15a22 100644 (file)
@@ -9692,10 +9692,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        /* put 2.50 compatibility code here until next subversion bump */
        {
                Scene *sce;
+               Object *ob;
 
                for(sce = main->scene.first; sce; sce = sce->id.next)
                        if(sce->unit.scale_length == 0.0f)
                                sce->unit.scale_length= 1.0f;
+               
+               for(ob = main->object.first; ob; ob = ob->id.next) {
+                       ModifierData *md;
+
+                       /* add backwards pointer for fluidsim modifier RNA access */
+                       for (md=ob->modifiers.first; md; md = md->next) {
+                               if (md->type == eModifierType_Fluidsim) {
+                                       FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
+                                       fluidmd->fss->fmd = fluidmd;
+                               }
+                       }
+               }
        }
 
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
index 09288b24c201c703e2cd84cd371c5a9f6192c061..da55fb1d47c277ae1d24699256ccd5dbc121c1b4 100644 (file)
@@ -41,6 +41,7 @@ struct Ipo;
 struct MVert;
        
 typedef struct FluidsimSettings {
+       struct FluidsimModifierData *fmd; /* for fast RNA access */
        /* domain,fluid or obstacle */
        short type;
        /* display advanced options in fluid sim tab (on=1,off=0)*/
index a62002365c992a8a2ec8a81a0581c8d1f4a7eadb..c415b3d716a55fbe010cd11f3e437129746fce69 100644 (file)
@@ -151,6 +151,14 @@ static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr)
        return 32;
 }
 
+static char *rna_FluidSettings_path(PointerRNA *ptr)
+{
+       FluidsimSettings *fss = (FluidsimSettings*)ptr->data;
+       ModifierData *md= (ModifierData *)fss->fmd;
+
+       return BLI_sprintfN("modifiers[%s].settings", md->name);
+}
+
 #else
 
 static void rna_def_fluidsim_slip(StructRNA *srna)
@@ -509,6 +517,7 @@ void RNA_def_fluidsim(BlenderRNA *brna)
        srna= RNA_def_struct(brna, "FluidSettings", NULL);
        RNA_def_struct_sdna(srna, "FluidsimSettings");
        RNA_def_struct_refine_func(srna, "rna_FluidSettings_refine");
+       RNA_def_struct_path_func(srna, "rna_FluidSettings_path");
        RNA_def_struct_ui_text(srna, "Fluid Simulation Settings", "Fluid simulation settings for an object taking part in the simulation.");
 
        prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);