Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_util.h
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
| static inline BL::Mesh object_to_mesh(BL::BlendData& data, | static inline BL::Mesh object_to_mesh(BL::BlendData& data, | ||||
| BL::Object& object, | BL::Object& object, | ||||
| BL::Scene& scene, | BL::Scene& scene, | ||||
| bool apply_modifiers, | bool apply_modifiers, | ||||
| bool render, | bool render, | ||||
| bool calc_undeformed, | bool calc_undeformed, | ||||
| bool subdivision) | bool subdivision) | ||||
| { | { | ||||
| bool subsurf_mod_show_render; | |||||
| bool subsurf_mod_show_viewport; | |||||
| if(subdivision) { | |||||
| BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1]; | |||||
| subsurf_mod_show_render = subsurf_mod.show_render(); | |||||
| subsurf_mod_show_viewport = subsurf_mod.show_render(); | |||||
| subsurf_mod.show_render(false); | |||||
| subsurf_mod.show_viewport(false); | |||||
| } | |||||
brecht: This kind of manipulation of scene data in export is not a problem now, but in the future it… | |||||
| BL::Mesh me = data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, false, calc_undeformed); | BL::Mesh me = data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, false, calc_undeformed); | ||||
| if(subdivision) { | |||||
| BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1]; | |||||
| subsurf_mod.show_render(subsurf_mod_show_render); | |||||
| subsurf_mod.show_viewport(subsurf_mod_show_viewport); | |||||
| } | |||||
| if((bool)me) { | if((bool)me) { | ||||
| if(me.use_auto_smooth()) { | if(me.use_auto_smooth()) { | ||||
| me.calc_normals_split(); | me.calc_normals_split(); | ||||
| } | } | ||||
| if(!subdivision) { | if(!subdivision) { | ||||
| me.calc_tessface(true); | me.calc_tessface(true); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 665 Lines • Show Last 20 Lines | |||||
This kind of manipulation of scene data in export is not a problem now, but in the future it could be if we do better multithreading. Probably "ignore the last subdivision modifier" should become an API feature then, but I think it's ok as is for now.