diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-02 15:09:18 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-07 14:18:15 +0300 |
commit | 7b66f73558d1e4dda308366bc8ad2b5dfa8009d3 (patch) | |
tree | fa1cb6ad40be190d67d578580c0a90f8c0ee7d3d /intern/cycles/blender/blender_mesh.cpp | |
parent | ad489b71646a2e03e2ce9b0d193d541e3987b4cd (diff) |
Cleanup: export particle hair as a separate Cycles object
Diffstat (limited to 'intern/cycles/blender/blender_mesh.cpp')
-rw-r--r-- | intern/cycles/blender/blender_mesh.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index b18f9a37948..d3dac3c6151 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -967,12 +967,12 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph &b_depsgraph, BL::Object &b_ob, BL::Object &b_ob_instance, bool object_updated, - bool show_self, - bool show_particles) + bool use_particle_hair) { /* test if we can instance or if the object is modified */ BL::ID b_ob_data = b_ob.data(); - BL::ID key = (BKE_object_is_modified(b_ob)) ? b_ob_instance : b_ob_data; + BL::ID b_key_id = (BKE_object_is_modified(b_ob)) ? b_ob_instance : b_ob_data; + MeshKey key(b_key_id.ptr.data, use_particle_hair); BL::Material material_override = view_layer.material_override; /* find shader indices */ @@ -1006,7 +1006,7 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph &b_depsgraph, } Mesh *mesh; - if (!mesh_map.sync(&mesh, key)) { + if (!mesh_map.sync(&mesh, b_key_id, key)) { /* if transform was applied to mesh, need full update */ if (object_updated && mesh->transform_applied) ; @@ -1078,7 +1078,7 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph &b_depsgraph, if (b_mesh) { /* Sync mesh itself. */ - if (view_layer.use_surfaces && show_self) { + if (view_layer.use_surfaces && !use_particle_hair) { if (mesh->subdivision_type != Mesh::SUBDIVISION_NONE) create_subd_mesh(scene, mesh, b_ob, b_mesh, used_shaders, dicing_rate, max_subdivisions); else @@ -1088,9 +1088,9 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph &b_depsgraph, } /* Sync hair curves. */ - if (view_layer.use_hair && show_particles && + if (view_layer.use_hair && use_particle_hair && mesh->subdivision_type == Mesh::SUBDIVISION_NONE) { - sync_curves(mesh, b_mesh, b_ob, false); + sync_particle_hair(mesh, b_mesh, b_ob, false); } free_object_to_mesh(b_data, b_ob, b_mesh); @@ -1099,7 +1099,9 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph &b_depsgraph, mesh->geometry_flags = requested_geometry_flags; /* mesh fluid motion mantaflow */ - sync_mesh_fluid_motion(b_ob, scene, mesh); + if (!use_particle_hair) { + sync_mesh_fluid_motion(b_ob, scene, mesh); + } /* tag update */ bool rebuild = (oldtriangles != mesh->triangles) || (oldsubd_faces != mesh->subd_faces) || @@ -1258,7 +1260,7 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph &b_depsgraph, /* hair motion */ if (numkeys) - sync_curves(mesh, b_mesh, b_ob, true, motion_step); + sync_particle_hair(mesh, b_mesh, b_ob, true, motion_step); /* free derived mesh */ free_object_to_mesh(b_data, b_ob, b_mesh); |