Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-04 03:22:43 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-04 03:22:43 +0400
commit4df00c670ef2e03d3dc55b67594e96cc49766831 (patch)
tree0ea3b4f66d5cac7952e36704fedf3c5ac7bbe81b /source/blender/makesrna/intern/rna_particle.c
parenta8f69a7f5cf59943b244126f428d1c12ca7e61af (diff)
RNA:
* Added a MaterialSlot collection in Object rather than giving the list of materials immediately. This should more correctly reflect how this data is organized, even though there is no equivalent C struct. * Added name properties to MaterialSlot/TextureSlot/ParticleSystem.
Diffstat (limited to 'source/blender/makesrna/intern/rna_particle.c')
-rw-r--r--source/blender/makesrna/intern/rna_particle.c32
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");