Cycles: Pass explicit subdivision type to object_to_mesh

This allows us to do some extra logic checks there based on particular
subdivision type.

Additionally avoids implicit cast of enum to bool.
This commit is contained in:
Sergey Sharybin
2017-01-11 16:23:54 +01:00
parent 2b66a17e50
commit 38b0141554
2 changed files with 18 additions and 6 deletions

View File

@@ -961,7 +961,13 @@ Mesh *BlenderSync::sync_mesh(BL::Object& b_ob,
mesh->subdivision_type = object_subdivision_type(b_ob, preview, experimental);
BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, need_undeformed, mesh->subdivision_type);
BL::Mesh b_mesh = object_to_mesh(b_data,
b_ob,
b_scene,
true,
!preview,
need_undeformed,
mesh->subdivision_type);
if(b_mesh) {
if(render_layer.use_surfaces && !hide_tris) {
@@ -1086,7 +1092,13 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
if(ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) {
/* get derived mesh */
b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, false, false);
b_mesh = object_to_mesh(b_data,
b_ob,
b_scene,
true,
!preview,
false,
Mesh::SUBDIVISION_NONE);
}
if(!b_mesh) {

View File

@@ -48,12 +48,12 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
bool apply_modifiers,
bool render,
bool calc_undeformed,
bool subdivision)
Mesh::SubdivisionType subdivision_type)
{
bool subsurf_mod_show_render;
bool subsurf_mod_show_viewport;
if(subdivision) {
if(subdivision_type != Mesh::SUBDIVISION_NONE) {
BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1];
subsurf_mod_show_render = subsurf_mod.show_render();
@@ -65,7 +65,7 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
BL::Mesh me = data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, false, calc_undeformed);
if(subdivision) {
if(subdivision_type != Mesh::SUBDIVISION_NONE) {
BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1];
subsurf_mod.show_render(subsurf_mod_show_render);
@@ -76,7 +76,7 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
if(me.use_auto_smooth()) {
me.calc_normals_split();
}
if(!subdivision) {
if(subdivision_type == Mesh::SUBDIVISION_NONE) {
me.calc_tessface(true);
}
}