Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_util.h
| Show All 40 Lines | |||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| void python_thread_state_save(void **python_thread_state); | void python_thread_state_save(void **python_thread_state); | ||||
| void python_thread_state_restore(void **python_thread_state); | void python_thread_state_restore(void **python_thread_state); | ||||
| 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, | ||||
| BL::SceneLayer scene_layer, | BL::ViewLayer view_layer, | ||||
| bool apply_modifiers, | bool apply_modifiers, | ||||
| bool render, | bool render, | ||||
| bool calc_undeformed, | bool calc_undeformed, | ||||
| Mesh::SubdivisionType subdivision_type) | Mesh::SubdivisionType subdivision_type) | ||||
| { | { | ||||
| bool subsurf_mod_show_render = false; | bool subsurf_mod_show_render = false; | ||||
| bool subsurf_mod_show_viewport = false; | bool subsurf_mod_show_viewport = false; | ||||
| if(subdivision_type != Mesh::SUBDIVISION_NONE) { | if(subdivision_type != Mesh::SUBDIVISION_NONE) { | ||||
| BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1]; | BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1]; | ||||
| subsurf_mod_show_render = subsurf_mod.show_render(); | subsurf_mod_show_render = subsurf_mod.show_render(); | ||||
| subsurf_mod_show_viewport = subsurf_mod.show_viewport(); | subsurf_mod_show_viewport = subsurf_mod.show_viewport(); | ||||
| subsurf_mod.show_render(false); | subsurf_mod.show_render(false); | ||||
| subsurf_mod.show_viewport(false); | subsurf_mod.show_viewport(false); | ||||
| } | } | ||||
| BL::Mesh me = data.meshes.new_from_object(scene, scene_layer, object, apply_modifiers, (render)? 2: 1, false, calc_undeformed); | BL::Mesh me = data.meshes.new_from_object(scene, view_layer, object, apply_modifiers, (render)? 2: 1, false, calc_undeformed); | ||||
| if(subdivision_type != Mesh::SUBDIVISION_NONE) { | if(subdivision_type != Mesh::SUBDIVISION_NONE) { | ||||
| BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1]; | BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1]; | ||||
| subsurf_mod.show_render(subsurf_mod_show_render); | subsurf_mod.show_render(subsurf_mod_show_render); | ||||
| subsurf_mod.show_viewport(subsurf_mod_show_viewport); | subsurf_mod.show_viewport(subsurf_mod_show_viewport); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | if(array[i]) | ||||
| layer |= (1 << i); | layer |= (1 << i); | ||||
| return layer; | return layer; | ||||
| } | } | ||||
| static inline uint get_layer(const BL::Array<int, 20>& array, | static inline uint get_layer(const BL::Array<int, 20>& array, | ||||
| const BL::Array<int, 8>& local_array, | const BL::Array<int, 8>& local_array, | ||||
| bool is_light = false, | bool is_light = false, | ||||
| uint scene_layers = (1 << 20) - 1) | uint view_layers = (1 << 20) - 1) | ||||
| { | { | ||||
| uint layer = 0; | uint layer = 0; | ||||
| for(uint i = 0; i < 20; i++) | for(uint i = 0; i < 20; i++) | ||||
| if(array[i]) | if(array[i]) | ||||
| layer |= (1 << i); | layer |= (1 << i); | ||||
| if(is_light) { | if(is_light) { | ||||
| /* Consider light is visible if it was visible without layer | /* Consider light is visible if it was visible without layer | ||||
| * override, which matches behavior of Blender Internal. | * override, which matches behavior of Blender Internal. | ||||
| */ | */ | ||||
| if(layer & scene_layers) { | if(layer & view_layers) { | ||||
| for(uint i = 0; i < 8; i++) | for(uint i = 0; i < 8; i++) | ||||
| layer |= (1 << (20+i)); | layer |= (1 << (20+i)); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| for(uint i = 0; i < 8; i++) | for(uint i = 0; i < 8; i++) | ||||
| if(local_array[i]) | if(local_array[i]) | ||||
| layer |= (1 << (20+i)); | layer |= (1 << (20+i)); | ||||
| ▲ Show 20 Lines • Show All 489 Lines • Show Last 20 Lines | |||||