Merge from 2.5 r21160 through r21285
[blender.git] / source / blender / makesrna / intern / rna_object.c
index 76553e09fb2b97677e3962891ed89707224d2c8b..4166eb9bc2c3df5a98537dec433fd2604023b1a2 100644 (file)
@@ -33,6 +33,7 @@
 #include "DNA_customdata_types.h"
 #include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_customdata_types.h"
 #include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
+#include "DNA_object_force.h"
 #include "DNA_object_types.h"
 #include "DNA_property_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
 #include "DNA_property_types.h"
 #include "DNA_scene_types.h"
@@ -240,6 +241,25 @@ static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
        return rna_pointer_inherit_refine(ptr, &RNA_MaterialSlot, ob->mat+ob->actcol);
 }
 
        return rna_pointer_inherit_refine(ptr, &RNA_MaterialSlot, ob->mat+ob->actcol);
 }
 
+static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max)
+{
+       Object *ob= (Object*)ptr->id.data;
+       *min= 1;
+       *max= BLI_countlist(&ob->particlesystem);
+}
+
+static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
+{
+       Object *ob= (Object*)ptr->id.data;
+       return psys_get_current_num(ob) + 1;
+}
+
+static void rna_Object_active_particle_system_index_set(struct PointerRNA *ptr, int value)
+{
+       Object *ob= (Object*)ptr->id.data;
+       psys_set_current_num(ob, value);
+}
+
 #if 0
 static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
 {
 #if 0
 static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
 {
@@ -936,6 +956,10 @@ static void rna_def_object(BlenderRNA *brna)
        RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL);
        RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
 
        RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL);
        RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
 
+       prop= RNA_def_property(srna, "active_particle_system_index", PROP_INT, PROP_UNSIGNED);
+       RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", "rna_Object_active_particle_system_index_set", "rna_Object_active_particle_system_index_range");
+       RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot.");
+
        /* restrict */
 
        prop= RNA_def_property(srna, "restrict_view", PROP_BOOLEAN, PROP_NONE);
        /* restrict */
 
        prop= RNA_def_property(srna, "restrict_view", PROP_BOOLEAN, PROP_NONE);