Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_particle.c
| Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
| #include "BLF_translation.h" | #include "BLF_translation.h" | ||||
| #include "rna_internal.h" | #include "rna_internal.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| /* read-only types (can not be set by user) */ | |||||
| EnumPropertyItem particle_settings_type_items[] = { | |||||
| {PART_EMITTER, "EMITTER", ICON_PARTICLE_DATA, "Emitter", ""}, | |||||
| /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */ | |||||
| {PART_HAIR, "HAIR", ICON_HAIR, "Hair", ""}, | |||||
| {PART_FLUID, "FLUID", ICON_MOD_FLUIDSIM, "Fluid", ""}, | |||||
| {0, NULL, 0, NULL, NULL} | |||||
| }; | |||||
| /* user types for operator parameters */ | |||||
| EnumPropertyItem particle_settings_user_type_items[] = { | |||||
| {PART_EMITTER, "EMITTER", ICON_PARTICLE_DATA, "Emitter", ""}, | |||||
| /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */ | |||||
| {PART_HAIR, "HAIR", ICON_HAIR, "Hair", ""}, | |||||
| {0, NULL, 0, NULL, NULL} | |||||
| }; | |||||
| #ifdef RNA_RUNTIME | #ifdef RNA_RUNTIME | ||||
| static EnumPropertyItem part_from_items[] = { | static EnumPropertyItem part_from_items[] = { | ||||
| {PART_FROM_VERT, "VERT", 0, "Verts", ""}, | {PART_FROM_VERT, "VERT", 0, "Verts", ""}, | ||||
| {PART_FROM_FACE, "FACE", 0, "Faces", ""}, | {PART_FROM_FACE, "FACE", 0, "Faces", ""}, | ||||
| {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""}, | {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| #endif | #endif | ||||
| ▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_cdderivedmesh.h" | #include "BKE_cdderivedmesh.h" | ||||
| #include "BKE_effect.h" | #include "BKE_effect.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_particle.h" | #include "BKE_particle.h" | ||||
| #include "BKE_pointcache.h" | #include "BKE_pointcache.h" | ||||
| #include "BKE_texture.h" | #include "BKE_texture.h" | ||||
| static StructRNA *rna_ParticleSettings_refine(PointerRNA *ptr) | |||||
| { | |||||
| ParticleSettings *part = ptr->data; | |||||
| switch (part->type) { | |||||
| case PART_EMITTER: | |||||
| return &RNA_ParticleSettingsEmitter; | |||||
| case PART_HAIR: | |||||
| return &RNA_ParticleSettingsHair; | |||||
| case PART_FLUID: | |||||
| return &RNA_ParticleSettingsFluid; | |||||
| default: | |||||
| return &RNA_ParticleSettings; | |||||
| } | |||||
| } | |||||
| /* use for object space hair get/set */ | /* use for object space hair get/set */ | ||||
| static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt, | static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt, | ||||
| ParticleData **pa_pt) | ParticleData **pa_pt) | ||||
| { | { | ||||
| HairKey *hkey = (HairKey *)ptr->data; | HairKey *hkey = (HairKey *)ptr->data; | ||||
| Object *ob = (Object *)ptr->id.data; | Object *ob = (Object *)ptr->id.data; | ||||
| ModifierData *md; | ModifierData *md; | ||||
| ParticleSystemModifierData *psmd = NULL; | ParticleSystemModifierData *psmd = NULL; | ||||
| ▲ Show 20 Lines • Show All 546 Lines • ▼ Show 20 Lines | static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| rna_Particle_redo(bmain, scene, ptr); | rna_Particle_redo(bmain, scene, ptr); | ||||
| } | } | ||||
| static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr) | static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| { | { | ||||
| particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET); | particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET); | ||||
| } | } | ||||
| static void rna_Particle_change_type(Main *bmain, Scene *scene, PointerRNA *ptr) | |||||
| { | |||||
| particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET | PSYS_RECALC_TYPE); | |||||
| } | |||||
| static void rna_Particle_change_physics(Main *bmain, Scene *scene, PointerRNA *ptr) | static void rna_Particle_change_physics(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| { | { | ||||
| particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET | PSYS_RECALC_PHYS); | particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET | PSYS_RECALC_PHYS); | ||||
| } | } | ||||
| static void rna_Particle_redo_child(Main *bmain, Scene *scene, PointerRNA *ptr) | static void rna_Particle_redo_child(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| { | { | ||||
| particle_recalc(bmain, scene, ptr, PSYS_RECALC_CHILD); | particle_recalc(bmain, scene, ptr, PSYS_RECALC_CHILD); | ||||
| ▲ Show 20 Lines • Show All 1,222 Lines • ▼ Show 20 Lines | static void rna_def_particle_settings_mtex(BlenderRNA *brna) | ||||
| RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); | RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); | ||||
| } | } | ||||
| static void rna_def_particle_settings(BlenderRNA *brna) | static void rna_def_particle_settings(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| static EnumPropertyItem type_items[] = { | |||||
| {PART_EMITTER, "EMITTER", 0, "Emitter", ""}, | |||||
| /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */ | |||||
| {PART_HAIR, "HAIR", 0, "Hair", ""}, | |||||
| {0, NULL, 0, NULL, NULL} | |||||
| }; | |||||
| static EnumPropertyItem phys_type_items[] = { | static EnumPropertyItem phys_type_items[] = { | ||||
| {PART_PHYS_NO, "NO", 0, "No", ""}, | {PART_PHYS_NO, "NO", 0, "No", ""}, | ||||
| {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""}, | {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""}, | ||||
| {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""}, | {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""}, | ||||
| {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""}, | {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""}, | ||||
| {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""}, | {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | static void rna_def_particle_settings(BlenderRNA *brna) | ||||
| }; | }; | ||||
| static EnumPropertyItem part_mat_items[] = { | static EnumPropertyItem part_mat_items[] = { | ||||
| {0, "DUMMY", 0, "Dummy", ""}, | {0, "DUMMY", 0, "Dummy", ""}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| srna = RNA_def_struct(brna, "ParticleSettings", "ID"); | srna = RNA_def_struct(brna, "ParticleSettings", "ID"); | ||||
| RNA_def_struct_refine_func(srna, "rna_ParticleSettings_refine"); | |||||
| RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems"); | RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems"); | ||||
| RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA); | RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA); | ||||
| rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get", | rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get", | ||||
| "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot", | "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot", | ||||
| "ParticleSettingsTextureSlots", "rna_Particle_reset"); | "ParticleSettingsTextureSlots", "rna_Particle_reset"); | ||||
| /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */ | /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */ | ||||
| ▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | static void rna_def_particle_settings(BlenderRNA *brna) | ||||
| prop = RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT); | RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT); | ||||
| RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors effect themselves"); | RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors effect themselves"); | ||||
| RNA_def_property_update(prop, 0, "rna_Particle_reset"); | RNA_def_property_update(prop, 0, "rna_Particle_reset"); | ||||
| prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_items(prop, type_items); | RNA_def_property_enum_items(prop, particle_settings_type_items); | ||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_ui_text(prop, "Type", "Particle Type"); | RNA_def_property_ui_text(prop, "Type", "Particle Type"); | ||||
| RNA_def_property_update(prop, 0, "rna_Particle_change_type"); | |||||
| prop = RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "from"); | RNA_def_property_enum_sdna(prop, NULL, "from"); | ||||
| RNA_def_property_enum_items(prop, part_reactor_from_items); | RNA_def_property_enum_items(prop, part_reactor_from_items); | ||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | ||||
| RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf"); | RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf"); | ||||
| RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from"); | RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from"); | ||||
| RNA_def_property_update(prop, 0, "rna_Particle_reset"); | RNA_def_property_update(prop, 0, "rna_Particle_reset"); | ||||
| ▲ Show 20 Lines • Show All 795 Lines • ▼ Show 20 Lines | |||||
| RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped"); | RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped"); | ||||
| RNA_def_property_update(prop, 0, "rna_Particle_redo"); | RNA_def_property_update(prop, 0, "rna_Particle_redo"); | ||||
| /* modified dm support */ | /* modified dm support */ | ||||
| prop = RNA_def_property(srna, "use_modifier_stack", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_modifier_stack", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "use_modifier_stack", 0); | RNA_def_property_boolean_sdna(prop, NULL, "use_modifier_stack", 0); | ||||
| RNA_def_property_ui_text(prop, "Use Modifier Stack", "Emit particles from mesh with modifiers applied " | RNA_def_property_ui_text(prop, "Use Modifier Stack", "Emit particles from mesh with modifiers applied " | ||||
| "(must use same subsurf level for viewport and render for correct results)"); | "(must use same subsurf level for viewport and render for correct results)"); | ||||
| RNA_def_property_update(prop, 0, "rna_Particle_change_type"); | RNA_def_property_update(prop, 0, "rna_Particle_reset"); | ||||
| /* draw objects & groups */ | /* draw objects & groups */ | ||||
| prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "dup_group"); | RNA_def_property_pointer_sdna(prop, NULL, "dup_group"); | ||||
| RNA_def_property_struct_type(prop, "Group"); | RNA_def_property_struct_type(prop, "Group"); | ||||
| RNA_def_property_flag(prop, PROP_EDITABLE); | RNA_def_property_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles"); | RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles"); | ||||
| RNA_def_property_update(prop, 0, "rna_Particle_redo"); | RNA_def_property_update(prop, 0, "rna_Particle_redo"); | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
| RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL); | RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL); | ||||
| RNA_def_property_ui_text(prop, "Force Field 1", ""); | RNA_def_property_ui_text(prop, "Force Field 1", ""); | ||||
| prop = RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "pd2"); | RNA_def_property_pointer_sdna(prop, NULL, "pd2"); | ||||
| RNA_def_property_struct_type(prop, "FieldSettings"); | RNA_def_property_struct_type(prop, "FieldSettings"); | ||||
| RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL, NULL); | RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL, NULL); | ||||
| RNA_def_property_ui_text(prop, "Force Field 2", ""); | RNA_def_property_ui_text(prop, "Force Field 2", ""); | ||||
| } | |||||
| /* Dummy subtypes for modified icons */ | |||||
| srna = RNA_def_struct(brna, "ParticleSettingsEmitter", "ParticleSettings"); | |||||
| RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems"); | |||||
| RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA); | |||||
| srna = RNA_def_struct(brna, "ParticleSettingsHair", "ParticleSettings"); | |||||
| RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems"); | |||||
| RNA_def_struct_ui_icon(srna, ICON_HAIR); | |||||
| srna = RNA_def_struct(brna, "ParticleSettingsFluid", "ParticleSettings"); | |||||
| RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems"); | |||||
| RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM);} | |||||
| static void rna_def_particle_target(BlenderRNA *brna) | static void rna_def_particle_target(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| static EnumPropertyItem mode_items[] = { | static EnumPropertyItem mode_items[] = { | ||||
| {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""}, | {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""}, | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | static void rna_def_particle_target(BlenderRNA *brna) | ||||
| RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid"); | RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid"); | ||||
| prop = RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "mode"); | RNA_def_property_enum_sdna(prop, NULL, "mode"); | ||||
| RNA_def_property_enum_items(prop, mode_items); | RNA_def_property_enum_items(prop, mode_items); | ||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | ||||
| RNA_def_property_ui_text(prop, "Mode", ""); | RNA_def_property_ui_text(prop, "Mode", ""); | ||||
| RNA_def_property_update(prop, 0, "rna_Particle_target_reset"); | RNA_def_property_update(prop, 0, "rna_Particle_target_reset"); | ||||
| } | } | ||||
| static void rna_def_particle_system(BlenderRNA *brna) | static void rna_def_particle_system(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| static EnumPropertyItem resolution_items[] = { | static EnumPropertyItem resolution_items[] = { | ||||
| ▲ Show 20 Lines • Show All 371 Lines • Show Last 20 Lines | |||||