Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_particles.cpp
| Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | bool BlenderSync::sync_dupli_particle(BL::Object &b_ob, | ||||
| ParticleSystemKey key(b_ob, persistent_id); | ParticleSystemKey key(b_ob, persistent_id); | ||||
| ParticleSystem *psys; | ParticleSystem *psys; | ||||
| bool first_use = !particle_system_map.is_used(key); | bool first_use = !particle_system_map.is_used(key); | ||||
| bool need_update = particle_system_map.add_or_update(&psys, b_ob, b_instance.object(), key); | bool need_update = particle_system_map.add_or_update(&psys, b_ob, b_instance.object(), key); | ||||
| /* no update needed? */ | /* no update needed? */ | ||||
| if (!need_update && !object->get_geometry()->is_modified() && | if (!need_update && !object->get_geometry()->is_modified() && | ||||
| !scene->object_manager->need_update) | !scene->get_object_manager()->need_update) | ||||
| return true; | return true; | ||||
| /* first time used in this sync loop? clear and tag update */ | /* first time used in this sync loop? clear and tag update */ | ||||
| if (first_use) { | if (first_use) { | ||||
| psys->particles.clear(); | psys->clear(); | ||||
| psys->tag_update(scene); | psys->tag_update(scene); | ||||
| } | } | ||||
| /* add particle */ | /* add particle */ | ||||
| BL::Particle b_pa = b_psys.particles[persistent_id[0]]; | BL::Particle b_pa = b_psys.particles[persistent_id[0]]; | ||||
| Particle pa; | Particle pa; | ||||
| pa.index = persistent_id[0]; | pa.index = persistent_id[0]; | ||||
| pa.age = b_scene.frame_current() - b_pa.birth_time(); | pa.age = b_scene.frame_current() - b_pa.birth_time(); | ||||
| pa.lifetime = b_pa.lifetime(); | pa.lifetime = b_pa.lifetime(); | ||||
| pa.location = get_float3(b_pa.location()); | pa.location = get_float3(b_pa.location()); | ||||
| pa.rotation = get_float4(b_pa.rotation()); | pa.rotation = get_float4(b_pa.rotation()); | ||||
| pa.size = b_pa.size(); | pa.size = b_pa.size(); | ||||
| pa.velocity = get_float3(b_pa.velocity()); | pa.velocity = get_float3(b_pa.velocity()); | ||||
| pa.angular_velocity = get_float3(b_pa.angular_velocity()); | pa.angular_velocity = get_float3(b_pa.angular_velocity()); | ||||
| psys->particles.push_back_slow(pa); | psys->add_particle(pa); | ||||
| object->set_particle_system(psys); | object->set_particle_system(psys); | ||||
| object->set_particle_index(psys->particles.size() - 1); | object->set_particle_index(psys->get_particles().size() - 1); | ||||
| if (object->particle_index_is_modified()) | if (object->particle_index_is_modified()) | ||||
| scene->object_manager->tag_update(scene); | scene->get_object_manager()->tag_update(scene); | ||||
| /* return that this object has particle data */ | /* return that this object has particle data */ | ||||
| return true; | return true; | ||||
| } | } | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||