diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index d8169e529aa..673f7acbd6a 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -74,6 +74,7 @@ #include "BKE_lattice.h" #include "BKE_mball.h" #include "BKE_world.h" +#include "BKE_particle.h" #include "BKE_paint.h" #include "BKE_font.h" #include "BKE_node.h" @@ -99,6 +100,7 @@ #include "DNA_lattice_types.h" #include "DNA_meta_types.h" #include "DNA_world_types.h" +#include "DNA_particle_types.h" #include "DNA_vfont_types.h" #include "DNA_node_types.h" #include "DNA_movieclip_types.h" @@ -442,6 +444,13 @@ static bAction *rna_Main_actions_new(Main *bmain, const char *name) return act; } +static ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name) +{ + ParticleSettings *part = psys_new_settings(name, bmain); + id_us_min(&part->id); + return part; +} + static Palette *rna_Main_palettes_new(Main *bmain, const char *name) { Palette *palette = BKE_palette_add(bmain, name); @@ -520,6 +529,7 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(speakers, speaker, ID_SPK) RNA_MAIN_ID_TAG_FUNCS_DEF(sounds, sound, ID_SO) RNA_MAIN_ID_TAG_FUNCS_DEF(armatures, armature, ID_AR) RNA_MAIN_ID_TAG_FUNCS_DEF(actions, action, ID_AC) +RNA_MAIN_ID_TAG_FUNCS_DEF(particles, particle, ID_PA) RNA_MAIN_ID_TAG_FUNCS_DEF(palettes, palettes, ID_PAL) RNA_MAIN_ID_TAG_FUNCS_DEF(gpencil, gpencil, ID_GD) RNA_MAIN_ID_TAG_FUNCS_DEF(movieclips, movieclip, ID_MC) @@ -1468,6 +1478,42 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Main_actions_is_updated_get", NULL); } +void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + PropertyRNA *prop; + + RNA_def_property_srna(cprop, "BlendDataParticles"); + srna = RNA_def_struct(brna, "BlendDataParticles", NULL); + RNA_def_struct_sdna(srna, "Main"); + RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings"); + + func = RNA_def_function(srna, "new", "rna_Main_particles_new"); + RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database"); + parm = RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the data-block"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + /* return type */ + parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings data-block"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile"); + parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); + RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of those particle settings before deleting them"); + + func = RNA_def_function(srna, "tag", "rna_Main_particles_tag"); + parm = RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + + prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_particles_is_updated_get", NULL); +} void RNA_def_main_palettes(BlenderRNA *brna, PropertyRNA *cprop) { |