Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_util.h
| Show All 37 Lines | |||||
| float *BKE_image_get_float_pixels_for_frame(void *image, int frame); | float *BKE_image_get_float_pixels_for_frame(void *image, int frame); | ||||
| } | } | ||||
| 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::Depsgraph & /*depsgraph*/, | BL::Depsgraph & /*depsgraph*/, | ||||
| bool /*calc_undeformed*/, | bool /*calc_undeformed*/, | ||||
| Mesh::SubdivisionType subdivision_type) | Mesh::SubdivisionType subdivision_type) | ||||
| { | { | ||||
| /* TODO: make this work with copy-on-write, modifiers are already evaluated. */ | /* TODO: make this work with copy-on-write, modifiers are already evaluated. */ | ||||
| #if 0 | #if 0 | ||||
| bool subsurf_mod_show_render = false; | bool subsurf_mod_show_render = false; | ||||
| Show All 15 Lines | if (object.type() == BL::Object::type_MESH) { | ||||
| /* TODO: calc_undeformed is not used. */ | /* TODO: calc_undeformed is not used. */ | ||||
| mesh = BL::Mesh(object.data()); | mesh = BL::Mesh(object.data()); | ||||
| /* Make a copy to split faces if we use autosmooth, otherwise not needed. | /* Make a copy to split faces if we use autosmooth, otherwise not needed. | ||||
| * Also in edit mode do we need to make a copy, to ensure data layers like | * Also in edit mode do we need to make a copy, to ensure data layers like | ||||
| * UV are not empty. */ | * UV are not empty. */ | ||||
| if (mesh.is_editmode() || | if (mesh.is_editmode() || | ||||
| (mesh.use_auto_smooth() && subdivision_type == Mesh::SUBDIVISION_NONE)) { | (mesh.use_auto_smooth() && subdivision_type == Mesh::SUBDIVISION_NONE)) { | ||||
| mesh = data.meshes.new_from_object(object); | mesh = object.to_mesh(); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| mesh = data.meshes.new_from_object(object); | mesh = object.to_mesh(); | ||||
| } | } | ||||
| #if 0 | #if 0 | ||||
| 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); | ||||
| } | } | ||||
| #endif | #endif | ||||
| if ((bool)mesh && subdivision_type == Mesh::SUBDIVISION_NONE) { | if ((bool)mesh && subdivision_type == Mesh::SUBDIVISION_NONE) { | ||||
| if (mesh.use_auto_smooth()) { | if (mesh.use_auto_smooth()) { | ||||
| mesh.split_faces(false); | mesh.split_faces(false); | ||||
| } | } | ||||
| mesh.calc_loop_triangles(); | mesh.calc_loop_triangles(); | ||||
| } | } | ||||
| return mesh; | return mesh; | ||||
| } | } | ||||
| static inline void free_object_to_mesh(BL::BlendData &data, BL::Object &object, BL::Mesh &mesh) | static inline void free_object_to_mesh(BL::BlendData & /*data*/, | ||||
| BL::Object &object, | |||||
| BL::Mesh &mesh) | |||||
| { | { | ||||
| /* Free mesh if we didn't just use the existing one. */ | /* Free mesh if we didn't just use the existing one. */ | ||||
| if (object.data().ptr.data != mesh.ptr.data) { | if (object.data().ptr.data != mesh.ptr.data) { | ||||
| data.meshes.remove(mesh, false, true, false); | object.to_mesh_clear(); | ||||
| } | } | ||||
| } | } | ||||
| static inline void colorramp_to_array(BL::ColorRamp &ramp, | static inline void colorramp_to_array(BL::ColorRamp &ramp, | ||||
| array<float3> &ramp_color, | array<float3> &ramp_color, | ||||
| array<float> &ramp_alpha, | array<float> &ramp_alpha, | ||||
| int size) | int size) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 702 Lines • Show Last 20 Lines | |||||