diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-11-04 11:44:42 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-11-04 11:44:42 +0300 |
commit | e9ce90c23834e0f9154ab97326a55db62d62b4d7 (patch) | |
tree | 83aaf08425b7ec7660a11760e67eaece23a0005b /source/blender/makesrna/intern/rna_texture.c | |
parent | 3c6b721fc90f5dc387c4493e0d78e77b728079b7 (diff) |
Fix bug #19699: point density texture doesn't save particle system.
Non-ID pointers in DNA can only point to data from own ID block, so
now instead it uses an index into the particle system list, but still
exposed as a pointer through RNA.
Diffstat (limited to 'source/blender/makesrna/intern/rna_texture.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 5a18a7a987c..44e7d0f68d0 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -34,9 +34,11 @@ #include "DNA_brush_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" +#include "DNA_object_types.h" #include "DNA_texture_types.h" #include "DNA_world_types.h" #include "DNA_node_types.h" +#include "DNA_particle_types.h" #include "DNA_scene_types.h" /* MAXFRAME only */ #include "BKE_node.h" @@ -321,6 +323,29 @@ static EnumPropertyItem *rna_ImageTexture_filter_itemf(bContext *C, PointerRNA * return item; } +static PointerRNA rna_PointDensity_psys_get(PointerRNA *ptr) +{ + PointDensity *pd= ptr->data; + Object *ob= pd->object; + ParticleSystem *psys= NULL; + PointerRNA value; + + if(ob && pd->psys) + psys= BLI_findlink(&ob->particlesystem, pd->psys-1); + + RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &value); + return value; +} + +static void rna_PointDensity_psys_set(PointerRNA *ptr, PointerRNA value) +{ + PointDensity *pd= ptr->data; + Object *ob= pd->object; + + if(ob && value.id.data == ob) + pd->psys= BLI_findindex(&ob->particlesystem, value.data) + 1; +} + static char *rna_ColorRamp_path(PointerRNA *ptr) { /* handle the cases where a single datablock may have 2 ramp types */ @@ -1552,9 +1577,9 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "psys"); RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points"); RNA_def_property_struct_type(prop, "ParticleSystem"); + RNA_def_property_pointer_funcs(prop, "rna_PointDensity_psys_get", "rna_PointDensity_psys_set", NULL); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, 0, "rna_Texture_update"); |