diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_particle.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 40069a995ea..ee755fca27e 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -22,6 +22,7 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include <stdio.h> #include <stdlib.h> #include "limits.h" @@ -33,6 +34,7 @@ #include "DNA_particle_types.h" #include "DNA_object_force.h" +#include "DNA_object_types.h" #ifdef RNA_RUNTIME @@ -86,6 +88,29 @@ static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr) ParticleSettings *settings = (ParticleSettings*)ptr->data; return settings->draw_line[1]; } + +static int rna_ParticleSystem_name_length(PointerRNA *ptr) +{ + ParticleSystem *psys= ptr->data; + + if(psys->part) + return strlen(psys->part->id.name+2) + 10; + + return 10; +} + +static void rna_ParticleSystem_name_get(PointerRNA *ptr, char *str) +{ + Object *ob= ptr->id.data; + ParticleSystem *psys= ptr->data; + int index= BLI_findindex(&ob->particlesystem, psys); + + sprintf(str, "%d: ", index+1); + + if(psys->part) + strcat(str, psys->part->id.name+2); +} + #else static void rna_def_particle_hair_key(BlenderRNA *brna) @@ -1176,6 +1201,13 @@ static void rna_def_particle_system(BlenderRNA *brna) srna= RNA_def_struct(brna, "ParticleSystem", NULL); RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object."); + RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA); + + prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, "rna_ParticleSystem_name_get", "rna_ParticleSystem_name_length", NULL); + RNA_def_property_ui_text(prop, "Name", "Particle system name."); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "part"); |