diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-15 15:55:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-15 15:55:09 +0400 |
commit | 58eb0d7967c8402fc021d316f525ddef0f4bad38 (patch) | |
tree | 91fa89a0ab5a4f62a41462642f3dac2d019134c4 /source/blender/makesrna | |
parent | f5f82924614e9ab712a98bd39801061698bf7b3d (diff) |
keep particle system names unique
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index f0f782fede2..49005e56367 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -505,6 +505,17 @@ static int rna_PartSettings_is_fluid_get(PointerRNA *ptr) return part->type == PART_FLUID; } +void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value) +{ + Object *ob= ptr->id.data; + ParticleSystem *part= (ParticleSystem*)ptr->data; + + /* copy the new name into the name slot */ + BLI_strncpy_utf8(part->name, value, sizeof(part->name)); + + BLI_uniquename(&ob->particlesystem, part, "ParticleSystem", '.', offsetof(ParticleSystem, name), sizeof(part->name)); +} + static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr) { ParticleSystem *psys= (ParticleSystem*)ptr->data; @@ -2617,6 +2628,7 @@ static void rna_def_particle_system(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Particle system name"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER|NA_RENAME, NULL); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ParticleSystem_name_set"); RNA_def_struct_name_property(srna, prop); /* access to particle settings is redirected through functions */ |