diff options
author | Alexander Pinzon Fernandez <apinzonf@gmail.com> | 2013-12-11 20:10:22 +0400 |
---|---|---|
committer | Alexander Pinzon Fernandez <apinzonf@gmail.com> | 2013-12-11 20:10:22 +0400 |
commit | 2658a3c1b44717f497f187a38000c804eb37bbba (patch) | |
tree | ee55c673feabced8b6ec8bf9a8aa4d82a3cda3db /source/blender/makesrna/intern/rna_particle.c | |
parent | 4005cb1c6a63a217df0e887c741beee2c1359301 (diff) | |
parent | 09b859d03f0ee138c4273ef8460e91d9888387a1 (diff) |
Merge branch 'master' into soc-2013-sketch_meshsoc-2013-sketch_mesh
Conflicts:
release/scripts/addons
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/object/object_modifier.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/modifiers/intern/MOD_laplaciandeform.c
Diffstat (limited to 'source/blender/makesrna/intern/rna_particle.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 5151310cd64..01e7b673838 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -136,6 +136,7 @@ static EnumPropertyItem part_hair_ren_as_items[] = { #include "BKE_DerivedMesh.h" #include "BKE_cdderivedmesh.h" #include "BKE_effect.h" +#include "BKE_material.h" #include "BKE_modifier.h" #include "BKE_particle.h" #include "BKE_pointcache.h" @@ -390,6 +391,47 @@ static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *o } + +static EnumPropertyItem *rna_Particule_Material_itemf(bContext *C, PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), int *free) +{ + Object *ob = CTX_data_active_object(C); + Material *ma; + EnumPropertyItem *item = NULL; + EnumPropertyItem tmp = {0, "", 0, "", ""}; + int totitem = 0; + int i; + + if (ob->totcol > 0) { + for (i = 1; i <= ob->totcol; i++) { + ma = give_current_material(ob, i); + tmp.value = i; + tmp.icon = ICON_MATERIAL_DATA; + if (ma) { + tmp.name = ma->id.name + 2; + tmp.identifier = tmp.name; + } + else { + tmp.name = "Default Material"; + tmp.identifier = tmp.name; + } + RNA_enum_item_add(&item, &totitem, &tmp); + } + } + else { + tmp.value = 1; + tmp.icon = ICON_MATERIAL_DATA; + tmp.name = "Default Material"; + tmp.identifier = tmp.name; + RNA_enum_item_add(&item, &totitem, &tmp); + } + + RNA_enum_item_end(&item, &totitem); + *free = 1; + + return item; +} + static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, ReportList *reports, ParticleSystemModifierData *modifier, ParticleData *particle, int particle_no, int uv_no, @@ -2018,6 +2060,11 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem part_mat_items[] = { + {0, "DUMMY", 0, "Dummy", ""}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "ParticleSettings", "ID"); RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems"); RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA); @@ -2360,7 +2407,14 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "omat"); RNA_def_property_range(prop, 1, 32767); - RNA_def_property_ui_text(prop, "Material", "Material used for the particles"); + RNA_def_property_ui_text(prop, "Material Index", "Index of material slot used for rendering particles"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + + prop = RNA_def_property(srna, "material_slot", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "omat"); + RNA_def_property_enum_items(prop, part_mat_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particule_Material_itemf"); + RNA_def_property_ui_text(prop, "Material Slot", "Material slot used for rendering particles"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE); |