[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33251] trunk/blender/source/blender/ makesrna/intern: Particle fluid and boid settings didn' t have a valid rna path, so they couldn't be animated.
Janne Karhu
jhkarh at gmail.com
Tue Nov 23 12:15:38 CET 2010
Revision: 33251
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33251
Author: jhk
Date: 2010-11-23 12:15:38 +0100 (Tue, 23 Nov 2010)
Log Message:
-----------
Particle fluid and boid settings didn't have a valid rna path, so they couldn't be animated.
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_boid.c
trunk/blender/source/blender/makesrna/intern/rna_particle.c
Modified: trunk/blender/source/blender/makesrna/intern/rna_boid.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_boid.c 2010-11-23 08:44:21 UTC (rev 33250)
+++ trunk/blender/source/blender/makesrna/intern/rna_boid.c 2010-11-23 11:15:38 UTC (rev 33251)
@@ -175,6 +175,26 @@
}
}
+static int particle_id_check(PointerRNA *ptr)
+{
+ ID *id= ptr->id.data;
+
+ return (GS(id->name) == ID_PA);
+}
+
+static char *rna_BoidSettings_path(PointerRNA *ptr)
+{
+ BoidSettings *boids = (BoidSettings *)ptr->data;
+
+ if(particle_id_check(ptr)) {
+ ParticleSettings *part = (ParticleSettings*)ptr->id.data;
+
+ if (part->boids == boids)
+ return BLI_sprintfN("boids");
+ }
+ return NULL;
+}
+
static PointerRNA rna_BoidSettings_active_boid_state_get(PointerRNA *ptr)
{
BoidSettings *boids= (BoidSettings*)ptr->data;
@@ -466,6 +486,7 @@
PropertyRNA *prop;
srna = RNA_def_struct(brna, "BoidSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_BoidSettings_path");
RNA_def_struct_ui_text(srna, "Boid Settings", "Settings for boid physics");
prop= RNA_def_property(srna, "land_smooth", PROP_FLOAT, PROP_NONE);
Modified: trunk/blender/source/blender/makesrna/intern/rna_particle.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_particle.c 2010-11-23 08:44:21 UTC (rev 33250)
+++ trunk/blender/source/blender/makesrna/intern/rna_particle.c 2010-11-23 11:15:38 UTC (rev 33251)
@@ -518,6 +518,27 @@
else
strcpy(str, "Invalid target!");
}
+
+static int particle_id_check(PointerRNA *ptr)
+{
+ ID *id= ptr->id.data;
+
+ return (GS(id->name) == ID_PA);
+}
+
+static char *rna_SPHFluidSettings_path(PointerRNA *ptr)
+{
+ SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
+
+ if(particle_id_check(ptr)) {
+ ParticleSettings *part = (ParticleSettings*)ptr->id.data;
+
+ if (part->fluid == fluid)
+ return BLI_sprintfN("fluid");
+ }
+ return NULL;
+}
+
static int rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
{
ParticleSystem *psys= (ParticleSystem*)ptr->data;
@@ -953,6 +974,7 @@
PropertyRNA *prop;
srna = RNA_def_struct(brna, "SPHFluidSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path");
RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
/* Fluid settings */
@@ -960,7 +982,7 @@
RNA_def_property_float_sdna(prop, NULL, "spring_k");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Spring", "Spring force constant");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop= RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "radius");
@@ -1948,19 +1970,7 @@
RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- /* boids */
- prop= RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BoidSettings");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Boid Settings", "");
- /* Fluid particles */
- prop= RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "SPHFluidSettings");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
-
/* draw objects & groups */
prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
@@ -1997,6 +2007,19 @@
RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
+ /* boids */
+ prop= RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoidSettings");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Boid Settings", "");
+
+ /* Fluid particles */
+ prop= RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "SPHFluidSettings");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
+
+ /* Effector weights */
prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "EffectorWeights");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -2347,10 +2370,9 @@
void RNA_def_particle(BlenderRNA *brna)
{
rna_def_particle_target(brna);
-
+ rna_def_fluid_settings(brna);
rna_def_particle_hair_key(brna);
rna_def_particle_key(brna);
- rna_def_fluid_settings(brna);
rna_def_child_particle(brna);
rna_def_particle(brna);
More information about the Bf-blender-cvs
mailing list