Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_main_api.c
| Show All 29 Lines | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <errno.h> | #include <errno.h> | ||||
| #include "DNA_ID.h" | #include "DNA_ID.h" | ||||
| #include "DNA_modifier_types.h" | #include "DNA_modifier_types.h" | ||||
| #include "DNA_particle_types.h" | |||||
psy-fi: Picky: Is it possible to move all DNA files together? | |||||
lukastoenneAuthorUnsubmitted Not Done Inline ActionsCan do (not that particle code is beautiful everywhere else ...) lukastoenne: Can do (not that particle code is beautiful everywhere else ...) | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_path_util.h" | #include "BLI_path_util.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| ▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
| #include "DNA_speaker_types.h" | #include "DNA_speaker_types.h" | ||||
| #include "DNA_text_types.h" | #include "DNA_text_types.h" | ||||
| #include "DNA_texture_types.h" | #include "DNA_texture_types.h" | ||||
| #include "DNA_group_types.h" | #include "DNA_group_types.h" | ||||
| #include "DNA_brush_types.h" | #include "DNA_brush_types.h" | ||||
| #include "DNA_lattice_types.h" | #include "DNA_lattice_types.h" | ||||
| #include "DNA_meta_types.h" | #include "DNA_meta_types.h" | ||||
| #include "DNA_world_types.h" | #include "DNA_world_types.h" | ||||
| #include "DNA_particle_types.h" | |||||
| #include "DNA_vfont_types.h" | #include "DNA_vfont_types.h" | ||||
| #include "DNA_node_types.h" | #include "DNA_node_types.h" | ||||
| #include "DNA_movieclip_types.h" | #include "DNA_movieclip_types.h" | ||||
| #include "DNA_mask_types.h" | #include "DNA_mask_types.h" | ||||
| #include "DNA_gpencil_types.h" | #include "DNA_gpencil_types.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| ▲ Show 20 Lines • Show All 698 Lines • ▼ Show 20 Lines | if (ID_REAL_USERS(act) <= 0) { | ||||
| RNA_POINTER_INVALIDATE(act_ptr); | RNA_POINTER_INVALIDATE(act_ptr); | ||||
| } | } | ||||
| else { | else { | ||||
| BKE_reportf(reports, RPT_ERROR, "Action '%s' must have zero users to be removed, found %d", | BKE_reportf(reports, RPT_ERROR, "Action '%s' must have zero users to be removed, found %d", | ||||
| act->id.name + 2, ID_REAL_USERS(act)); | act->id.name + 2, ID_REAL_USERS(act)); | ||||
| } | } | ||||
| } | } | ||||
| static ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name) | static ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name, int type) | ||||
| { | { | ||||
| ParticleSettings *part = psys_new_settings(name, bmain); | ParticleSettings *part = psys_new_settings(name, bmain, (eParticleSettingsType)type); | ||||
| id_us_min(&part->id); | id_us_min(&part->id); | ||||
| return part; | return part; | ||||
| } | } | ||||
| static void rna_Main_particles_remove(Main *bmain, ReportList *reports, PointerRNA *part_ptr) | static void rna_Main_particles_remove(Main *bmain, ReportList *reports, PointerRNA *part_ptr) | ||||
| { | { | ||||
| ParticleSettings *part = part_ptr->data; | ParticleSettings *part = part_ptr->data; | ||||
| if (ID_REAL_USERS(part) <= 0) { | if (ID_REAL_USERS(part) <= 0) { | ||||
| BKE_libblock_free(bmain, part); | BKE_libblock_free(bmain, part); | ||||
| ▲ Show 20 Lines • Show All 1,027 Lines • ▼ Show 20 Lines | void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| srna = RNA_def_struct(brna, "BlendDataParticles", NULL); | srna = RNA_def_struct(brna, "BlendDataParticles", NULL); | ||||
| RNA_def_struct_sdna(srna, "Main"); | RNA_def_struct_sdna(srna, "Main"); | ||||
| RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings"); | RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings"); | ||||
| func = RNA_def_function(srna, "new", "rna_Main_particles_new"); | 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"); | 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 datablock"); | parm = RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_property_flag(parm, PROP_REQUIRED); | ||||
| RNA_def_enum(func, "type", particle_settings_user_type_items, PART_EMITTER, "Type", "Particle Type"); | |||||
| /* return type */ | /* return type */ | ||||
| parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock"); | parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "remove", "rna_Main_particles_remove"); | func = RNA_def_function(srna, "remove", "rna_Main_particles_remove"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile"); | 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"); | parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove"); | ||||
| ▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines | |||||
Picky: Is it possible to move all DNA files together?