Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/particle.c
| Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_library_query.h" | #include "BKE_library_query.h" | ||||
| #include "BKE_library_remap.h" | #include "BKE_library_remap.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_cdderivedmesh.h" | #include "BKE_cdderivedmesh.h" | ||||
| #include "BKE_pointcache.h" | #include "BKE_pointcache.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_deform.h" | #include "BKE_deform.h" | ||||
| #include "BKE_workspace.h" | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_build.h" | #include "DEG_depsgraph_build.h" | ||||
| #include "RE_render_ext.h" | #include "RE_render_ext.h" | ||||
| unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]; | unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]; | ||||
| unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]; | unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]; | ||||
| ▲ Show 20 Lines • Show All 3,074 Lines • ▼ Show 20 Lines | ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *name) | ||||
| psys->flag = PSYS_CURRENT; | psys->flag = PSYS_CURRENT; | ||||
| psys->cfra = BKE_scene_frame_get_from_ctime(scene, CFRA + 1); | psys->cfra = BKE_scene_frame_get_from_ctime(scene, CFRA + 1); | ||||
| DEG_relations_tag_update(G.main); | DEG_relations_tag_update(G.main); | ||||
| DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | ||||
| return md; | return md; | ||||
| } | } | ||||
| void object_remove_particle_system(Scene *UNUSED(scene), Object *ob) | void object_remove_particle_system(Scene *scene, Object *ob, struct WorkSpace *workspace) | ||||
| { | { | ||||
| ParticleSystem *psys = psys_get_current(ob); | ParticleSystem *psys = psys_get_current(ob); | ||||
| ParticleSystemModifierData *psmd; | ParticleSystemModifierData *psmd; | ||||
| ModifierData *md; | ModifierData *md; | ||||
| if (!psys) | if (!psys) | ||||
| return; | return; | ||||
| Show All 21 Lines | void object_remove_particle_system(Scene *scene, Object *ob, struct WorkSpace *workspace) | ||||
| BLI_remlink(&ob->particlesystem, psys); | BLI_remlink(&ob->particlesystem, psys); | ||||
| if (psys->part) { | if (psys->part) { | ||||
| id_us_min(&psys->part->id); | id_us_min(&psys->part->id); | ||||
| } | } | ||||
| psys_free(ob, psys); | psys_free(ob, psys); | ||||
| if (ob->particlesystem.first) | if (ob->particlesystem.first) | ||||
| ((ParticleSystem *) ob->particlesystem.first)->flag |= PSYS_CURRENT; | ((ParticleSystem *) ob->particlesystem.first)->flag |= PSYS_CURRENT; | ||||
| else | else { | ||||
| ob->mode &= ~OB_MODE_PARTICLE_EDIT; | BKE_workspace_object_mode_for_object_set(workspace, scene, ob, ob->mode & ~OB_MODE_PARTICLE_EDIT); | ||||
| } | |||||
| DEG_relations_tag_update(G.main); | DEG_relations_tag_update(G.main); | ||||
| DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | ||||
| } | } | ||||
| static void default_particle_settings(ParticleSettings *part) | static void default_particle_settings(ParticleSettings *part) | ||||
| { | { | ||||
| part->type = PART_EMITTER; | part->type = PART_EMITTER; | ||||
| ▲ Show 20 Lines • Show All 1,153 Lines • Show Last 20 Lines | |||||